diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-04-22 00:36:57 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-04-22 00:36:57 -0400 |
commit | df7a6aa620af6a165bdacd755757f8cb1179331c (patch) | |
tree | 384b4c62d1f50d8effb733d81d2a810666807624 /devel/models.py | |
parent | 94f972bb892dbf9a86f089f1872ae6d849c0cd0e (diff) | |
parent | a22557811a24b68ef85d4271787c48d8d1e4fc99 (diff) |
Merge branch 'archweb-generic2'
Conflicts:
README.BRANDING
local_settings.py.example
packages/templatetags/package_extras.py
public/views.py
releng/views.py
settings.py
sitestatic/archnavbar/archnavbar.css
sitestatic/silhouette.png
templates/base.html
templates/packages/differences.html
templates/packages/opensearch.xml
templates/packages/search.html
templates/public/donate.html
templates/public/download.html
templates/public/feeds.html
templates/public/index.html
urls.py
Diffstat (limited to 'devel/models.py')
-rw-r--r-- | devel/models.py | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/devel/models.py b/devel/models.py index fd5a0347..4354e0f2 100644 --- a/devel/models.py +++ b/devel/models.py @@ -2,11 +2,12 @@ import pytz from django.db import models +from django.db.models.signals import pre_save from django.contrib.auth.models import User from django_countries import CountryField from .fields import PGPKeyField -from main.utils import make_choice +from main.utils import make_choice, set_created_field class UserProfile(models.Model): @@ -44,11 +45,13 @@ class UserProfile(models.Model): allowed_repos = models.ManyToManyField('main.Repo', blank=True) latin_name = models.CharField(max_length=255, null=True, blank=True, help_text="Latin-form name; used only for non-Latin full names") + last_modified = models.DateTimeField(editable=False) class Meta: db_table = 'user_profiles' - verbose_name = 'Additional Profile Data' - verbose_name_plural = 'Additional Profile Data' + get_latest_by = 'last_modified' + verbose_name = 'additional profile data' + verbose_name_plural = 'additional profile data' def get_absolute_url(self): # TODO: this is disgusting. find a way to consolidate this logic with @@ -64,7 +67,6 @@ class UserProfile(models.Model): return '/%s/#%s' % (prefix, self.user.username) - class MasterKey(models.Model): owner = models.ForeignKey(User, related_name='masterkey_owner', help_text="The developer holding this master key") @@ -77,12 +79,27 @@ class MasterKey(models.Model): class Meta: ordering = ('created',) + get_latest_by = 'created' def __unicode__(self): return u'%s, created %s' % ( self.owner.get_full_name(), self.created) +class DeveloperKey(models.Model): + owner = models.ForeignKey(User, related_name='all_keys', null=True, + help_text="The developer this key belongs to") + key = PGPKeyField(max_length=40, verbose_name="PGP key fingerprint", + unique=True) + created = models.DateTimeField() + expires = models.DateTimeField(null=True, blank=True) + revoked = models.DateTimeField(null=True, blank=True) + parent = models.ForeignKey('self', null=True, on_delete=models.SET_NULL) + + def __unicode__(self): + return self.key + + class PGPSignature(models.Model): signer = PGPKeyField(max_length=40, verbose_name="Signer key fingerprint") signee = PGPKeyField(max_length=40, verbose_name="Signee key fingerprint") @@ -91,9 +108,15 @@ class PGPSignature(models.Model): valid = models.BooleanField(default=True) class Meta: + ordering = ('signer', 'signee') + get_latest_by = 'created' verbose_name = 'PGP signature' def __unicode__(self): return u'%s → %s' % (self.signer, self.signee) + +pre_save.connect(set_created_field, sender=UserProfile, + dispatch_uid="devel.models") + # vim: set ts=4 sw=4 et: |