This commit is contained in:
alex 2019-11-07 18:35:01 +03:00
parent 4573233e45
commit 117604f060
4 changed files with 210 additions and 2 deletions

View File

@ -0,0 +1,74 @@
# Generated by Django 2.2.4 on 2019-11-07 15:18
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('review', '0005_review_old_id'),
]
operations = [
migrations.CreateModel(
name='Incuiries',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(default=django.utils.timezone.now, editable=False, verbose_name='Date created')),
('modified', models.DateTimeField(auto_now=True, verbose_name='Date updated')),
('old_id', models.PositiveIntegerField(blank=True, default=None, null=True, verbose_name='old id')),
('comment', models.TextField(blank=True, null=True, verbose_name='comment')),
('final_comment', models.TextField(blank=True, null=True, verbose_name='final comment')),
('mark', models.PositiveIntegerField(blank=True, default=None, null=True, verbose_name='mark')),
('attachment_file', models.URLField(blank=True, default=None, max_length=255, null=True, verbose_name='attachment')),
('bill_file', models.URLField(blank=True, default=None, max_length=255, null=True, verbose_name='bill')),
('price', models.DecimalField(blank=True, decimal_places=2, max_digits=7, null=True, verbose_name='price')),
('moment', models.PositiveSmallIntegerField(choices=[(0, 'none'), (1, 'diner'), (2, 'lanch')], default=0)),
('decibles', models.CharField(blank=True, max_length=255, null=True)),
('nomination', models.CharField(blank=True, max_length=255, null=True)),
('nominee', models.CharField(blank=True, max_length=255, null=True)),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='incuiries', to=settings.AUTH_USER_MODEL, verbose_name='author')),
('review', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='incuiries', to='review.Review', verbose_name='review')),
],
options={
'verbose_name': 'Incuiry',
'verbose_name_plural': 'Incuiries',
},
),
migrations.CreateModel(
name='IncuiryPhoto',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(default=django.utils.timezone.now, editable=False, verbose_name='Date created')),
('modified', models.DateTimeField(auto_now=True, verbose_name='Date updated')),
('attachment_file', models.URLField(max_length=255, verbose_name='attachment')),
('incuiry', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='photos', to='review.Incuiries', verbose_name='incuiry')),
],
options={
'verbose_name': 'incuiry photo',
'verbose_name_plural': 'incuiry photos',
},
),
migrations.CreateModel(
name='GridItems',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(default=django.utils.timezone.now, editable=False, verbose_name='Date created')),
('modified', models.DateTimeField(auto_now=True, verbose_name='Date updated')),
('sub_name', models.CharField(blank=True, max_length=255, null=True, verbose_name='sub name')),
('name', models.CharField(blank=True, max_length=255, null=True, verbose_name='name')),
('value', models.FloatField(blank=True, null=True, verbose_name='value')),
('decs', models.TextField(blank=True, null=True, verbose_name='description')),
('dish_title', models.CharField(blank=True, max_length=255, null=True, verbose_name='dish title')),
('incuiry', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='grids', to='review.Incuiries', verbose_name='incuiry')),
],
options={
'verbose_name': 'incuiry grid',
'verbose_name_plural': 'incuiry grids',
},
),
]

View File

@ -4,7 +4,7 @@ from django.core.validators import MinValueValidator, MaxValueValidator
from django.db import models
from django.utils.translation import gettext_lazy as _
from utils.models import BaseAttributes, TranslatedFieldsMixin
from utils.models import BaseAttributes, TranslatedFieldsMixin, ProjectBaseMixin
from utils.models import TJSONField
@ -77,3 +77,67 @@ class Review(BaseAttributes, TranslatedFieldsMixin):
"""Meta class."""
verbose_name = _('Review')
verbose_name_plural = _('Reviews')
class Incuiries(ProjectBaseMixin):
NONE = 0
DINER = 1
LUNCH = 2
MOMENTS = (
(NONE, _('none')),
(DINER, _('diner')),
(LUNCH, _('lanch')),
)
old_id = models.PositiveIntegerField(_('old id'), blank=True, null=True, default=None)
review = models.ForeignKey(Review, verbose_name=_('review'), related_name='incuiries', on_delete=models.CASCADE)
comment = models.TextField(_('comment'), blank=True, null=True)
final_comment = models.TextField(_('final comment'), blank=True, null=True)
# TODO: float(в старой) или int?
mark = models.PositiveIntegerField(verbose_name=_('mark'), blank=True, null=True, default=None)
attachment_file = models.URLField(verbose_name=_('attachment'), max_length=255, blank=True, null=True, default=None)
author = models.ForeignKey('account.User', related_name='incuiries', on_delete=models.CASCADE,
verbose_name=_('author'))
bill_file = models.URLField(verbose_name=_('bill'), max_length=255, blank=True, null=True, default=None)
price = models.DecimalField(_('price'), max_digits=7, decimal_places=2, blank=True, null=True)
moment = models.PositiveSmallIntegerField(choices=MOMENTS, default=NONE)
decibles = models.CharField(max_length=255, blank=True, null=True)
nomination = models.CharField(max_length=255, blank=True, null=True)
nominee = models.CharField(max_length=255, blank=True, null=True)
class Meta:
verbose_name = _('Incuiry')
verbose_name_plural = _('Incuiries')
def __str__(self):
return f'id: {self.id}, review: {self.review.id}, author: {self.author.id}'
class IncuiryPhoto(ProjectBaseMixin):
incuiry = models.ForeignKey(Incuiries, verbose_name=_('incuiry'), on_delete=models.CASCADE, related_name='photos')
attachment_file = models.URLField(verbose_name=_('attachment'), max_length=255)
class Meta:
verbose_name = _('incuiry photo')
verbose_name_plural = _('incuiry photos')
def __str__(self):
return f'incuiry: {self.incuiry.id}, file: {self.attachment_file}'
class GridItems(ProjectBaseMixin):
incuiry = models.ForeignKey(Incuiries, verbose_name=_('incuiry'), on_delete=models.CASCADE, related_name='grids')
sub_name = models.CharField(_('sub name'), max_length=255, blank=True, null=True)
name = models.CharField(_('name'), max_length=255, blank=True, null=True)
value = models.FloatField(_('value'), blank=True, null=True)
decs = models.TextField(_('description'), blank=True, null=True)
dish_title = models.CharField(_('dish title'), max_length=255, blank=True, null=True)
class Meta:
verbose_name = _('incuiry grid')
verbose_name_plural = _('incuiry grids')
def __str__(self):
return f'incuiry: {self.incuiry.id}, grid id: {self.id}'

