Commits

funkybob  committed 7f74132

Added catalogue to Admin
Fixed reference to catalogue in views
Added related name Product.catalogue

  • Participants
  • Parent commits 89a70d0

Comments (0)

Files changed (3)

File gnocchi/store/admin.py

     extra = 0
 
 class ProductAdmin(admin.ModelAdmin):
-    list_display = ('sku', 'name', 'short_description', 'price', 'categories',)
+    list_display = ('sku', 'name', 'short_description', 'price', 'catalogue', 'categories',)
+    list_filter = ('catalogue,')
     inlines = [
         ImageInline,
         PriceBreakInline,

File gnocchi/store/models.py

         return ('catalogue-detail', (), {'catalogue': self.slug})
 
 class Product(models.Model):
-    catalogue = models.ForeignKey('Catalogue')
+    catalogue = models.ForeignKey('Catalogue', related_name='products')
     sku = models.CharField(max_length=64, unique=True, verbose_name='SKU')
     name = models.CharField(max_length=1024)
     order = models.IntegerField(default=0)

File gnocchi/store/views.py

                 self.catalogue = models.Catalogue.objects.get(slug=catalogue)
             except:
                 raise Http404('Catalogue not found')
-            qset = qset.filter(catalogue=catalogue)
+            qset = qset.filter(catalogue=self.catalogue)
         else:
             self.catalogue = None
         # Filter by tags