You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0001_initial.py 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. # encoding: utf-8
  2. import datetime
  3. from south.db import db
  4. from south.v2 import SchemaMigration
  5. from django.db import models
  6. class Migration(SchemaMigration):
  7. depends_on = (
  8. ('customer', '0001_initial'),
  9. ('catalogue', '0001_initial'),
  10. )
  11. def forwards(self, orm):
  12. # Adding model 'ProductRecord'
  13. db.create_table('analytics_productrecord', (
  14. ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
  15. ('product', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['catalogue.Product'], unique=True)),
  16. ('num_views', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
  17. ('num_basket_additions', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
  18. ('num_purchases', self.gf('django.db.models.fields.PositiveIntegerField')(default=0, db_index=True)),
  19. ('score', self.gf('django.db.models.fields.FloatField')(default=0.0)),
  20. ))
  21. db.send_create_signal('analytics', ['ProductRecord'])
  22. # Adding model 'UserRecord'
  23. db.create_table('analytics_userrecord', (
  24. ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
  25. ('user', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['auth.User'], unique=True)),
  26. ('num_product_views', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
  27. ('num_basket_additions', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
  28. ('num_orders', self.gf('django.db.models.fields.PositiveIntegerField')(default=0, db_index=True)),
  29. ('num_order_lines', self.gf('django.db.models.fields.PositiveIntegerField')(default=0, db_index=True)),
  30. ('num_order_items', self.gf('django.db.models.fields.PositiveIntegerField')(default=0, db_index=True)),
  31. ('total_spent', self.gf('django.db.models.fields.DecimalField')(default='0.00', max_digits=12, decimal_places=2)),
  32. ('date_last_order', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
  33. ))
  34. db.send_create_signal('analytics', ['UserRecord'])
  35. # Adding model 'UserProductView'
  36. db.create_table('analytics_userproductview', (
  37. ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
  38. ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
  39. ('product', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.Product'])),
  40. ('date_created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
  41. ))
  42. db.send_create_signal('analytics', ['UserProductView'])
  43. # Adding model 'UserSearch'
  44. db.create_table('analytics_usersearch', (
  45. ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
  46. ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
  47. ('query', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)),
  48. ('date_created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
  49. ))
  50. db.send_create_signal('analytics', ['UserSearch'])
  51. def backwards(self, orm):
  52. # Deleting model 'ProductRecord'
  53. db.delete_table('analytics_productrecord')
  54. # Deleting model 'UserRecord'
  55. db.delete_table('analytics_userrecord')
  56. # Deleting model 'UserProductView'
  57. db.delete_table('analytics_userproductview')
  58. # Deleting model 'UserSearch'
  59. db.delete_table('analytics_usersearch')
  60. models = {
  61. 'analytics.productrecord': {
  62. 'Meta': {'ordering': "['-num_purchases']", 'object_name': 'ProductRecord'},
  63. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  64. 'num_basket_additions': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
  65. 'num_purchases': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True'}),
  66. 'num_views': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
  67. 'product': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['catalogue.Product']", 'unique': 'True'}),
  68. 'score': ('django.db.models.fields.FloatField', [], {'default': '0.0'})
  69. },
  70. 'analytics.userproductview': {
  71. 'Meta': {'object_name': 'UserProductView'},
  72. 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
  73. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  74. 'product': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Product']"}),
  75. 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
  76. },
  77. 'analytics.userrecord': {
  78. 'Meta': {'object_name': 'UserRecord'},
  79. 'date_last_order': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
  80. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  81. 'num_basket_additions': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
  82. 'num_order_items': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True'}),
  83. 'num_order_lines': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True'}),
  84. 'num_orders': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True'}),
  85. 'num_product_views': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
  86. 'total_spent': ('django.db.models.fields.DecimalField', [], {'default': "'0.00'", 'max_digits': '12', 'decimal_places': '2'}),
  87. 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'})
  88. },
  89. 'analytics.usersearch': {
  90. 'Meta': {'object_name': 'UserSearch'},
  91. 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
  92. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  93. 'query': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
  94. 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
  95. },
  96. 'auth.group': {
  97. 'Meta': {'object_name': 'Group'},
  98. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  99. 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
  100. 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
  101. },
  102. 'auth.permission': {
  103. 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
  104. 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
  105. 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
  106. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  107. 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
  108. },
  109. 'auth.user': {
  110. 'Meta': {'object_name': 'User'},
  111. 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
  112. 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
  113. 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
  114. 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
  115. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  116. 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
  117. 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
  118. 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
  119. 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
  120. 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
  121. 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
  122. 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
  123. 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
  124. },
  125. 'catalogue.attributeentity': {
  126. 'Meta': {'object_name': 'AttributeEntity'},
  127. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  128. 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
  129. 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}),
  130. 'type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'entities'", 'to': "orm['catalogue.AttributeEntityType']"})
  131. },
  132. 'catalogue.attributeentitytype': {
  133. 'Meta': {'object_name': 'AttributeEntityType'},
  134. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  135. 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
  136. 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'})
  137. },
  138. 'catalogue.attributeoption': {
  139. 'Meta': {'object_name': 'AttributeOption'},
  140. 'group': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'options'", 'to': "orm['catalogue.AttributeOptionGroup']"}),
  141. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  142. 'option': ('django.db.models.fields.CharField', [], {'max_length': '255'})
  143. },
  144. 'catalogue.attributeoptiongroup': {
  145. 'Meta': {'object_name': 'AttributeOptionGroup'},
  146. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  147. 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
  148. },
  149. 'catalogue.category': {
  150. 'Meta': {'ordering': "['name']", 'object_name': 'Category'},
  151. 'depth': ('django.db.models.fields.PositiveIntegerField', [], {}),
  152. 'full_name': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'db_index': 'True'}),
  153. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  154. 'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
  155. 'numchild': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
  156. 'path': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
  157. 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '1024', 'db_index': 'True'})
  158. },
  159. 'catalogue.option': {
  160. 'Meta': {'object_name': 'Option'},
  161. 'code': ('django.db.models.fields.SlugField', [], {'max_length': '128', 'db_index': 'True'}),
  162. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  163. 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
  164. 'type': ('django.db.models.fields.CharField', [], {'default': "'Required'", 'max_length': '128'})
  165. },
  166. 'catalogue.product': {
  167. 'Meta': {'ordering': "['-date_created']", 'object_name': 'Product'},
  168. 'attributes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['catalogue.ProductAttribute']", 'through': "orm['catalogue.ProductAttributeValue']", 'symmetrical': 'False'}),
  169. 'categories': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['catalogue.Category']", 'through': "orm['catalogue.ProductCategory']", 'symmetrical': 'False'}),
  170. 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
  171. 'date_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
  172. 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
  173. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  174. 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'variants'", 'null': 'True', 'to': "orm['catalogue.Product']"}),
  175. 'product_class': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ProductClass']", 'null': 'True'}),
  176. 'product_options': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['catalogue.Option']", 'symmetrical': 'False', 'blank': 'True'}),
  177. 'recommended_products': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['catalogue.Product']", 'symmetrical': 'False', 'through': "orm['catalogue.ProductRecommendation']", 'blank': 'True'}),
  178. 'related_products': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'relations'", 'blank': 'True', 'to': "orm['catalogue.Product']"}),
  179. 'score': ('django.db.models.fields.FloatField', [], {'default': '0.0', 'db_index': 'True'}),
  180. 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255', 'db_index': 'True'}),
  181. 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
  182. 'upc': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '64', 'null': 'True', 'blank': 'True'})
  183. },
  184. 'catalogue.productattribute': {
  185. 'Meta': {'ordering': "['code']", 'object_name': 'ProductAttribute'},
  186. 'code': ('django.db.models.fields.SlugField', [], {'max_length': '128', 'db_index': 'True'}),
  187. 'entity_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.AttributeEntityType']", 'null': 'True', 'blank': 'True'}),
  188. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  189. 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
  190. 'option_group': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.AttributeOptionGroup']", 'null': 'True', 'blank': 'True'}),
  191. 'product_class': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'attributes'", 'null': 'True', 'to': "orm['catalogue.ProductClass']"}),
  192. 'required': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
  193. 'type': ('django.db.models.fields.CharField', [], {'default': "'text'", 'max_length': '20'})
  194. },
  195. 'catalogue.productattributevalue': {
  196. 'Meta': {'object_name': 'ProductAttributeValue'},
  197. 'attribute': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ProductAttribute']"}),
  198. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  199. 'product': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Product']"}),
  200. 'value_boolean': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
  201. 'value_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
  202. 'value_entity': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.AttributeEntity']", 'null': 'True', 'blank': 'True'}),
  203. 'value_float': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
  204. 'value_integer': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
  205. 'value_option': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.AttributeOption']", 'null': 'True', 'blank': 'True'}),
  206. 'value_richtext': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
  207. 'value_text': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})
  208. },
  209. 'catalogue.productcategory': {
  210. 'Meta': {'ordering': "['-is_canonical']", 'object_name': 'ProductCategory'},
  211. 'category': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Category']"}),
  212. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  213. 'is_canonical': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
  214. 'product': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Product']"})
  215. },
  216. 'catalogue.productclass': {
  217. 'Meta': {'ordering': "['name']", 'object_name': 'ProductClass'},
  218. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  219. 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
  220. 'options': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['catalogue.Option']", 'symmetrical': 'False', 'blank': 'True'}),
  221. 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'})
  222. },
  223. 'catalogue.productrecommendation': {
  224. 'Meta': {'object_name': 'ProductRecommendation'},
  225. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  226. 'primary': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'primary_recommendations'", 'to': "orm['catalogue.Product']"}),
  227. 'ranking': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '0'}),
  228. 'recommendation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Product']"})
  229. },
  230. 'contenttypes.contenttype': {
  231. 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
  232. 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
  233. 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  234. 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
  235. 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
  236. }
  237. }
  238. complete_apps = ['analytics']