summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorEvangelos Foutras <foutrelis@gmail.com>2010-01-31 07:53:27 +0200
committerDan McGee <dan@archlinux.org>2010-01-31 13:44:03 -0600
commit09a3a08144fd14fcd905cdf3e86dcc240458040c (patch)
tree72a03516cf3fa888d57cdca5b1fb18717532849f /packages
parent2c3c6cc2e1dc070395481f92f5499113b9e5a6bf (diff)
Adjust models and views for nullable maintainer
Signed-off-by: Evangelos Foutras <foutrelis@gmail.com> [Dan: made a few other small touchups] Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages')
-rw-r--r--packages/views.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/packages/views.py b/packages/views.py
index d696b7eb..aa66271f 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -21,10 +21,10 @@ def update(request):
mode = None
if request.POST.has_key('adopt'):
mode = 'adopt'
- maint_id = request.user.id
+ maint = request.user
if request.POST.has_key('disown'):
mode = 'disown'
- maint_id = 0
+ maint = None
if mode:
pkgs = Package.objects.filter(
@@ -35,7 +35,7 @@ def update(request):
repo__in=request.user.userprofile_user.all(
)[0].allowed_repos.all())
for pkg in pkgs:
- pkg.maintainer_id = maint_id
+ pkg.maintainer = maint
pkg.save()
request.user.message_set.create(message="%d packages %sed" % (
@@ -65,8 +65,8 @@ def getmaintainer(request, name, repo, arch):
pkg= get_object_or_404(Package,
pkgname=name, repo__name__iexact=repo, arch__name=arch)
- return HttpResponse(str(pkg.maintainer if pkg.maintainer_id else 'None'))
-
+ return HttpResponse(str(pkg.maintainer))
+
class PackageSearchForm(forms.Form):
repo = forms.ChoiceField(required=False)
arch = forms.ChoiceField(required=False)
@@ -132,7 +132,7 @@ def search(request, page=None):
packages = packages.filter(
arch__name=form.cleaned_data['arch'])
if form.cleaned_data['maintainer'] == 'orphan':
- packages=packages.filter(maintainer__id = 0)
+ packages=packages.filter(maintainer=None)
elif form.cleaned_data['maintainer']:
packages = packages.filter(
maintainer__username=form.cleaned_data['maintainer'])
@@ -251,8 +251,8 @@ def flag(request, pkgid):
for package in pkgs:
package.needupdate = 1
package.save()
-
- if pkg.maintainer_id == 0:
+
+ if not pkg.maintainer:
toemail = 'arch-notifications@archlinux.org'
subject = 'Orphan %s package [%s] marked out-of-date' % (pkg.repo.name, pkg.pkgname)
else: