added image field to Country model
This commit is contained in:
parent
d9f52891dc
commit
93bd8a59c4
20
apps/location/migrations/0006_country_image.py
Normal file
20
apps/location/migrations/0006_country_image.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Generated by Django 2.2.4 on 2019-08-26 08:42
|
||||
|
||||
from django.db import migrations
|
||||
import easy_thumbnails.fields
|
||||
import utils.methods
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('location', '0005_auto_20190822_1144'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='country',
|
||||
name='image',
|
||||
field=easy_thumbnails.fields.ThumbnailerImageField(blank=True, default=None, null=True, upload_to=utils.methods.image_path, verbose_name='Image'),
|
||||
),
|
||||
]
|
||||
|
|
@ -1,15 +1,16 @@
|
|||
"""Location app models."""
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.contrib.gis.db import models
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from utils.models import ProjectBaseMixin, LocaleManagerMixin
|
||||
|
||||
from utils.models import ProjectBaseMixin, LocaleManagerMixin, ImageMixin
|
||||
|
||||
|
||||
class CountryManager(LocaleManagerMixin):
|
||||
"""Extended manager for Country model."""
|
||||
|
||||
|
||||
class Country(ProjectBaseMixin):
|
||||
class Country(ImageMixin, ProjectBaseMixin):
|
||||
"""Country model."""
|
||||
|
||||
name = JSONField(null=True, blank=True, default=None,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
from rest_framework import serializers
|
||||
from location import models
|
||||
from django.contrib.gis.geos import Point
|
||||
from rest_framework import serializers
|
||||
|
||||
from location import models
|
||||
|
||||
|
||||
class CountrySerializer(serializers.ModelSerializer):
|
||||
|
|
@ -13,6 +14,7 @@ class CountrySerializer(serializers.ModelSerializer):
|
|||
fields = [
|
||||
'id',
|
||||
'code',
|
||||
'image',
|
||||
'name_trans',
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user