Rename organisation->org in ProfessionalService model
authorMagnus Hagander <magnus@hagander.net>
Tue, 26 Jun 2012 12:25:38 +0000 (14:25 +0200)
committerMagnus Hagander <magnus@hagander.net>
Tue, 26 Jun 2012 12:34:26 +0000 (14:34 +0200)
This is requied to support notifications, and good for consistency
in general.

pgweb/profserv/admin.py
pgweb/profserv/models.py
templates/profserv/list.html

index 204ecc7f8609ffb2c192ca82bc2ff7a353f7cebc..56f4f3a526298bb8837d39a4063f09ae006fa554 100644 (file)
@@ -1,4 +1,4 @@
-from django.contrib import admin
+from util.admin import register_pgwebadmin
 from models import *
 
-admin.site.register(ProfessionalService)
+register_pgwebadmin(ProfessionalService)
index e8e96a6ed480767e29e9c3fde63f91a0dd26f3ab..b155320bca98b3a9aa001e7ebc54bcbea1a90423 100644 (file)
@@ -7,8 +7,9 @@ from pgweb.util.bases import PgModel
 class ProfessionalService(PgModel, models.Model):
        approved = models.BooleanField(null=False, blank=False, default=False)
 
-       organisation = models.ForeignKey(Organisation, null=False, blank=False, unique=True,
-                                                                        help_text="If no organisations are listed, please check the <a href=\"/account/orglist/\">organisation list</a> and contact the organisation manager or webmaster@postgresql.org if none are listed.")
+       org = models.ForeignKey(Organisation, null=False, blank=False, unique=True,
+                                                       db_column="organisation_id",
+                                                       help_text="If no organisations are listed, please check the <a href=\"/account/orglist/\">organisation list</a> and contact the organisation manager or webmaster@postgresql.org if none are listed.")
        description = models.TextField(null=False,blank=False)
        employees = models.CharField(max_length=32, null=True, blank=True)
        locations = models.CharField(max_length=128, null=True, blank=True)
@@ -33,11 +34,11 @@ class ProfessionalService(PgModel, models.Model):
        send_notification = True
        
        def verify_submitter(self, user):
-               return (len(self.organisation.managers.filter(pk=user.pk)) == 1)
+               return (len(self.org.managers.filter(pk=user.pk)) == 1)
 
        def __unicode__(self):
-               return self.organisation.name
+               return self.org.name
        
        class Meta:
-               ordering = ('organisation__name',)
+               ordering = ('org__name',)
 
index 2d94c42e6e3d9e702c8ba6bbc6516f8461754533..2b6fdd4ffc6d51849b159ba4e8fd565f697dae05 100644 (file)
@@ -9,7 +9,7 @@
   <table border="0" cellpadding="0" cellspacing="0" class="tblBasicGrey">\r
    <tr>\r
     <td class="colFirst">Name</td>\r
-    <td class="colMid"><b>{{s.organisation.name}}</b>{%if s.url%} (<a href="{{s.url}}">{{s.url}}</a>){%endif%}</td>\r
+    <td class="colMid"><b>{{s.org.name}}</b>{%if s.url%} (<a href="{{s.url}}">{{s.url}}</a>){%endif%}</td>\r
     <th class="colLast" />\r
    </tr>
    {%if s.provides_hosting and s.provides_support %}\r