models.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. from django.db import models
  2. from django.contrib.auth.models import User
  3. # Create your models here.
  4. class UserProfile(models.Model):
  5. # This line is required. Links UserProfile to a User model instance.
  6. user = models.OneToOneField(User)
  7. # Override the __unicode__() method to return out something meaningful!
  8. def __unicode__(self):
  9. return self.user.username
  10. class Profile(models.Model):
  11. user = models.ForeignKey(User)
  12. oauth_token = models.CharField(max_length=200)
  13. oauth_secret = models.CharField(max_length=200)
  14. def __unicode__(self):
  15. return unicode(self.user)
  16. class InstagramProfile(models.Model):
  17. user = models.ForeignKey(User)
  18. access_token = models.CharField(max_length=200)
  19. def __unicode__(self):
  20. return unicode(self.user)
  21. class Snippet(models.Model):
  22. created = models.DateTimeField(auto_now_add=True)
  23. title = models.CharField(max_length=100, blank=True, default='')
  24. code = models.TextField()
  25. linenos = models.BooleanField(default=False)
  26. class Meta:
  27. ordering = ('created',)