Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

0001_initial.py 17KB

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