# HG changeset patch # User neko259 # Date 2013-03-24 08:26:37 # Node ID ad336fa542dd71fb8a5ac2f1c250ae6f9cf05de6 # Parent 051499a084f30121bd686071ec8acce3d6911587 Renamed model "admins" to "admin". diff --git a/boards/admin.py b/boards/admin.py --- a/boards/admin.py +++ b/boards/admin.py @@ -1,6 +1,6 @@ from django.contrib import admin -from boards.models import Post, Tag, Admins +from boards.models import Post, Tag, Admin admin.site.register(Post) admin.site.register(Tag) -admin.site.register(Admins) +admin.site.register(Admin) diff --git a/boards/models.py b/boards/models.py --- a/boards/models.py +++ b/boards/models.py @@ -51,7 +51,7 @@ class PostManager(models.Manager): return len(posts) > 0 def is_admin(self, user, passw): - return Admins.objects.filter(name = user, password = passw) is not None + return Admin.objects.filter(name = user, password = passw) is not None class Tag(models.Model): @@ -81,7 +81,7 @@ class Post(models.Model): return self.title + ' (' + self.text + ')' -class Admins(models.Model): +class Admin(models.Model): """ Model for admin users """ diff --git a/boards/views.py b/boards/views.py --- a/boards/views.py +++ b/boards/views.py @@ -1,5 +1,5 @@ from django.template import RequestContext -from boards.models import Post, Admins +from boards.models import Post, Admin from django.shortcuts import render from django.http import HttpResponseRedirect @@ -45,8 +45,10 @@ def thread(request): # TODO Show all posts for the current thread def login(request): - if 'name' in request.POST and 'password' in request.POST\ - and Admins.objects.is_admin(request.POST['name'], + """Log in as admin""" + + if 'name' in request.POST and 'password' in request.POST \ + and Admin.objects.is_admin(request.POST['name'], request.POST['password']): if request.POST['name'] == 'ilyas':