Fix issue 5366 Update blog views
authorayleph <ayleph@thisshitistemp.com>
Sun, 6 Dec 2015 19:48:45 +0000 (14:48 -0500)
committerJessica Tallon <tsyesika@tsyesika.se>
Fri, 15 Jan 2016 10:15:41 +0000 (10:15 +0000)
This commit updates blog views to be compatible with recent database
migrations.

Signed-off-by: Jessica Tallon <tsyesika@tsyesika.se>
mediagoblin/media_types/blog/templates/mediagoblin/blog/blog_admin_dashboard.html
mediagoblin/media_types/blog/templates/mediagoblin/blog/blog_post_listing.html
mediagoblin/media_types/blog/templates/mediagoblin/blog/blogpost_draft_view.html
mediagoblin/media_types/blog/views.py
mediagoblin/templates/mediagoblin/user_pages/blog_media.html

index 1316083b1f9a30c871c4e5b359c09aee0cd301dd..3b881466ab7b7f7a53ce2d686ea3718c2bc3ef44 100644 (file)
@@ -86,7 +86,7 @@
                                  blog_slug=blog.slug, user=request.user.username,
                                  blog_post_slug=blog_post.slug) %}
             {% set blogpost_delete_url = request.urlgen('mediagoblin.user_pages.media_confirm_delete',
-                                 user= blog_post.get_uploader.username,
+                                 user= blog_post.get_actor.username,
                                  media_id=blog_post.id) %}
             <td>
             <a class="button_action" href="{{ blogpost_edit_url }}">{% trans %}Edit{% endtrans %}</a>
index 0013f1a3b794799e46de8f8b46a4cfcfc7fe5b34..3a0fd23dc0cfc7e136b7e0df90c84f5d1ba4d51e 100644 (file)
@@ -48,7 +48,7 @@
                     <a href="{{ request.urlgen(
                           'mediagoblin.user_pages.user_tag_gallery',
                           tag=tag['slug'],
-                          user=post.get_uploader.username) }}">{{ tag['name'] }}  |</a>
+                          user=post.get_actor.username) }}">{{ tag['name'] }}  |</a>
                 {% endfor %}
             {% endif %}
             <div class="b_list_des"> <p>{{ post.description|safe }} </p></div>
index 7c634877078c1fe8a6e5a691091c6456af60d673..6d82055042d261048f491a90c1fd8cf158b47f90 100644 (file)
@@ -30,7 +30,7 @@
                            blog_slug=blog.slug, user=request.user.username, 
                            blog_post_slug=blogpost.slug) %}
 {% set blogpost_delete_url = request.urlgen('mediagoblin.user_pages.media_confirm_delete',
-                             user= blogpost.get_uploader.username,
+                             user= blogpost.get_actor.username,
                              media_id=blogpost.id) %}
             <a class="button_action" href="{{ blogpost_edit_url }}">{% trans %}Edit{% endtrans %}</a>
             <a class="button_action" href="{{ blogpost_delete_url }}">{% trans %}Delete{% endtrans %}</a>
index 3502d7b8dc3d5b39229dcd50aaa956fbf1b3b9de..7e796fe4994e75e010839b14d9984ad0c1d48827 100644 (file)
@@ -143,7 +143,7 @@ def blogpost_create(request):
         blogpost.description = six.text_type(cleaned_markdown_conversion((form.description.data)))
         blogpost.tags =  convert_to_tag_list_of_dicts(form.tags.data)
         blogpost.license = six.text_type(form.license.data) or None
-        blogpost.uploader = request.user.id
+        blogpost.actor = request.user.id
         blogpost.generate_slug()
 
         set_blogpost_state(request, blogpost)
@@ -175,7 +175,7 @@ def blogpost_edit(request):
     blog_slug = request.matchdict.get('blog_slug', None)
     blog_post_slug = request.matchdict.get('blog_post_slug', None)
 
-    blogpost = request.db.MediaEntry.query.filter_by(slug=blog_post_slug, uploader=request.user.id).first()
+    blogpost = request.db.MediaEntry.query.filter_by(slug=blog_post_slug, actor=request.user.id).first()
     blog = get_blog_by_slug(request, blog_slug, author=request.user.id)
 
     if not blogpost or not blog:
@@ -287,7 +287,7 @@ def draft_view(request):
     blog_post_slug = request.matchdict.get('blog_post_slug', None)
     user = request.matchdict.get('user')
     blog = get_blog_by_slug(request, blog_slug, author=request.user.id)
-    blogpost = request.db.MediaEntry.query.filter_by(state = u'failed', uploader=request.user.id, slug=blog_post_slug).first()
+    blogpost = request.db.MediaEntry.query.filter_by(state = u'failed', actor=request.user.id, slug=blog_post_slug).first()
 
     if not blog or not blogpost:
         return render_404(request)
@@ -357,8 +357,8 @@ def blog_about_view(request):
     blog_slug = request.matchdict.get('blog_slug', None)
     url_user = request.matchdict.get('user', None)
 
-    user = request.db.User.query.filter(
-        LocalUser.username=url_user
+    user = request.db.LocalUser.query.filter(
+        LocalUser.username==url_user
     ).first()
     blog = get_blog_by_slug(request, blog_slug, author=user.id)
 
index ece47fe1d92f3939a59519c09bf8e26707077266..ec63e699b6f41a93509faff2720513cf4dfbaea0 100644 (file)
@@ -37,8 +37,8 @@
   <p class="context">
     {%- trans user_url=request.urlgen(
               'mediagoblin.user_pages.user_home',
-              user=media.get_uploader.username),
-              username=media.get_uploader.username -%}
+              user=media.get_actor.username),
+              username=media.get_actor.username -%}
     ❖ Blog post by <a href="{{user_url}}">{{username}}</a>
     {%- endtrans -%}
   </p>
       {% endblock %}
     </div>
         {% if request.user and
-          (media.uploader == request.user.id or
+          (media.actor == request.user.id or
            request.user.has_privilege('admin')) %}
       {% set edit_url = request.urlgen('mediagoblin.media_types.blog.blogpost.edit',
                                  blog_slug=media.media_manager.get_blog_by_blogpost().slug,
                                  user=request.user.username, blog_post_slug=media.slug) %}
       <a class="button_action" href="{{ edit_url }}">{% trans %}Edit{% endtrans %}</a>
       {% set delete_url = request.urlgen('mediagoblin.user_pages.media_confirm_delete',
-                                 user= media.get_uploader.username,
+                                 user= media.get_actor.username,
                                  media_id=media.id) %}
       <a class="button_action" href="{{ delete_url }}">{% trans %}Delete{% endtrans %}</a>
 
@@ -96,7 +96,7 @@
       {% endif %}
       {% if request.user %}
         <form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
-                                         user= media.get_uploader.username,
+                                         user= media.get_actor.username,
                                          media_id=media.id) }}" method="POST" id="form_comment">
           {{ wtforms_util.render_divs(comment_form) }}
           <div class="form_submit_buttons">
             </a>
             <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
                             comment=comment.id,
-                            user=media.get_uploader.username,
+                            user=media.get_actor.username,
                             media=media.slug_or_id) }}#comment"
                class="comment_whenlink">
               <span title='{{- comment.created.strftime("%I:%M%p %Y-%m-%d") -}}'>