##// END OF EJS Templates
Renamed model "admins" to "admin".
neko259 -
r11:ad336fa5 default
parent child Browse files
Show More
@@ -1,6 +1,6 b''
1 1 from django.contrib import admin
2 from boards.models import Post, Tag, Admins
2 from boards.models import Post, Tag, Admin
3 3
4 4 admin.site.register(Post)
5 5 admin.site.register(Tag)
6 admin.site.register(Admins)
6 admin.site.register(Admin)
@@ -51,7 +51,7 b' class PostManager(models.Manager):'
51 51 return len(posts) > 0
52 52
53 53 def is_admin(self, user, passw):
54 return Admins.objects.filter(name = user, password = passw) is not None
54 return Admin.objects.filter(name = user, password = passw) is not None
55 55
56 56
57 57 class Tag(models.Model):
@@ -81,7 +81,7 b' class Post(models.Model):'
81 81 return self.title + ' (' + self.text + ')'
82 82
83 83
84 class Admins(models.Model):
84 class Admin(models.Model):
85 85 """
86 86 Model for admin users
87 87 """
@@ -1,5 +1,5 b''
1 1 from django.template import RequestContext
2 from boards.models import Post, Admins
2 from boards.models import Post, Admin
3 3 from django.shortcuts import render
4 4 from django.http import HttpResponseRedirect
5 5
@@ -45,8 +45,10 b' def thread(request):'
45 45 # TODO Show all posts for the current thread
46 46
47 47 def login(request):
48 """Log in as admin"""
49
48 50 if 'name' in request.POST and 'password' in request.POST\
49 and Admins.objects.is_admin(request.POST['name'],
51 and Admin.objects.is_admin(request.POST['name'],
50 52 request.POST['password']):
51 53
52 54 if request.POST['name'] == 'ilyas':
General Comments 0
You need to be logged in to leave comments. Login now