From 376ce4a69e016d13eff28589a5caa627bf7c451b Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 7 Feb 2011 12:48:12 -0600 Subject: Clean up Package related objects code Main change is just to move groups from the default packagegroup_set location to a related_name of groups. Also refer to the Package class directly rather than by text string if we have it available. Signed-off-by: Dan McGee --- main/models.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'main') diff --git a/main/models.py b/main/models.py index ff2ecf02..dc73c986 100644 --- a/main/models.py +++ b/main/models.py @@ -309,14 +309,18 @@ class Signoff(models.Model): packager = models.ForeignKey(User) class PackageFile(models.Model): - pkg = models.ForeignKey('Package') + pkg = models.ForeignKey(Package) path = models.CharField(max_length=255) + + def __unicode__(self): + return self.path + class Meta: db_table = 'package_files' class PackageDepend(models.Model): - pkg = models.ForeignKey('Package') - depname = models.CharField(db_index=True, max_length=255) + pkg = models.ForeignKey(Package) + depname = models.CharField(max_length=255, db_index=True) depvcmp = models.CharField(max_length=255) class Meta: db_table = 'package_depends' @@ -349,8 +353,8 @@ def get_absolute_url(self): return '/todo/%i/' % self.id class TodolistPkg(models.Model): - list = models.ForeignKey('Todolist') - pkg = models.ForeignKey('Package') + list = models.ForeignKey(Todolist) + pkg = models.ForeignKey(Package) complete = models.BooleanField(default=False) class Meta: db_table = 'todolist_pkgs' -- cgit v1.2.3-54-g00ecf