Advertisement
Guest User

Untitled

a guest
Feb 19th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. from django.db import models
  2. from django.contrib.auth.models import User
  3.  
  4. # Create your models here.
  5.  
  6. class UserProfile(models.Model):
  7.   user = models.OneToOneField(User)
  8.  
  9.   def __unicode__(self):
  10.    return self.user.username
  11.  
  12. class Post(models.Model):
  13.   header = models.CharField(max_length = 30)
  14.   text = models.CharField(max_length = 170)
  15.   author = models.ForeignKey(UserProfile)
  16.  
  17.   def __str__(self):
  18.     return self.post
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement