Ticket #10228: models.py

File models.py, 705 bytes (added by lostlogic, 14 years ago)

Relavent models.py

Line 
1from django.db import models
2
3class Category(models.Model):
4    name = models.CharField(max_length=100)
5    description = models.CharField(blank=True, null=True)
6    order = models.IntegerField(unique=True)
7
8    def __unicode__(self):
9        return self.name
10
11    class Meta:
12        ordering = ['order']
13        verbose_name_plural = 'categories'
14
15class Link(models.Model):
16    name = models.CharField(max_length=100)
17    description = models.CharField(blank=True, null=True)
18    target = models.URLField(verify_exists=False)
19    favorite = models.BooleanField()
20    category = models.ForeignKey(Category)
21
22    def __unicode__(self):
23        return self.name
24
25    class Meta:
26        ordering = [ '?' ]
Back to Top