summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--devel/management/commands/reporead.py4
-rw-r--r--main/models.py14
-rw-r--r--packages/models.py5
-rw-r--r--packages/views.py3
-rw-r--r--templates/packages/details.html2
5 files changed, 17 insertions, 11 deletions
diff --git a/devel/management/commands/reporead.py b/devel/management/commands/reporead.py
index e31478c5..bdd0882c 100644
--- a/devel/management/commands/reporead.py
+++ b/devel/management/commands/reporead.py
@@ -203,10 +203,10 @@ def populate_pkg(dbpkg, repopkg, force=False, timestamp=None):
dbpkg.packagedepend_set.create(depname=dpname, depvcmp=dpvcmp)
logger.debug('Added %s as dep for pkg %s', dpname, repopkg.name)
- dbpkg.packagegroup_set.all().delete()
+ dbpkg.groups.all().delete()
if 'groups' in repopkg.__dict__:
for y in repopkg.groups:
- dbpkg.packagegroup_set.create(name=y)
+ dbpkg.groups.create(name=y)
def populate_files(dbpkg, repopkg, force=False):
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 @@ class Todolist(models.Model):
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'
diff --git a/packages/models.py b/packages/models.py
index 70ac4fe5..c217a692 100644
--- a/packages/models.py
+++ b/packages/models.py
@@ -25,7 +25,10 @@ class PackageGroup(models.Model):
Represents a group a package is in. There is no actual group entity,
only names that link to given packages.
'''
- pkg = models.ForeignKey('main.Package')
+ pkg = models.ForeignKey('main.Package', related_name='groups')
name = models.CharField(max_length=255)
+ def __unicode__(self):
+ return self.name
+
# vim: set ts=4 sw=4 et:
diff --git a/packages/views.py b/packages/views.py
index 4f7c3b93..9c34db0c 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -104,8 +104,7 @@ def group_details(request, arch, name):
arch = get_object_or_404(Arch, name=arch)
arches = [ arch ]
arches.extend(Arch.objects.filter(agnostic=True))
- pkgs = Package.objects.filter(packagegroup__name=name,
- arch__in=arches)
+ pkgs = Package.objects.filter(groups__name=name, arch__in=arches)
pkgs = pkgs.order_by('pkgname')
if len(pkgs) == 0:
raise Http404
diff --git a/templates/packages/details.html b/templates/packages/details.html
index fcbaf083..de6b637f 100644
--- a/templates/packages/details.html
+++ b/templates/packages/details.html
@@ -112,7 +112,7 @@
<td>{{ pkg.license }}</td>
</tr><tr>
<th>Groups:</th>
- {% with pkg.packagegroup_set.all as groups %}
+ {% with pkg.groups.all as groups %}
<td>{% if groups %}
{% for g in groups %}
<a href="/groups/{{ pkg.arch.name }}/{{ g.name }}/"