Guest User

mtigas

a guest
Jul 23rd, 2008
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. #models.py for newforms-admin permissions example
  2. #see http://www.miketigas.com/?p=625
  3. from django.db import models
  4. from django.contrib.auth.models import User
  5.  
  6. class Blog(models.Model):
  7.     name        = models.CharField(max_length=30)
  8.     slug = models.SlugField()
  9.     description = models.TextField()
  10.     # the user that "owns" this blog
  11.     user        = models.ForeignKey(User,blank=True,null=True)
  12.  
  13.     def __unicode__(self):
  14.         return u'%s' % (self.name)
  15.  
  16.     class Meta:
  17.         permissions = (('access_all_blogs','Access to all blogs'),)
  18.  
  19. class BlogPost(models.Model):
  20.     title = models.CharField(max_length=30)
  21.     slug = models.SlugField()
  22.     pubdate = models.DateTimeField()
  23.     post = models.TextField()
  24.  
  25.     def __unicode__(self):
  26.         return u'%s' % (self.title)
  27.  
  28.     class Meta:
  29.         permissions = (('access_all_posts','Access to all posts'),)
  30.  
Advertisement
Add Comment
Please, Sign In to add comment