Permalink
Browse files

add featured field for Product

  • Loading branch information...
1 parent 9ee2122 commit 472f0ea1fd59c06202eb4e30def46655462ccfb6 @dfalk committed Apr 8, 2012
Showing with 139 additions and 1 deletion.
  1. +128 −0 fprice/migrations/0008_auto__add_field_product_is_featured.py
  2. +11 −1 fprice/models.py
@@ -0,0 +1,128 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ # Adding field 'Product.is_featured'
+ db.add_column('fprice_product', 'is_featured',
+ self.gf('django.db.models.fields.BooleanField')(default=False),
+ keep_default=False)
+
+ def backwards(self, orm):
+ # Deleting field 'Product.is_featured'
+ db.delete_column('fprice_product', 'is_featured')
+
+ models = {
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'fprice.city': {
+ 'Meta': {'ordering': "['title']", 'object_name': 'City'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'fprice.price': {
+ 'Meta': {'ordering': "['-last_time_update']", 'object_name': 'Price'},
+ 'currency': ('django.db.models.fields.CharField', [], {'default': "'rur'", 'max_length': '3'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'last_time_update': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_user_update': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'last_user_update'", 'to': "orm['auth.User']"}),
+ 'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '19', 'decimal_places': '2'}),
+ 'product': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['fprice.Product']"}),
+ 'shop': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['fprice.Shop']"}),
+ 'time': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'time_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'update_counter': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
+ },
+ 'fprice.product': {
+ 'Meta': {'ordering': "['title']", 'object_name': 'Product'},
+ 'category': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['fprice.ProductCategory']", 'null': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_featured': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '200'})
+ },
+ 'fprice.productcategory': {
+ 'Meta': {'ordering': "['title']", 'object_name': 'ProductCategory'},
+ 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['fprice.ProductCategory']"}),
+ 'position': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
+ 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})
+ },
+ 'fprice.shop': {
+ 'Meta': {'ordering': "['title']", 'object_name': 'Shop'},
+ 'city': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['fprice.City']", 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '200'})
+ },
+ 'fprice.summary': {
+ 'Meta': {'ordering': "['-time']", 'object_name': 'Summary'},
+ 'currency': ('django.db.models.fields.CharField', [], {'default': "'rur'", 'max_length': '3'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'shop': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['fprice.Shop']", 'null': 'True', 'blank': 'True'}),
+ 'summary': ('django.db.models.fields.DecimalField', [], {'max_digits': '19', 'decimal_places': '2'}),
+ 'time': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'time_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
+ },
+ 'fprice.trade': {
+ 'Meta': {'ordering': "['id']", 'object_name': 'Trade'},
+ 'amount': ('django.db.models.fields.FloatField', [], {}),
+ 'cost': ('django.db.models.fields.DecimalField', [], {'max_digits': '12', 'decimal_places': '2'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'price': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['fprice.Price']"}),
+ 'summary': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['fprice.Summary']", 'null': 'True', 'blank': 'True'})
+ },
+ 'fprice.userprofile': {
+ 'Meta': {'object_name': 'UserProfile'},
+ 'city': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['fprice.City']", 'null': 'True', 'blank': 'True'}),
+ 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'})
+ }
+ }
+
+ complete_apps = ['fprice']
View
@@ -103,10 +103,20 @@ class Product(models.Model):
List of products.
'''
+ # Named
title = models.CharField(max_length=200)
+
+ # Core
+ # TODO producer field
+
+ # Category
category = models.ForeignKey(ProductCategory, null=True, blank=True)
+
+ # Content
description = models.TextField(blank=True)
- # TODO producer field
+
+ # Featured
+ is_featured = models.BooleanField(default=False)
def __unicode__(self):
return u"%s" % (self.title)

0 comments on commit 472f0ea

Please sign in to comment.