django / tests / regressiontests / admin_widgets / models.py

The default branch has multiple heads

bro...@bcc190cf-… 1bd979d 
ja...@bcc190cf-c… a70a9fe 
bro...@bcc190cf-… 1bd979d 
Al...@bcc190cf-c… 911edad 


ja...@bcc190cf-c… 621800c 
bro...@bcc190cf-… 1bd979d 

ja...@bcc190cf-c… a70a9fe 

Ian Struble a035b2f 
bro...@bcc190cf-… dea8289 
bro...@bcc190cf-… 1bd979d 





bro...@bcc190cf-… dea8289 
bro...@bcc190cf-… 1bd979d 





ja...@bcc190cf-c… 935eb38 
ja...@bcc190cf-c… 621800c 
bro...@bcc190cf-… dea8289 
bro...@bcc190cf-… 1bd979d 


bro...@bcc190cf-… 702b2b0 

mboe...@bcc190cf… 5e17d00 
bro...@bcc190cf-… 702b2b0 
bro...@bcc190cf-… dea8289 



bro...@bcc190cf-… 702b2b0 
mboe...@bcc190cf… 5e17d00 
bro...@bcc190cf-… 702b2b0 


bro...@bcc190cf-… dea8289 


mboe...@bcc190cf… 5e17d00 
ja...@bcc190cf-c… a70a9fe 
kmtr...@bcc190cf… d57e98f 
mboe...@bcc190cf… 5e17d00 
ja...@bcc190cf-c… a70a9fe 








mboe...@bcc190cf… 5e17d00 
ja...@bcc190cf-c… a70a9fe 






from django.db import models
from django.contrib.auth.models import User


class MyFileField(models.FileField):
    pass

class Member(models.Model):
    name = models.CharField(max_length=100)
    birthdate = models.DateTimeField(blank=True, null=True)
    gender = models.CharField(max_length=1, blank=True, choices=[('M','Male'), ('F', 'Female')])
    user = models.ForeignKey(User, blank=True, null=True)

    def __unicode__(self):
        return self.name

class Band(models.Model):
    name = models.CharField(max_length=100)
    members = models.ManyToManyField(Member)

    def __unicode__(self):
        return self.name

class Album(models.Model):
    band = models.ForeignKey(Band)
    name = models.CharField(max_length=100)
    cover_art = models.FileField(upload_to='albums')
    backside_art = MyFileField(upload_to='albums_back', null=True)

    def __unicode__(self):
        return self.name

class HiddenInventoryManager(models.Manager):
    def get_query_set(self):
        return super(HiddenInventoryManager, self).get_query_set().filter(hidden=False)

class Inventory(models.Model):
   barcode = models.PositiveIntegerField(unique=True)
   parent = models.ForeignKey('self', to_field='barcode', blank=True, null=True)
   name = models.CharField(blank=False, max_length=20)
   hidden = models.BooleanField(default=False)

   # see #9258
   default_manager = models.Manager()
   objects = HiddenInventoryManager()

   def __unicode__(self):
      return self.name

class Event(models.Model):
    band = models.ForeignKey(Band, limit_choices_to=models.Q(pk__gt=0))
    start_date = models.DateField(blank=True, null=True)
    start_time = models.TimeField(blank=True, null=True)
    description = models.TextField(blank=True)
    link = models.URLField(blank=True)
    min_age = models.IntegerField(blank=True, null=True)

class Car(models.Model):
    owner = models.ForeignKey(User)
    make = models.CharField(max_length=30)
    model = models.CharField(max_length=30)

    def __unicode__(self):
        return u"%s %s" % (self.make, self.model)

class CarTire(models.Model):
    """
    A single car tire. This to test that a user can only select their own cars.
    """
    car = models.ForeignKey(Car)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.