Subdomain Posts
None | 22 days ago
None | 164 days ago
Python | 164 days ago
None | 164 days ago
Python | 164 days ago
None | 171 days ago
Python | 227 days ago
Python | 227 days ago
None | 227 days ago
Python | 227 days ago
Recent Posts
None | 8 sec ago
None | 45 sec ago
None | 48 sec ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
OCaml | 2 min ago
PHP | 2 min ago
None | 2 min ago
ASM (NASM) | 3 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By mtigas on the 23rd of Jul 2008 08:35:35 AM Download | Raw | Embed | Report
  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'),)
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: