refactor [server]: linter
This commit is contained in:
parent
f14987a804
commit
708c18dc67
4 changed files with 7 additions and 6 deletions
|
@ -8,10 +8,10 @@ class ModelFieldLazyChoice(factory.LazyFunction):
|
||||||
def __init__(self, model_class, field, *args, **kwargs):
|
def __init__(self, model_class, field, *args, **kwargs):
|
||||||
choices = [choice[0] for choice in model_class._meta.get_field(field).choices]
|
choices = [choice[0] for choice in model_class._meta.get_field(field).choices]
|
||||||
super(ModelFieldLazyChoice, self).__init__(
|
super(ModelFieldLazyChoice, self).__init__(
|
||||||
function=lambda: random.choice(choices),
|
function=lambda: random.choice(choices), *args, **kwargs
|
||||||
*args, **kwargs
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class FilmFactory(factory.django.DjangoModelFactory):
|
class FilmFactory(factory.django.DjangoModelFactory):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Film
|
model = Film
|
||||||
|
|
|
@ -25,10 +25,11 @@ class Film(models.Model):
|
||||||
release_year = models.SmallIntegerField(null=True, blank=True)
|
release_year = models.SmallIntegerField(null=True, blank=True)
|
||||||
trailer_link = models.URLField(null=True, blank=True)
|
trailer_link = models.URLField(null=True, blank=True)
|
||||||
is_in_color = models.BooleanField(null=True, blank=True)
|
is_in_color = models.BooleanField(null=True, blank=True)
|
||||||
movie_format = models.CharField(max_length=20, choices=MovieFormat.choices, null=True, blank=True)
|
movie_format = models.CharField(
|
||||||
|
max_length=20, choices=MovieFormat.choices, null=True, blank=True
|
||||||
|
)
|
||||||
language_subtitles = models.CharField(
|
language_subtitles = models.CharField(
|
||||||
max_length=20, choices=LanguageSubtitles.choices,
|
max_length=20, choices=LanguageSubtitles.choices, null=True, blank=True
|
||||||
null=True, blank=True
|
|
||||||
)
|
)
|
||||||
poster_link = models.URLField(null=True, blank=True)
|
poster_link = models.URLField(null=True, blank=True)
|
||||||
banner_link = models.URLField(null=True, blank=True)
|
banner_link = models.URLField(null=True, blank=True)
|
||||||
|
|
|
@ -13,7 +13,6 @@ class MoreFieldsModelSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
|
|
||||||
class FilmSerializer(serializers.ModelSerializer):
|
class FilmSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Film
|
model = Film
|
||||||
fields = "__all__" #
|
fields = "__all__" #
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
IS_LOCAL_DEV = bool(os.environ.get("TELESCOOP_DEV"))
|
IS_LOCAL_DEV = bool(os.environ.get("TELESCOOP_DEV"))
|
||||||
if IS_LOCAL_DEV:
|
if IS_LOCAL_DEV:
|
||||||
from .dev import *
|
from .dev import *
|
||||||
|
|
Loading…
Reference in a new issue