Permalink
Browse files

work on orders

  • Loading branch information...
1 parent 7bd88b7 commit 67956945f38224828af1798f4db4a14b2ab127fd @Guest007 committed Jan 31, 2014
View
@@ -2,6 +2,7 @@
from django.db import models
__author__ = 'guest007'
+
class Category(models.Model):
name = models.CharField(max_length=100, verbose_name="Категория")
View
@@ -44,6 +44,7 @@
'config',
'menu',
'articles',
+ 'orders',
)
MIDDLEWARE_CLASSES = (
@@ -68,15 +69,15 @@
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
-DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.mysql',
- "HOST": 'mysql',
- 'NAME': 'eurocard',
- 'USER': 'eurocard',
- 'PASSWORD': 'sUoh5tezRL',
- }
-}
+# DATABASES = {
+# 'default': {
+# 'ENGINE': 'django.db.backends.mysql',
+# "HOST": 'mysql',
+# 'NAME': 'eurocard',
+# 'USER': 'eurocard',
+# 'PASSWORD': 'sUoh5tezRL',
+# }
+# }
# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/
View
No changes.
View
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+from django.contrib import admin
+from django import forms
+from orders.models import Orders, OrderTemplate, Material, Lamination, Color, Coefficient
+
+__author__ = 'guest007'
+
+class CoefficientAdmin(admin.ModelAdmin):
+ list_display = ['name', 'numb', 'coeff']
+ list_filter = ['name']
+ list_editable = ['numb', 'coeff']
+
+class MaterialAdmin(admin.ModelAdmin):
+ list_display = ['name', 'cost']
+ list_filter = ['name']
+ list_editable = ['cost']
+
+
+class LaminationAdmin(admin.ModelAdmin):
+ list_display = ['name', 'cost']
+ list_filter = ['name']
+ list_editable = ['cost']
+
+
+class ColorAdmin(admin.ModelAdmin):
+ list_display = ['name', 'cost']
+ list_filter = ['name']
+ list_editable = ['cost']
+
+
+class OrdersAdmin(admin.ModelAdmin):
+ list_display = ['FIO', 'phone', 'email', 'draw']
+ # ordering = ["category", 'published_at']
+ list_filter = ['FIO', 'draw']
+ # inlines = [TemplateLinkedInline]
+ # fieldsets = (
+ # (u'Заказ', {
+ # 'classes': ('grp-collapse grp-open'),
+ # 'fields': ("FIO", "phone", "email", "draw", "cost", "maket")
+ # }),
+ # (u'Детально', {
+ # 'classes': ('grp-collapse grp-open'),
+ # 'fields': ('template', )
+ # })
+ # )
+ #
+ # def formfield_for_foreignkey(self, db_field, request, **kwargs):
+ # if db_field.name == "template":
+ # kwargs["queryset"] = OrderTemplate.objects.get(pk=self.template.pk)
+ # return super(OrdersAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)
+
+
+class OrderTemplateAdmin(admin.ModelAdmin):
+ model = OrderTemplate
+ list_display = ['name', 'is_template', 'image']
+ # ordering = ["category", 'published_at']
+ list_filter = ['name', 'is_template']
+
+
+admin.site.register(Material, MaterialAdmin)
+admin.site.register(Lamination, LaminationAdmin)
+admin.site.register(Color, ColorAdmin)
+admin.site.register(Orders, OrdersAdmin)
+admin.site.register(OrderTemplate, OrderTemplateAdmin)
@@ -0,0 +1,136 @@
+# -*- coding: utf-8 -*-
+from south.utils import datetime_utils as datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ # Adding model 'Material'
+ db.create_table(u'orders_material', (
+ (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
+ ))
+ db.send_create_signal(u'orders', ['Material'])
+
+ # Adding model 'Lamination'
+ db.create_table(u'orders_lamination', (
+ (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
+ ))
+ db.send_create_signal(u'orders', ['Lamination'])
+
+ # Adding model 'Color'
+ db.create_table(u'orders_color', (
+ (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
+ ))
+ db.send_create_signal(u'orders', ['Color'])
+
+ # Adding model 'OrderTemplate'
+ db.create_table(u'orders_ordertemplate', (
+ (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('description', self.gf('django.db.models.fields.CharField')(max_length=255)),
+ ('is_template', self.gf('django.db.models.fields.BooleanField')()),
+ ('chip', self.gf('django.db.models.fields.BooleanField')()),
+ ('scratch', self.gf('django.db.models.fields.BooleanField')()),
+ ('magnet', self.gf('django.db.models.fields.BooleanField')()),
+ ('emboss', self.gf('django.db.models.fields.BooleanField')()),
+ ('uv', self.gf('django.db.models.fields.BooleanField')()),
+ ('print_num', self.gf('django.db.models.fields.BooleanField')()),
+ ('sign', self.gf('django.db.models.fields.BooleanField')()),
+ ('foil', self.gf('django.db.models.fields.BooleanField')()),
+ ('barcode', self.gf('django.db.models.fields.BooleanField')()),
+ ('indent', self.gf('django.db.models.fields.BooleanField')()),
+ ('material', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orders.Material'])),
+ ('lamination', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orders.Lamination'])),
+ ('color_front', self.gf('django.db.models.fields.related.ForeignKey')(related_name='color_front', to=orm['orders.Color'])),
+ ('color_back', self.gf('django.db.models.fields.related.ForeignKey')(related_name='color_back', to=orm['orders.Color'])),
+ ('image', self.gf('django.db.models.fields.files.ImageField')(max_length=100, null=True, blank=True)),
+ ))
+ db.send_create_signal(u'orders', ['OrderTemplate'])
+
+ # Adding model 'Orders'
+ db.create_table(u'orders_orders', (
+ (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('FIO', self.gf('django.db.models.fields.CharField')(max_length=255)),
+ ('phone', self.gf('django.db.models.fields.CharField')(max_length=255)),
+ ('email', self.gf('django.db.models.fields.EmailField')(max_length=75)),
+ ('draw', self.gf('django.db.models.fields.IntegerField')(default=1000)),
+ ('maket', self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True, blank=True)),
+ ('template', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['orders.OrderTemplate'], unique=True)),
+ ))
+ db.send_create_signal(u'orders', ['Orders'])
+
+
+ def backwards(self, orm):
+ # Deleting model 'Material'
+ db.delete_table(u'orders_material')
+
+ # Deleting model 'Lamination'
+ db.delete_table(u'orders_lamination')
+
+ # Deleting model 'Color'
+ db.delete_table(u'orders_color')
+
+ # Deleting model 'OrderTemplate'
+ db.delete_table(u'orders_ordertemplate')
+
+ # Deleting model 'Orders'
+ db.delete_table(u'orders_orders')
+
+
+ models = {
+ u'orders.color': {
+ 'Meta': {'object_name': 'Color'},
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+ },
+ u'orders.lamination': {
+ 'Meta': {'object_name': 'Lamination'},
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+ },
+ u'orders.material': {
+ 'Meta': {'object_name': 'Material'},
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+ },
+ u'orders.orders': {
+ 'FIO': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'Meta': {'object_name': 'Orders'},
+ 'draw': ('django.db.models.fields.IntegerField', [], {'default': '1000'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'maket': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+ 'phone': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'template': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['orders.OrderTemplate']", 'unique': 'True'})
+ },
+ u'orders.ordertemplate': {
+ 'Meta': {'object_name': 'OrderTemplate'},
+ 'barcode': ('django.db.models.fields.BooleanField', [], {}),
+ 'chip': ('django.db.models.fields.BooleanField', [], {}),
+ 'color_back': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'color_back'", 'to': u"orm['orders.Color']"}),
+ 'color_front': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'color_front'", 'to': u"orm['orders.Color']"}),
+ 'description': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'emboss': ('django.db.models.fields.BooleanField', [], {}),
+ 'foil': ('django.db.models.fields.BooleanField', [], {}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+ 'indent': ('django.db.models.fields.BooleanField', [], {}),
+ 'is_template': ('django.db.models.fields.BooleanField', [], {}),
+ 'lamination': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orders.Lamination']"}),
+ 'magnet': ('django.db.models.fields.BooleanField', [], {}),
+ 'material': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orders.Material']"}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'print_num': ('django.db.models.fields.BooleanField', [], {}),
+ 'scratch': ('django.db.models.fields.BooleanField', [], {}),
+ 'sign': ('django.db.models.fields.BooleanField', [], {}),
+ 'uv': ('django.db.models.fields.BooleanField', [], {})
+ }
+ }
+
+ complete_apps = ['orders']
@@ -0,0 +1,125 @@
+# -*- coding: utf-8 -*-
+from south.utils import datetime_utils as datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ # Adding model 'Coefficient'
+ db.create_table(u'orders_coefficient', (
+ (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
+ ('numb', self.gf('django.db.models.fields.IntegerField')()),
+ ('coeff', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ))
+ db.send_create_signal(u'orders', ['Coefficient'])
+
+ # Adding field 'Lamination.cost'
+ db.add_column(u'orders_lamination', 'cost',
+ self.gf('django.db.models.fields.FloatField')(null=True, blank=True),
+ keep_default=False)
+
+ # Adding field 'Orders.cost'
+ db.add_column(u'orders_orders', 'cost',
+ self.gf('django.db.models.fields.FloatField')(null=True, blank=True),
+ keep_default=False)
+
+
+ # Changing field 'Orders.template'
+ db.alter_column(u'orders_orders', 'template_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orders.OrderTemplate'], unique=True))
+ # Adding field 'Color.cost'
+ db.add_column(u'orders_color', 'cost',
+ self.gf('django.db.models.fields.FloatField')(null=True, blank=True),
+ keep_default=False)
+
+ # Adding field 'Material.cost'
+ db.add_column(u'orders_material', 'cost',
+ self.gf('django.db.models.fields.FloatField')(null=True, blank=True),
+ keep_default=False)
+
+
+ def backwards(self, orm):
+ # Deleting model 'Coefficient'
+ db.delete_table(u'orders_coefficient')
+
+ # Deleting field 'Lamination.cost'
+ db.delete_column(u'orders_lamination', 'cost')
+
+ # Deleting field 'Orders.cost'
+ db.delete_column(u'orders_orders', 'cost')
+
+
+ # Changing field 'Orders.template'
+ db.alter_column(u'orders_orders', 'template_id', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['orders.OrderTemplate'], unique=True))
+ # Deleting field 'Color.cost'
+ db.delete_column(u'orders_color', 'cost')
+
+ # Deleting field 'Material.cost'
+ db.delete_column(u'orders_material', 'cost')
+
+
+ models = {
+ u'orders.coefficient': {
+ 'Meta': {'object_name': 'Coefficient'},
+ 'coeff': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'numb': ('django.db.models.fields.IntegerField', [], {})
+ },
+ u'orders.color': {
+ 'Meta': {'object_name': 'Color'},
+ 'cost': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+ },
+ u'orders.lamination': {
+ 'Meta': {'object_name': 'Lamination'},
+ 'cost': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+ },
+ u'orders.material': {
+ 'Meta': {'object_name': 'Material'},
+ 'cost': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+ },
+ u'orders.orders': {
+ 'FIO': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'Meta': {'object_name': 'Orders'},
+ 'cost': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
+ 'draw': ('django.db.models.fields.IntegerField', [], {'default': '1000'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'maket': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+ 'phone': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'template': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orders.OrderTemplate']", 'unique': 'True'})
+ },
+ u'orders.ordertemplate': {
+ 'Meta': {'object_name': 'OrderTemplate'},
+ 'barcode': ('django.db.models.fields.BooleanField', [], {}),
+ 'chip': ('django.db.models.fields.BooleanField', [], {}),
+ 'color_back': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'color_back'", 'to': u"orm['orders.Color']"}),
+ 'color_front': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'color_front'", 'to': u"orm['orders.Color']"}),
+ 'description': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'emboss': ('django.db.models.fields.BooleanField', [], {}),
+ 'foil': ('django.db.models.fields.BooleanField', [], {}),
+ u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+ 'indent': ('django.db.models.fields.BooleanField', [], {}),
+ 'is_template': ('django.db.models.fields.BooleanField', [], {}),
+ 'lamination': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orders.Lamination']"}),
+ 'magnet': ('django.db.models.fields.BooleanField', [], {}),
+ 'material': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orders.Material']"}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'print_num': ('django.db.models.fields.BooleanField', [], {}),
+ 'scratch': ('django.db.models.fields.BooleanField', [], {}),
+ 'sign': ('django.db.models.fields.BooleanField', [], {}),
+ 'uv': ('django.db.models.fields.BooleanField', [], {})
+ }
+ }
+
+ complete_apps = ['orders']
No changes.
Oops, something went wrong.

0 comments on commit 6795694

Please sign in to comment.