Improve character form display

This commit is contained in:
Gabriel Augendre 2022-11-09 19:13:02 +01:00
parent e6d2568686
commit e8ea8d6505
2 changed files with 48 additions and 1 deletions

View file

@ -53,6 +53,8 @@ class CharacterCreateForm(forms.ModelForm):
self.fields[ self.fields[
"racial_capability" "racial_capability"
].queryset = RacialCapability.objects.select_related("race") ].queryset = RacialCapability.objects.select_related("race")
self.fields["damage_reduction"].widget.attrs.update({"rows": 2})
self.fields["equipment"].widget.attrs.update({"rows": 3})
class Meta: class Meta:
model = Character model = Character

View file

@ -4,9 +4,54 @@
{% block title %}Création de personnage{% endblock %} {% block title %}Création de personnage{% endblock %}
{% block content %} {% block content %}
<h1>Création de personnage</h1>
<form action="" method="post"> <form action="" method="post">
{% csrf_token %} {% csrf_token %}
{% bootstrap_form form %} <h2>Identité</h2>
{% bootstrap_field form.name %}
{% bootstrap_field form.private %}
<div class="row">
<div class="col-md-5">{% bootstrap_field form.race %}</div>
<div class="col-md-5">{% bootstrap_field form.profile %}</div>
<div class="col-md-2">{% bootstrap_field form.level %}</div>
</div>
{% bootstrap_field form.racial_capability %}
<h2>Apparence</h2>
<div class="row">
<div class="col-md-3">{% bootstrap_field form.gender %}</div>
<div class="col-md-3">{% bootstrap_field form.age %}</div>
<div class="col-md-3">{% bootstrap_field form.height %}</div>
<div class="col-md-3">{% bootstrap_field form.weight %}</div>
</div>
<h2>Compétences</h2>
<div class="row">
<div class="col-md-2">{% bootstrap_field form.value_strength %}</div>
<div class="col-md-2">{% bootstrap_field form.value_dexterity %}</div>
<div class="col-md-2">{% bootstrap_field form.value_constitution %}</div>
<div class="col-md-2">{% bootstrap_field form.value_intelligence %}</div>
<div class="col-md-2">{% bootstrap_field form.value_wisdom %}</div>
<div class="col-md-2">{% bootstrap_field form.value_charisma %}</div>
</div>
<h2>Protection</h2>
<div class="row">
<div class="col-md-4">{% bootstrap_field form.armor %}</div>
<div class="col-md-4">{% bootstrap_field form.shield %}</div>
<div class="col-md-4">{% bootstrap_field form.defense_misc %}</div>
</div>
{% bootstrap_field form.damage_reduction %}
{% bootstrap_field form.health_max %}
<h2>Possessions</h2>
{% bootstrap_field form.weapons %}
{% bootstrap_field form.equipment %}
<div class="row">
<div class="col-md-3">{% bootstrap_field form.money_pp %}</div>
<div class="col-md-3">{% bootstrap_field form.money_po %}</div>
<div class="col-md-3">{% bootstrap_field form.money_pa %}</div>
<div class="col-md-3">{% bootstrap_field form.money_pc %}</div>
</div>
<h2>Notes</h2>
{% bootstrap_field form.notes show_label=False %}
<button type="submit" class="btn btn-primary">Enregistrer</button> <button type="submit" class="btn btn-primary">Enregistrer</button>
</form> </form>
{% endblock %} {% endblock %}