Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #models.py for newforms-admin permissions example
- #see http://www.miketigas.com/?p=625
- from django.db import models
- from django.contrib.auth.models import User
- class Blog(models.Model):
- name = models.CharField(max_length=30)
- slug = models.SlugField()
- description = models.TextField()
- # the user that "owns" this blog
- user = models.ForeignKey(User,blank=True,null=True)
- def __unicode__(self):
- return u'%s' % (self.name)
- class Meta:
- permissions = (('access_all_blogs','Access to all blogs'),)
- class BlogPost(models.Model):
- title = models.CharField(max_length=30)
- slug = models.SlugField()
- pubdate = models.DateTimeField()
- post = models.TextField()
- def __unicode__(self):
- return u'%s' % (self.title)
- class Meta:
- permissions = (('access_all_posts','Access to all posts'),)
Advertisement
Add Comment
Please, Sign In to add comment