Mercurial > public > sg101
comparison gpp/weblinks/models.py @ 237:1085dc38399e
In support of #92, create management commands to import link and podcast data from the old site in CSV format.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 11 Sep 2010 21:07:28 +0000 |
parents | 71fd8454688b |
children | 7e8d2dda99e3 |
comparison
equal
deleted
inserted
replaced
236:953c71f382df | 237:1085dc38399e |
---|---|
2 This module contains the models for the weblinks application. | 2 This module contains the models for the weblinks application. |
3 """ | 3 """ |
4 import datetime | 4 import datetime |
5 | 5 |
6 from django.db import models | 6 from django.db import models |
7 from django.contrib import auth | 7 from django.contrib.auth.models import User |
8 | 8 |
9 | 9 |
10 class Category(models.Model): | 10 class Category(models.Model): |
11 """Links belong to categories""" | 11 """Links belong to categories""" |
12 title = models.CharField(max_length=64) | 12 title = models.CharField(max_length=64) |
32 """Abstract model to aggregate common fields of a web link.""" | 32 """Abstract model to aggregate common fields of a web link.""" |
33 category = models.ForeignKey(Category) | 33 category = models.ForeignKey(Category) |
34 title = models.CharField(max_length=128) | 34 title = models.CharField(max_length=128) |
35 url = models.URLField(verify_exists=False, db_index=True) | 35 url = models.URLField(verify_exists=False, db_index=True) |
36 description = models.TextField(blank=True) | 36 description = models.TextField(blank=True) |
37 user = models.ForeignKey(auth.models.User) | 37 user = models.ForeignKey(User) |
38 date_added = models.DateField() | 38 date_added = models.DateField() |
39 | 39 |
40 class Meta: | 40 class Meta: |
41 abstract = True | 41 abstract = True |
42 | 42 |
91 | 91 |
92 | 92 |
93 class FlaggedLink(models.Model): | 93 class FlaggedLink(models.Model): |
94 """Model to represent links that have been flagged as broken by users""" | 94 """Model to represent links that have been flagged as broken by users""" |
95 link = models.ForeignKey(Link) | 95 link = models.ForeignKey(Link) |
96 user = models.ForeignKey(auth.models.User) | 96 user = models.ForeignKey(User) |
97 date_flagged = models.DateField(auto_now_add = True) | 97 date_flagged = models.DateField(auto_now_add = True) |
98 approved = models.BooleanField(default = False, | 98 approved = models.BooleanField(default = False, |
99 help_text = 'Check this and save to remove the referenced link from the database') | 99 help_text = 'Check this and save to remove the referenced link from the database') |
100 | 100 |
101 objects = FlaggedLinkManager() | 101 objects = FlaggedLinkManager() |