mirror of
https://github.com/evgen-app/chess_rpg_backend.git
synced 2024-11-22 17:47:11 +03:00
fixed hero api lookup
This commit is contained in:
parent
f2c741bb7f
commit
9d4871296a
|
@ -22,9 +22,7 @@ class GetHeroSerializer(serializers.ModelSerializer):
|
||||||
fields = (
|
fields = (
|
||||||
"added",
|
"added",
|
||||||
"type",
|
"type",
|
||||||
"idle_img",
|
"model",
|
||||||
"attack_img",
|
|
||||||
"die_img",
|
|
||||||
"health",
|
"health",
|
||||||
"attack",
|
"attack",
|
||||||
"speed",
|
"speed",
|
||||||
|
@ -37,9 +35,7 @@ class ListHeroSerializer(serializers.ModelSerializer):
|
||||||
fields = (
|
fields = (
|
||||||
"uuid",
|
"uuid",
|
||||||
"type",
|
"type",
|
||||||
"idle_img",
|
"model",
|
||||||
"attack_img",
|
|
||||||
"die_img",
|
|
||||||
"health",
|
"health",
|
||||||
"attack",
|
"attack",
|
||||||
"speed",
|
"speed",
|
||||||
|
|
|
@ -117,15 +117,7 @@ class Hero(models.Model):
|
||||||
def save(
|
def save(
|
||||||
self, force_insert=False, force_update=False, using=None, update_fields=None
|
self, force_insert=False, force_update=False, using=None, update_fields=None
|
||||||
):
|
):
|
||||||
self.idle_img_f = random.choice(
|
self.model_f = random.choice(HeroModelSet.objects.filter(hero_type=self.type))
|
||||||
[x for x in HeroModelSet.objects.filter(hero_type=self.type)]
|
|
||||||
)
|
|
||||||
self.attack_img_f = random.choice(
|
|
||||||
[x for x in HeroModelSet.objects.filter(hero_type=self.type)]
|
|
||||||
)
|
|
||||||
self.die_img_f = random.choice(
|
|
||||||
[x for x in HeroModelSet.objects.filter(hero_type=self.type)]
|
|
||||||
)
|
|
||||||
super(Hero, self).save()
|
super(Hero, self).save()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user