diff --git a/guild/models.py b/guild/models.py
index ad7dfa6..6639dc7 100644
--- a/guild/models.py
+++ b/guild/models.py
@@ -4,7 +4,7 @@ from django.utils.translation import gettext as _
class Player(models.Model):
- name = models.CharField(max_length=255)
+ name = models.CharField(max_length=255, unique=True)
class Meta:
verbose_name = _("player")
@@ -14,7 +14,7 @@ class Player(models.Model):
return self.name
def get_absolute_url(self):
- return reverse("player_detail", kwargs={"pk": self.pk})
+ return reverse("guild:player_detail", kwargs={"pk": self.pk})
class Resource(models.Model):
@@ -29,7 +29,7 @@ class Resource(models.Model):
return self.name
def get_absolute_url(self):
- return reverse("resource_detail", kwargs={"pk": self.pk})
+ return reverse("guild:resource_detail", kwargs={"pk": self.pk})
class Adventure(models.Model):
@@ -47,7 +47,7 @@ class Adventure(models.Model):
return self.name
def get_absolute_url(self):
- return reverse("adventure_detail", kwargs={"pk": self.pk})
+ return reverse("guild:adventure_detail", kwargs={"pk": self.pk})
class Character(models.Model):
@@ -64,7 +64,7 @@ class Character(models.Model):
return self.name
def get_absolute_url(self):
- return reverse("character_detail", kwargs={"pk": self.pk})
+ return reverse("guild:character_detail", kwargs={"pk": self.pk})
class PlaySession(models.Model):
@@ -82,7 +82,7 @@ class PlaySession(models.Model):
return self.name
def get_absolute_url(self):
- return reverse("playsession_detail", kwargs={"pk": self.pk})
+ return reverse("guild:playsession_detail", kwargs={"pk": self.pk})
class ResourceEarned(models.Model):
@@ -99,4 +99,4 @@ class ResourceEarned(models.Model):
return self.name
def get_absolute_url(self):
- return reverse("resourceearned_detail", kwargs={"pk": self.pk})
+ return reverse("guild:resourceearned_detail", kwargs={"pk": self.pk})
diff --git a/guild/templates/guild/character_detail.html b/guild/templates/guild/character_detail.html
new file mode 100644
index 0000000..d433512
--- /dev/null
+++ b/guild/templates/guild/character_detail.html
@@ -0,0 +1,15 @@
+{% extends 'base.html' %}
+
+{% block content %}
+
Character: {{ character.name }}
+
+
+
+{{character.description}}
+
+{% endblock content %}
\ No newline at end of file
diff --git a/guild/templates/guild/character_form.html b/guild/templates/guild/character_form.html
new file mode 100644
index 0000000..5e34136
--- /dev/null
+++ b/guild/templates/guild/character_form.html
@@ -0,0 +1,9 @@
+{% extends 'base.html' %}
+
+{% block content %}
+
+{% endblock content %}
\ No newline at end of file
diff --git a/guild/templates/guild/home.html b/guild/templates/guild/home.html
index f925b6c..54302c4 100644
--- a/guild/templates/guild/home.html
+++ b/guild/templates/guild/home.html
@@ -2,4 +2,9 @@
{% 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
new file mode 100644
index 0000000..0f6e30f
--- /dev/null
+++ b/guild/templates/guild/player_detail.html
@@ -0,0 +1,18 @@
+{% extends 'base.html' %}
+
+{% block content %}
+Player: {{ player.name }}
+
+Characters
+
+{% if not player.character_set %}
+ No characters found.
+{% else %}
+
+{% endif %}
+
+{% endblock content %}
\ No newline at end of file
diff --git a/guild/templates/guild/player_form.html b/guild/templates/guild/player_form.html
new file mode 100644
index 0000000..507e7da
--- /dev/null
+++ b/guild/templates/guild/player_form.html
@@ -0,0 +1,9 @@
+{% extends 'base.html' %}
+
+{% block content %}
+
+{% endblock content %}
\ No newline at end of file
diff --git a/guild/urls.py b/guild/urls.py
index 6f3901c..af9044f 100644
--- a/guild/urls.py
+++ b/guild/urls.py
@@ -1,6 +1,13 @@
from django.urls import path
import guild.views as views
+import guild.views.player as player_views
+import guild.views.character as character_views
urlpatterns = [
path("", views.HomeView.as_view(), name="home"),
+ # path("players/", views.PlayerListView.as_view(), name="player_list"),
+ path("players/create/", player_views.CreatePlayerView.as_view(), name="create_player"),
+ path("players//", player_views.PlayerDetailView.as_view(), name="player_detail"),
+ path("characters/create/", character_views.CreateCharacterView.as_view(), name="create_character"),
+ path("characters//", character_views.CharacterDetailView.as_view(), name="character_detail"),
]
diff --git a/guild/views.py b/guild/views/__init__.py
similarity index 53%
rename from guild/views.py
rename to guild/views/__init__.py
index 0c0238e..56e8cac 100644
--- a/guild/views.py
+++ b/guild/views/__init__.py
@@ -1,6 +1,10 @@
-from django.views.generic import TemplateView
+from django.views.generic import TemplateView, ListView, DetailView
+from django.views.generic.edit import CreateView
from django.contrib.auth.mixins import LoginRequiredMixin
+from guild.models import Player
+
# Create your views here.
class HomeView(LoginRequiredMixin, TemplateView):
template_name = "guild/home.html"
+
diff --git a/guild/views/character.py b/guild/views/character.py
new file mode 100644
index 0000000..a741454
--- /dev/null
+++ b/guild/views/character.py
@@ -0,0 +1,14 @@
+
+from django.views.generic import TemplateView, ListView, DetailView
+from django.views.generic.edit import CreateView
+from django.contrib.auth.mixins import LoginRequiredMixin
+
+from guild.models import Character
+
+
+class CreateCharacterView(LoginRequiredMixin, CreateView):
+ model = Character
+ fields = ["name", "description", "player"]
+
+class CharacterDetailView(LoginRequiredMixin, DetailView):
+ model = Character
\ No newline at end of file
diff --git a/guild/views/player.py b/guild/views/player.py
new file mode 100644
index 0000000..7812981
--- /dev/null
+++ b/guild/views/player.py
@@ -0,0 +1,14 @@
+
+from django.views.generic import TemplateView, ListView, DetailView
+from django.views.generic.edit import CreateView
+from django.contrib.auth.mixins import LoginRequiredMixin
+
+from guild.models import Player
+
+
+class CreatePlayerView(LoginRequiredMixin, CreateView):
+ model = Player
+ fields = ["name"]
+
+class PlayerDetailView(LoginRequiredMixin, DetailView):
+ model = Player
\ No newline at end of file
diff --git a/guild_journal/urls.py b/guild_journal/urls.py
index ff9fefd..1661872 100644
--- a/guild_journal/urls.py
+++ b/guild_journal/urls.py
@@ -20,5 +20,5 @@ from django.urls import include, path
urlpatterns = [
path('admin/', admin.site.urls),
path("accounts/", include("django.contrib.auth.urls")),
- path("", include("guild.urls")),
+ path("", include(("guild.urls", "guild"), namespace="guild")),
]