diff options
-rw-r--r-- | devel/views.py | 6 | ||||
-rw-r--r-- | main/models.py | 7 | ||||
-rw-r--r-- | packages/views.py | 2 | ||||
-rw-r--r-- | todolists/views.py | 2 |
4 files changed, 13 insertions, 4 deletions
diff --git a/devel/views.py b/devel/views.py index 298c65a1..edbe4ca3 100644 --- a/devel/views.py +++ b/devel/views.py @@ -2,6 +2,7 @@ from django import forms from django.http import HttpResponseRedirect from django.contrib.auth.decorators import login_required, user_passes_test from django.contrib.auth.models import User +from django.contrib.sites.models import Site from django.shortcuts import render_to_response from django.template import RequestContext from django.core.mail import send_mail @@ -96,13 +97,14 @@ class NewUserForm(forms.ModelForm): user.save() profile.user = user profile.save() + domain = Site.objects.get_current().domain send_mail("Your new archweb account", """You can now log into: -https://www.archlinux.org/ +https://%s/login/ with these login details: Username: %s -Password: %s""" % (user.username, pw), +Password: %s""" % (domain, user.username, pw), 'Arch Website Notification <nobody@archlinux.org>', [user.email], fail_silently=False) diff --git a/main/models.py b/main/models.py index 7ccb9245..e106313c 100644 --- a/main/models.py +++ b/main/models.py @@ -1,6 +1,7 @@ from django.db import models from django.db.models import Q from django.contrib.auth.models import User +from django.contrib.sites.models import Site from main.middleware import get_user from packages.models import PackageRelation @@ -176,6 +177,7 @@ class Package(models.Model): last_update = models.DateTimeField(null=True, blank=True) files_last_update = models.DateTimeField(null=True, blank=True) license = models.CharField(max_length=255, null=True) + objects = PackageManager() class Meta: db_table = 'packages' @@ -190,6 +192,11 @@ class Package(models.Model): return '/packages/%s/%s/%s/' % (self.repo.name.lower(), self.arch.name, self.pkgname) + def get_full_url(self, proto='http'): + '''get a URL suitable for things like email including the domain''' + domain = Site.objects.get_current().domain + return '%s://%s%s' % (proto, domain, self.get_absolute_url()) + @property def maintainers(self): return User.objects.filter( diff --git a/packages/views.py b/packages/views.py index 9053906b..c3a6c2bb 100644 --- a/packages/views.py +++ b/packages/views.py @@ -302,7 +302,7 @@ def flag(request, name='', repo='', arch=''): 'email': form.cleaned_data['email'], 'message': form.cleaned_data['usermessage'], 'pkg': pkg, - 'weburl': 'http://www.archlinux.org'+ pkg.get_absolute_url() + 'weburl': pkg.get_full_url(), }) send_mail(subject, t.render(c), diff --git a/todolists/views.py b/todolists/views.py index 155e522b..653b5113 100644 --- a/todolists/views.py +++ b/todolists/views.py @@ -139,7 +139,7 @@ def send_todolist_email(todo): page_dict = { 'pkg': todo.pkg, 'todolist': todo.list, - 'weburl': 'http://www.archlinux.org'+ todo.pkg.get_absolute_url() + 'weburl': todo.pkg.get_full_url() } t = loader.get_template('todolists/email_notification.txt') c = Context(page_dict) |