Merge remote-tracking branch 'origin/develop' into feature/reviews
# Conflicts: # apps/establishment/admin.py # apps/establishment/serializers.py
This commit is contained in:
commit
cd0f03f05d
|
|
@ -1,8 +1,7 @@
|
|||
"""Establishment admin conf."""
|
||||
from django.contrib import admin
|
||||
from django.contrib.contenttypes.admin import GenericTabularInline
|
||||
|
||||
from establishment import models
|
||||
from django.contrib.contenttypes.admin import GenericTabularInline
|
||||
from main.models import Award, MetaDataContent
|
||||
from review import models as review_models
|
||||
|
||||
|
|
@ -38,18 +37,6 @@ class ContactEmailInline(admin.TabularInline):
|
|||
model = models.ContactEmail
|
||||
extra = 0
|
||||
|
||||
|
||||
@admin.register(models.Contact)
|
||||
class ContactAdmin(admin.ModelAdmin):
|
||||
"""Contact admin."""
|
||||
inlines = [ContactPhoneInline, ContactEmailInline, ]
|
||||
|
||||
|
||||
class ContactsInline(admin.TabularInline):
|
||||
model = models.Contact
|
||||
extra = 0
|
||||
|
||||
|
||||
class ReviewInline(GenericTabularInline):
|
||||
model = review_models.Review
|
||||
extra = 0
|
||||
|
|
@ -58,7 +45,10 @@ class ReviewInline(GenericTabularInline):
|
|||
@admin.register(models.Establishment)
|
||||
class EstablishmentAdmin(admin.ModelAdmin):
|
||||
"""Establishment admin."""
|
||||
inlines = [AwardInline, MetaDataContentInline, ContactsInline, ReviewInline]
|
||||
inlines = [
|
||||
AwardInline, MetaDataContentInline,
|
||||
ContactPhoneInline, ContactEmailInline,
|
||||
ReviewInline]
|
||||
|
||||
|
||||
@admin.register(models.EstablishmentSchedule)
|
||||
|
|
|
|||
30
apps/establishment/migrations/0007_auto_20190901_1032.py
Normal file
30
apps/establishment/migrations/0007_auto_20190901_1032.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# Generated by Django 2.2.4 on 2019-09-01 10:32
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('establishment', '0006_merge_20190901_0846'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='contactemail',
|
||||
name='contact',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='contactphone',
|
||||
name='contact',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='Contact',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='ContactEmail',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='ContactPhone',
|
||||
),
|
||||
]
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
# Generated by Django 2.2.4 on 2019-09-01 10:36
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import phonenumber_field.modelfields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('establishment', '0007_auto_20190901_1032'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='ContactPhone',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('phone', phonenumber_field.modelfields.PhoneNumberField(max_length=128)),
|
||||
('establishment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='phones', to='establishment.Establishment')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'contact phone',
|
||||
'verbose_name_plural': 'contact phones',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ContactEmail',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('email', models.EmailField(max_length=254)),
|
||||
('establishment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='emails', to='establishment.Establishment')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'contact email',
|
||||
'verbose_name_plural': 'contact emails',
|
||||
},
|
||||
),
|
||||
]
|
||||
|
|
@ -166,21 +166,10 @@ class EstablishmentSchedule(BaseAttributes):
|
|||
verbose_name_plural = _('Establishment schedules')
|
||||
|
||||
|
||||
class Contact(models.Model):
|
||||
"""Contact model."""
|
||||
establishment = models.ForeignKey(
|
||||
Establishment, related_name='contacts', on_delete=models.CASCADE)
|
||||
address = models.ForeignKey('location.Address', on_delete=models.CASCADE)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('contact')
|
||||
verbose_name_plural = _('contacts')
|
||||
|
||||
|
||||
class ContactPhone(models.Model):
|
||||
"""Contact phone model."""
|
||||
contact = models.ForeignKey(
|
||||
Contact, related_name='phones', on_delete=models.CASCADE)
|
||||
establishment = models.ForeignKey(
|
||||
Establishment, related_name='phones', on_delete=models.CASCADE)
|
||||
phone = PhoneNumberField()
|
||||
|
||||
class Meta:
|
||||
|
|
@ -193,8 +182,8 @@ class ContactPhone(models.Model):
|
|||
|
||||
class ContactEmail(models.Model):
|
||||
"""Contact email model."""
|
||||
contact = models.ForeignKey(
|
||||
Contact, related_name='emails', on_delete=models.CASCADE)
|
||||
establishment = models.ForeignKey(
|
||||
Establishment, related_name='emails', on_delete=models.CASCADE)
|
||||
email = models.EmailField()
|
||||
|
||||
class Meta:
|
||||
|
|
|
|||
|
|
@ -25,21 +25,6 @@ class ContactEmailsSerializer(serializers.ModelSerializer):
|
|||
]
|
||||
|
||||
|
||||
class ContactSerializer(serializers.ModelSerializer):
|
||||
"""Contact serializer."""
|
||||
address = AddressSerializer(read_only=True)
|
||||
phones = ContactPhonesSerializer(read_only=True, many=True,)
|
||||
emails = ContactEmailsSerializer(read_only=True, many=True,)
|
||||
|
||||
class Meta:
|
||||
model = models.Contact
|
||||
fields = [
|
||||
'address',
|
||||
'phones',
|
||||
'emails'
|
||||
]
|
||||
|
||||
|
||||
class EstablishmentTypeSerializer(serializers.ModelSerializer):
|
||||
"""Serializer for EstablishmentType model."""
|
||||
|
||||
|
|
@ -103,7 +88,8 @@ class EstablishmentSerializer(serializers.ModelSerializer):
|
|||
schedule = EstablishmentScheduleSerializer(source='schedule.schedule',
|
||||
many=True,
|
||||
allow_null=True)
|
||||
contacts = ContactSerializer(read_only=True, many=True, )
|
||||
phones = ContactPhonesSerializer(read_only=True, many=True, )
|
||||
emails = ContactEmailsSerializer(read_only=True, many=True, )
|
||||
reviews = ReviewSerializer(source='reviews.last',
|
||||
allow_null=True)
|
||||
|
||||
|
|
@ -126,6 +112,7 @@ class EstablishmentSerializer(serializers.ModelSerializer):
|
|||
'tags',
|
||||
'awards',
|
||||
'schedule',
|
||||
'phones',
|
||||
'emails'
|
||||
'reviews',
|
||||
'contacts'
|
||||
)
|
||||
|
|
|
|||
35
apps/main/migrations/0013_auto_20190901_1032.py
Normal file
35
apps/main/migrations/0013_auto_20190901_1032.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# Generated by Django 2.2.4 on 2019-09-01 10:32
|
||||
|
||||
from django.db import migrations, models
|
||||
import utils.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('main', '0012_auto_20190829_1155'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Currency',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=50, verbose_name='name')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'currency',
|
||||
'verbose_name_plural': 'currencies',
|
||||
},
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='award',
|
||||
name='title',
|
||||
field=utils.models.TJSONField(blank=True, default=None, help_text='{"en-GB":"some text"}', null=True, verbose_name='title'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='metadata',
|
||||
name='label',
|
||||
field=utils.models.TJSONField(blank=True, default=None, help_text='{"en-GB":"some text"}', null=True, verbose_name='label'),
|
||||
),
|
||||
]
|
||||
29
apps/news/migrations/0009_auto_20190901_1032.py
Normal file
29
apps/news/migrations/0009_auto_20190901_1032.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# Generated by Django 2.2.4 on 2019-09-01 10:32
|
||||
|
||||
from django.db import migrations
|
||||
import utils.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('news', '0008_auto_20190828_1522'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='news',
|
||||
name='description',
|
||||
field=utils.models.TJSONField(blank=True, default=None, help_text='{"en-GB":"some text"}', null=True, verbose_name='description'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='news',
|
||||
name='subtitle',
|
||||
field=utils.models.TJSONField(blank=True, default=None, help_text='{"en-GB":"some text"}', null=True, verbose_name='subtitle'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='news',
|
||||
name='title',
|
||||
field=utils.models.TJSONField(blank=True, default=None, help_text='{"en-GB":"some text"}', null=True, verbose_name='title'),
|
||||
),
|
||||
]
|
||||
19
apps/translation/migrations/0003_auto_20190901_1032.py
Normal file
19
apps/translation/migrations/0003_auto_20190901_1032.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 2.2.4 on 2019-09-01 10:32
|
||||
|
||||
import django.contrib.postgres.fields.jsonb
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('translation', '0002_siteinterfacedictionary'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='siteinterfacedictionary',
|
||||
name='text',
|
||||
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=None, help_text='{"en-GB":"some text"}', null=True, verbose_name='Text'),
|
||||
),
|
||||
]
|
||||
Loading…
Reference in New Issue
Block a user