summaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authoreliott <eliott@cactuswax.net>2007-12-29 15:07:19 -0800
committereliott <eliott@cactuswax.net>2007-12-29 15:07:19 -0800
commitc1063478aa989685b300c383580fc4ffc8b89f27 (patch)
tree1b04ff152d3e2d3bd261e4a797e5862c1eb30f70 /public
parent28bc93261ef027d5c175de3d87c15b818543e151 (diff)
downloadarchweb-c1063478aa989685b300c383580fc4ffc8b89f27.tar.gz
archweb-c1063478aa989685b300c383580fc4ffc8b89f27.zip
Moved common to public
Diffstat (limited to 'public')
-rw-r--r--public/models.py50
-rw-r--r--public/templatetags/__init__.py0
-rw-r--r--public/templatetags/validation.py12
-rw-r--r--public/views.py2
4 files changed, 63 insertions, 1 deletions
diff --git a/public/models.py b/public/models.py
new file mode 100644
index 00000000..883675b6
--- /dev/null
+++ b/public/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/public/templatetags/__init__.py b/public/templatetags/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/public/templatetags/__init__.py
diff --git a/public/templatetags/validation.py b/public/templatetags/validation.py
new file mode 100644
index 00000000..40c48da9
--- /dev/null
+++ b/public/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}
diff --git a/public/views.py b/public/views.py
index 63dda5ef..6c698312 100644
--- a/public/views.py
+++ b/public/views.py
@@ -4,7 +4,7 @@ from django.contrib.auth.models import User
from archweb_dev.packages.models import Package, Repo
from archweb_dev.news.models import News
from archweb_dev.settings import DATA_DIR
-from archweb_dev.common.models import Donator, Mirror
+from archweb_dev.public.models import Donator, Mirror
def index(request):
# get the most recent 10 news items