Posted by mtigas on Wed 23 Jul 09:35
report abuse | download | new post
- #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'),)
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.