Rename publisher->org in Product model
authorMagnus Hagander <magnus@hagander.net>
Tue, 26 Jun 2012 12:32:13 +0000 (14:32 +0200)
committerMagnus Hagander <magnus@hagander.net>
Tue, 26 Jun 2012 12:48:10 +0000 (14:48 +0200)
This is requied to support notifications, and good for consistency
in general.

pgweb/downloads/admin.py
pgweb/downloads/models.py
templates/downloads/productlist.html

index b4674c37e2494834f74eef322eeee7f1b3b837bd..d08e375709d3ce4114b914a8d475fb3d815dfdee 100644 (file)
@@ -9,7 +9,7 @@ class MirrorAdmin(admin.ModelAdmin):
        ordering = ('country_code', )
 
 class ProductAdmin(PgwebAdmin):
-       list_display = ('name', 'publisher', 'approved', 'lastconfirmed',)
+       list_display = ('name', 'org', 'approved', 'lastconfirmed',)
        list_filter = ('approved',)
        search_fields = ('name', 'description', )
        ordering = ('name', )
index b8957ef3ee12b61eed22c3b2276e035d6dc11fd1..4ace231a036e3d65fdf77054ffb5bb0723959fad 100644 (file)
@@ -78,7 +78,7 @@ class LicenceType(models.Model):
 class Product(PgModel, models.Model):
        name = models.CharField(max_length=100, null=False, blank=False, unique=True)
        approved = models.BooleanField(null=False, default=False)
-       publisher = models.ForeignKey(Organisation, null=False)
+       org = models.ForeignKey(Organisation, db_column="publisher_id", null=False)
        url = models.URLField(null=False, blank=False)
        category = models.ForeignKey(Category, null=False)
        licencetype = models.ForeignKey(LicenceType, null=False, verbose_name="Licence type")
@@ -93,7 +93,7 @@ class Product(PgModel, models.Model):
                return self.name
 
        def verify_submitter(self, user):
-               return (len(self.publisher.managers.filter(pk=user.pk)) == 1)
+               return (len(self.org.managers.filter(pk=user.pk)) == 1)
 
        class Meta:
                ordering = ('name',)
index ae03f5cf4f8e20bb9c5a8835a7e7703ad322b052..8cf95d565b400b08727a21573dd4b97ca07d3a49 100644 (file)
@@ -31,7 +31,7 @@
 {%endif%}
 <tr>
   <th class="colFirst">Publisher</th>
-  <td class="colLast"><a href="{{product.publisher.url}}">{{product.publisher.name}}</a></td>
+  <td class="colLast"><a href="{{product.org.url}}">{{product.org.name}}</a></td>
 </tr>
 </table>
 </div>