View File

@ -1001,3 +1001,72 @@ class Identities(MigrateMixin):
class Meta:
managed = False
db_table = 'identities'
class Incuiries(MigrateMixin):
using = 'legacy'
visited_at = models.DateField()
comment = models.TextField(blank=True, null=True)
mark = models.FloatField(blank=True, null=True)
review = models.ForeignKey(Reviews, models.DO_NOTHING, blank=True, null=True)
created_at = models.DateTimeField()
updated_at = models.DateTimeField()
attachment_file_name = models.CharField(max_length=255, blank=True, null=True)
attachment_content_type = models.CharField(max_length=255, blank=True, null=True)
attachment_file_size = models.IntegerField(blank=True, null=True)
attachment_updated_at = models.DateTimeField(blank=True, null=True)
attachment_suffix_url = models.TextField(blank=True, null=True)
account = models.ForeignKey(Accounts, models.DO_NOTHING, blank=True, null=True)
geometries = models.CharField(max_length=1024, blank=True, null=True)
bill_file_name = models.CharField(max_length=255, blank=True, null=True)
bill_content_type = models.CharField(max_length=255, blank=True, null=True)
bill_file_size = models.IntegerField(blank=True, null=True)
bill_updated_at = models.DateTimeField(blank=True, null=True)
bill_suffix_url = models.TextField(blank=True, null=True)
price = models.DecimalField(max_digits=10, decimal_places=2, blank=True, null=True)
moment = models.CharField(max_length=255, blank=True, null=True)
published = models.PositiveSmallIntegerField(blank=True, null=True)
menu_id = models.IntegerField(blank=True, null=True)
final_comment = models.TextField(blank=True, null=True)
decibles = models.CharField(max_length=255, blank=True, null=True)
nomination = models.CharField(max_length=255, blank=True, null=True)
nominee = models.CharField(max_length=255, blank=True, null=True)
class Meta:
managed = False
db_table = 'inquiries'
class IncuiryPhotos(MigrateMixin):
using = 'legacy'
incuiry = models.ForeignKey(Incuiries, models.DO_NOTHING, blank=True, null=True)
created_at = models.DateTimeField()
updated_at = models.DateTimeField()
attachment_file_name = models.CharField(max_length=255, blank=True, null=True)
attachment_content_type = models.CharField(max_length=255, blank=True, null=True)
attachment_file_size = models.IntegerField(blank=True, null=True)
attachment_updated_at = models.DateTimeField(blank=True, null=True)
attachment_suffix_url = models.TextField(blank=True, null=True)
class Meta:
managed = False
db_table = 'inquiry_photos'
class GridItems(MigrateMixin):
using = 'legacy'
incuiry = models.ForeignKey(Incuiries, models.DO_NOTHING, blank=True, null=True)
created_at = models.DateTimeField()
updated_at = models.DateTimeField()
sub_item_name = models.CharField(max_length=255, blank=True, null=True)
item_name = models.CharField(max_length=255, blank=True, null=True)
value = models.FloatField(blank=True, null=True)
decs = models.TextField(blank=True, null=True)
dish_title = models.CharField(max_length=255, blank=True, null=True)
class Meta:
managed = False
db_table = 'grid_items'

View File

@ -1,3 +1,4 @@
-r base.txt
ipdb
ipython
ipython
mysqlclient