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

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