applied tags field to company model
This commit is contained in:
@@ -27,7 +27,7 @@ class CompanyFactory(DjangoModelFactory):
|
||||
shop_rss_feed = FuzzyText(prefix='http://SHOP_RSS_FEED_', suffix='.test', length=10)
|
||||
sale_terms = FuzzyText(prefix='SALES_TERMS', length=250)
|
||||
shipping_cost = FuzzyDecimal(low=1.00)
|
||||
# tags = models.ManyToMany(Tag, null=True)
|
||||
tags = ['cool', 'hip', 'tech/blockchain']
|
||||
sync = FuzzyChoice(choices=(True, False))
|
||||
|
||||
class Meta:
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# from django.db import models
|
||||
from django.contrib.gis.db import models
|
||||
|
||||
from tagulous.models import TagField
|
||||
|
||||
# Create your models here.
|
||||
|
||||
class Company(models.Model):
|
||||
@@ -34,7 +36,7 @@ class Company(models.Model):
|
||||
shop_rss_feed = models.URLField('RSS tienda online', null=True, blank=True)
|
||||
sale_terms = models.TextField('Condiciones de venta', null=True, blank=True)
|
||||
shipping_cost = models.DecimalField('Gastos de envío', max_digits=10, decimal_places=2, null=True, blank=True)
|
||||
# tags = models.ManyToMany(Tag, null=True)
|
||||
tags = TagField(force_lowercase=True,max_count=5, tree=True)
|
||||
sync = models.BooleanField('Sincronizar tienda', default=False, null=True, blank=True)
|
||||
|
||||
# internal
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
from rest_framework import serializers
|
||||
from companies.models import Company
|
||||
|
||||
from utils.tag_serializers import TagListSerializerField, TaggitSerializer
|
||||
|
||||
class CompanySerializer(serializers.ModelSerializer):
|
||||
class CompanySerializer(TaggitSerializer, serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = Company
|
||||
exclude = ['created', 'updated', 'creator']
|
||||
tags = TagListSerializerField(required=False)
|
||||
|
||||
class Meta:
|
||||
model = Company
|
||||
exclude = ['created', 'updated', 'creator']
|
||||
|
||||
Reference in New Issue
Block a user