diff --git a/guild/forms.py b/guild/forms.py new file mode 100644 index 0000000..b0af882 --- /dev/null +++ b/guild/forms.py @@ -0,0 +1,17 @@ + + +from django import forms +from guild.models import PlaySession + + +class PlaySessionForm(forms.ModelForm): + + class Meta: + model = PlaySession + fields = ["date", "characters", "summary"] + # set date wideget to type="date" + widgets = { + "date": forms.DateInput(attrs={"type": "date"}), + + } + diff --git a/guild/models.py b/guild/models.py index 6639dc7..001a94a 100644 --- a/guild/models.py +++ b/guild/models.py @@ -82,7 +82,10 @@ class PlaySession(models.Model): return self.name def get_absolute_url(self): - return reverse("guild:playsession_detail", kwargs={"pk": self.pk}) + return reverse( + "guild:playsession_detail", + kwargs={"pk": self.adventure.pk, "playsession_pk": self.pk} + ) class ResourceEarned(models.Model): diff --git a/guild/templates/guild/adventure_detail.html b/guild/templates/guild/adventure_detail.html new file mode 100644 index 0000000..4c4a678 --- /dev/null +++ b/guild/templates/guild/adventure_detail.html @@ -0,0 +1,28 @@ +{% extends 'base.html' %} + +{% load guild_extras %} + +{% block content %} +

Adventure: {{ adventure.name }}

+ +

{{adventure.description|md|safe}}

+ +Add new Session + + +{% if not adventure.playsession_set.count %} +

No sessions found.

+{% else %} + +{% endif %} + + +{% endblock content %} \ No newline at end of file diff --git a/guild/templates/guild/adventure_form.html b/guild/templates/guild/adventure_form.html new file mode 100644 index 0000000..b40688e --- /dev/null +++ b/guild/templates/guild/adventure_form.html @@ -0,0 +1,9 @@ +{% extends 'base.html' %} + +{% block content %} +
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock content %} \ No newline at end of file diff --git a/guild/templates/guild/character_detail.html b/guild/templates/guild/character_detail.html index d433512..d1fca82 100644 --- a/guild/templates/guild/character_detail.html +++ b/guild/templates/guild/character_detail.html @@ -1,5 +1,7 @@ {% extends 'base.html' %} +{% load guild_extras %} + {% block content %}

Character: {{ character.name }}

@@ -10,6 +12,6 @@ -

{{character.description}}

+

{{character.description|md|safe}}

{% endblock content %} \ No newline at end of file diff --git a/guild/templates/guild/home.html b/guild/templates/guild/home.html index 54302c4..22a2e86 100644 --- a/guild/templates/guild/home.html +++ b/guild/templates/guild/home.html @@ -3,8 +3,17 @@ {% block content %}

Home

-Create New Player -Create New Character + {% endblock content %} \ No newline at end of file diff --git a/guild/templates/guild/player_detail.html b/guild/templates/guild/player_detail.html index 0f6e30f..c6ee65d 100644 --- a/guild/templates/guild/player_detail.html +++ b/guild/templates/guild/player_detail.html @@ -5,7 +5,7 @@

Characters

-{% if not player.character_set %} +{% if not player.character_set.count %}

No characters found.

{% else %}