From 39a548fd2629f3b6383990264b2e331b3aea99fb Mon Sep 17 00:00:00 2001 From: eliott Date: Sat, 3 Nov 2007 03:45:10 -0400 Subject: Initial import for public release... Special Note Prior to git import, approx 90% of the code was done by Judd Vinet. Thanks Judd! --- common/__init__.py | 0 common/models.py | 50 +++++++++++++++++++++++++++++++++++++++ common/templatetags/__init__.py | 0 common/templatetags/validation.py | 12 ++++++++++ 4 files changed, 62 insertions(+) create mode 100644 common/__init__.py create mode 100644 common/models.py create mode 100644 common/templatetags/__init__.py create mode 100644 common/templatetags/validation.py (limited to 'common') diff --git a/common/__init__.py b/common/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/common/models.py b/common/models.py new file mode 100644 index 0000000..883675b --- /dev/null +++ b/common/models.py @@ -0,0 +1,50 @@ +from django.db import models +from django.contrib.auth.models import User + +class Mirror(models.Model): + id = models.AutoField(primary_key=True) + domain = models.CharField(maxlength=255) + country = models.CharField(maxlength=255) + url = models.CharField(maxlength=255) + protocol_list = models.CharField(maxlength=255, null=True, blank=True) + admin_email = models.CharField(maxlength=255, null=True, blank=True) + def __str__(self): + return self.domain + class Admin: + list_display = ('domain', 'country') + list_filter = ('country',) + ordering = ['domain'] + search_fields = ('domain') + pass + +class Donator(models.Model): + id = models.AutoField(primary_key=True) + name = models.CharField(maxlength=255) + def __str__(self): + return self.name + class Admin: + ordering = ['name'] + search_fields = ('name') + pass + +class UserProfile(models.Model): + id = models.AutoField(primary_key=True) # not technically needed + notify = models.BooleanField("Send notifications", default=True, help_text="When enabled, user will recieve 'flag out of date' notifications") + alias = models.CharField(core=True, maxlength=50, help_text="Required field") + public_email = models.CharField(core=True, maxlength=50, help_text="Required field") + other_contact = models.CharField(maxlength=100, null=True, blank=True) + website = models.URLField(null=True, blank=True) + yob = models.IntegerField(null=True, blank=True) + location = models.CharField(maxlength=50, null=True, blank=True) + languages = models.CharField(maxlength=50, null=True, blank=True) + interests = models.CharField(maxlength=255, null=True, blank=True) + occupation = models.CharField(maxlength=50, null=True, blank=True) + roles = models.CharField(maxlength=255, null=True, blank=True) + favorite_distros = models.CharField(maxlength=255, null=True, blank=True) + picture = models.FileField(upload_to='devs', default='devs/silhouette.png') + user = models.ForeignKey(User, edit_inline=models.STACKED, num_in_admin=1, min_num_in_admin=1, max_num_in_admin=1, num_extra_on_change=0, unique=True) + class Meta: + db_table = 'user_profiles' + verbose_name = 'Additional Profile Data' + verbose_name_plural = 'Additional Profile Data' + diff --git a/common/templatetags/__init__.py b/common/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/common/templatetags/validation.py b/common/templatetags/validation.py new file mode 100644 index 0000000..40c48da --- /dev/null +++ b/common/templatetags/validation.py @@ -0,0 +1,12 @@ +from django import template + +register = template.Library() + +@register.inclusion_tag('errors.html') +def print_errors(errors): + errs = [] + for e,msg in errors.iteritems(): + errmsg = str(msg[0]) + # hack -- I'm a python idiot + errs.append( (e, errmsg[2:-2]) ) + return {'errors': errs} -- cgit v1.2.3-24-g4f1b