From: Aditi Mittal Date: Wed, 18 Sep 2013 15:29:27 +0000 (+0530) Subject: Write view for blog about page. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=310c3073b8b9bb8a958905d00d0277f9802a9488;p=mediagoblin.git Write view for blog about page. --- diff --git a/mediagoblin/media_types/blog/views.py b/mediagoblin/media_types/blog/views.py index ee20ae74..85e4416c 100644 --- a/mediagoblin/media_types/blog/views.py +++ b/mediagoblin/media_types/blog/views.py @@ -213,6 +213,8 @@ def blog_dashboard(request, page): user = request.db.User.query.filter_by(username=url_user).one() blog_slug = request.matchdict.get('blog_slug', None) blogs = request.db.Blog.query.filter_by(author=user.id) + config = pluginapi.get_config('mediagoblin.media_types.blog') + max_blog_count = config['max_blog_count'] if (request.user and request.user.id == user.id) or (request.user and request.user.is_admin): if blog_slug: blog = blogs.filter(Blog.slug==blog_slug).first() @@ -240,7 +242,8 @@ def blog_dashboard(request, page): 'mediagoblin/blog/list_of_blogs.html', { 'blogs':blogs, - 'user':user + 'user':user, + 'max_blog_count':max_blog_count }) @@ -288,6 +291,7 @@ def draft_view(request): {'blogpost':blogpost, 'blog': blog }) + @require_active_login def blog_delete(request, **kwargs): url_user = request.matchdict.get('user') @@ -301,7 +305,6 @@ def blog_delete(request, **kwargs): form = blog_forms.ConfirmDeleteForm(request.form) if request.user.id == blog.author or request.user.is_admin: if request.method == 'POST' and form.validate(): - _log.info('blab blab1') if form.confirm.data is True: blog.delete() add_message( @@ -332,6 +335,30 @@ def blog_delete(request, **kwargs): _("The blog was not deleted because you have no rights.")) return redirect(request, "mediagoblin.media_types.blog.blog_admin_dashboard", user=request.user.username) + +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_by(username=url_user).first() + blog = request.db.Blog.query.filter_by(author=user.id, slug=blog_slug).first() + + if not user or not blog: + return render_404(request) + + + else: + blog_posts_processed = blog.get_all_blog_posts(u'processed').count() + return render_to_response( + request, + 'mediagoblin/blog/blog_about.html', + {'user': user, + 'blog': blog, + 'blogpost_count': blog_posts_processed + }) + + +