Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Feature/add name generator #69

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added characters/forms.py
Empty file.
1 change: 1 addition & 0 deletions characters/name_generator/names.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"source": "https://www.reddit.com/r/DnDBehindTheScreen/comments/50pcg1/a_post_about_names_names_for_speakers_of_the/",
"names": {
"Archaic": {
"female": [
Expand Down
8 changes: 8 additions & 0 deletions characters/name_generator/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.urls import path

from characters.name_generator import views

app_name = 'name-generator'
urlpatterns = [
path('', views.NameGeneratorView.as_view(), name='index'),
]
5 changes: 5 additions & 0 deletions characters/name_generator/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.views.generic import TemplateView


class NameGeneratorView(TemplateView):
template_name = "name-generator/name-generator.html"
Empty file.
5 changes: 5 additions & 0 deletions characters/templates/name-generator/name-generator.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% extends "base.html" %}

{% block content %}

{% endblock %}
3 changes: 2 additions & 1 deletion characters/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from django.urls import path
from django.urls import include, path

from . import views

app_name = 'characters'
urlpatterns = [
path('', views.index, name='index'),
path('name-generator', include('characters.name_generator.urls', namespace='name-generator'))
]
6 changes: 6 additions & 0 deletions rpscene/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import json
import os
from datetime import datetime

from django.contrib.messages import constants as messages

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
Expand Down Expand Up @@ -191,3 +193,7 @@
'br',
'hr',
]

NAME_GENERATOR_NAMES_FILE = os.path.join(BASE_DIR, 'characters/name_generator/names.json')
with open(NAME_GENERATOR_NAMES_FILE) as json_file:
NAME_GENERATOR_NAMES = json.load(json_file)