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