mirror of
https://github.com/Findus23/RPGnotes.git
synced 2024-09-18 14:33:44 +02:00
split up into separate apps
This commit is contained in:
parent
2d4e4d7570
commit
28c357fe0f
80 changed files with 371 additions and 967 deletions
|
@ -1,8 +1,9 @@
|
|||
from django.urls import path
|
||||
|
||||
from campaigns import views
|
||||
from campaigns import views as campaign_views
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.CampaignListView.as_view(), name="campaignlist"),
|
||||
path("c/add", views.CampaignCreateView.as_view(), name="campaigncreate"),
|
||||
path("", campaign_views.CampaignDetailView.as_view(), name="campaigndetail"),
|
||||
path("edit", campaign_views.CampaignEditView.as_view(), name="campaignedit"),
|
||||
path("delete", campaign_views.CampaignDeleteView.as_view(), name="campaigndelete"),
|
||||
]
|
||||
|
|
8
campaigns/urls_public.py
Normal file
8
campaigns/urls_public.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
from django.urls import path
|
||||
|
||||
from campaigns import views
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.CampaignListView.as_view(), name="campaignlist"),
|
||||
path("c/add", views.CampaignCreateView.as_view(), name="campaigncreate"),
|
||||
]
|
|
@ -8,6 +8,7 @@ from tenant_users.tenants.tasks import provision_tenant
|
|||
from campaigns.forms import CampaignForm
|
||||
from campaigns.models import Campaign
|
||||
from users.models import TenantUser
|
||||
from utils.mixin import PartOfTenantRequiredMixin
|
||||
|
||||
|
||||
class CampaignListView(LoginRequiredMixin, generic.ListView):
|
||||
|
@ -33,7 +34,7 @@ class CampaignCreateView(LoginRequiredMixin, generic.FormView):
|
|||
return redirect("http://" + fqdn)
|
||||
|
||||
|
||||
class CampaignDetailView(LoginRequiredMixin, generic.DetailView):
|
||||
class CampaignDetailView(PartOfTenantRequiredMixin,LoginRequiredMixin, generic.DetailView):
|
||||
template_name = "campaigns/campaign_detail.html"
|
||||
model = Campaign
|
||||
slug_url_kwarg = "campslug"
|
||||
|
|
6
characters/admin.py
Normal file
6
characters/admin.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
from django.contrib import admin
|
||||
from simple_history.admin import SimpleHistoryAdmin
|
||||
|
||||
from characters.models import Character
|
||||
|
||||
admin.site.register(Character, SimpleHistoryAdmin)
|
6
characters/apps.py
Normal file
6
characters/apps.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class CharactersConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'characters'
|
9
characters/forms.py
Normal file
9
characters/forms.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
from django.forms import ModelForm
|
||||
|
||||
from characters.models import Character
|
||||
|
||||
|
||||
class CharacterForm(ModelForm):
|
||||
class Meta:
|
||||
model = Character
|
||||
fields = ["name", "description_md", "subtitle", "player", "color", "image"]
|
66
characters/migrations/0001_initial.py
Normal file
66
characters/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,66 @@
|
|||
# Generated by Django 3.2.6 on 2021-08-29 15:14
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import simple_history.models
|
||||
import sorl.thumbnail.fields
|
||||
import utils.colors
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='HistoricalCharacter',
|
||||
fields=[
|
||||
('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
|
||||
('description_md', models.TextField(blank=True)),
|
||||
('description_html', models.TextField(blank=True, editable=False)),
|
||||
('name', models.CharField(max_length=1000)),
|
||||
('slug', models.SlugField(editable=False)),
|
||||
('subtitle', models.CharField(blank=True, max_length=100)),
|
||||
('color', models.CharField(default=utils.colors.get_random_color, max_length=6)),
|
||||
('image', models.TextField(blank=True, max_length=100, null=True)),
|
||||
('created', models.DateTimeField(blank=True, editable=False)),
|
||||
('last_modified', models.DateTimeField(blank=True, editable=False)),
|
||||
('history_id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('history_date', models.DateTimeField()),
|
||||
('history_change_reason', models.CharField(max_length=100, null=True)),
|
||||
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
|
||||
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
|
||||
('player', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'historical character',
|
||||
'ordering': ('-history_date', '-history_id'),
|
||||
'get_latest_by': 'history_date',
|
||||
},
|
||||
bases=(simple_history.models.HistoricalChanges, models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Character',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('description_md', models.TextField(blank=True)),
|
||||
('description_html', models.TextField(blank=True, editable=False)),
|
||||
('name', models.CharField(max_length=1000)),
|
||||
('slug', models.SlugField(editable=False, unique=True)),
|
||||
('subtitle', models.CharField(blank=True, max_length=100)),
|
||||
('color', models.CharField(default=utils.colors.get_random_color, max_length=6)),
|
||||
('image', sorl.thumbnail.fields.ImageField(blank=True, null=True, upload_to='character_images')),
|
||||
('created', models.DateTimeField(auto_now_add=True)),
|
||||
('last_modified', models.DateTimeField(auto_now=True)),
|
||||
('player', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['name'],
|
||||
},
|
||||
),
|
||||
]
|
|
@ -3,16 +3,16 @@ from django.urls import reverse
|
|||
from simple_history.models import HistoricalRecords
|
||||
from sorl.thumbnail import ImageField
|
||||
|
||||
from notes.models import Faction, Location, BaseModel, DescriptionModel
|
||||
from notes.utils.colors import get_random_color, is_bright_color
|
||||
from common.models import BaseModel, DescriptionModel
|
||||
from rpg_notes.settings import AUTH_USER_MODEL
|
||||
from utils.colors import get_random_color, is_bright_color
|
||||
|
||||
|
||||
class Character(BaseModel, DescriptionModel):
|
||||
subtitle = models.CharField(max_length=100, blank=True)
|
||||
player = models.ForeignKey(AUTH_USER_MODEL, on_delete=models.PROTECT, blank=True, null=True)
|
||||
faction = models.ForeignKey(Faction, on_delete=models.PROTECT, blank=True, null=True)
|
||||
location = models.ForeignKey(Location, on_delete=models.PROTECT, blank=True, null=True)
|
||||
# faction = models.ForeignKey(Faction, on_delete=models.PROTECT, blank=True, null=True)
|
||||
# location = models.ForeignKey(Location, on_delete=models.PROTECT, blank=True, null=True)
|
||||
color = models.CharField(max_length=6, default=get_random_color)
|
||||
image = ImageField(upload_to="character_images", blank=True, null=True)
|
||||
|
|
@ -8,12 +8,12 @@
|
|||
<div class="col-4">
|
||||
<ul class="nav nav-pills flex-column">
|
||||
{% for c in player_characters %}
|
||||
{% include "notes/macros/character-pillar.html" with character=c %}
|
||||
{% include "common/macros/character-pillar.html" with character=c %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<ul class="nav nav-pills flex-column">
|
||||
{% for c in npcs %}
|
||||
{% include "notes/macros/character-pillar.html" with character=c %}
|
||||
{% include "common/macros/character-pillar.html" with character=c %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<a class="btn btn-primary" href="{% url "characteradd" %}">Add Character</a>
|
12
characters/urls.py
Normal file
12
characters/urls.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
from django.urls import path
|
||||
|
||||
from characters import views
|
||||
|
||||
urlpatterns=[
|
||||
path("", views.list_character_redirect, name="characterlist"),
|
||||
path("add", views.CharacterCreateView.as_view(), name="characteradd"),
|
||||
path("<slug:slug>", views.CharacterDetailView.as_view(), name="characterdetail"),
|
||||
path("<slug:slug>/edit", views.CharacterEditView.as_view(), name="characteredit"),
|
||||
path("<slug:slug>/delete", views.CharacterDeleteView.as_view(), name="characterdelete"),
|
||||
|
||||
]
|
|
@ -1,19 +1,12 @@
|
|||
from django.shortcuts import redirect
|
||||
from django.urls import reverse_lazy
|
||||
from django.views import generic
|
||||
from rules.contrib.views import LoginRequiredMixin
|
||||
|
||||
from notes.forms import CharacterForm
|
||||
from notes.models import Character
|
||||
from characters.forms import CharacterForm
|
||||
from characters.models import Character
|
||||
|
||||
|
||||
# class CharacterListView(generic.ListView):
|
||||
# template_name = "notes/character_overview.html"
|
||||
# model = Character
|
||||
# context_object_name = "character"
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
def list_character_redirect(request, *args, **kwargs):
|
||||
first_character: Character = Character.objects.first()
|
||||
if not first_character:
|
||||
|
@ -22,7 +15,7 @@ def list_character_redirect(request, *args, **kwargs):
|
|||
|
||||
|
||||
class CharacterDetailView(generic.DetailView):
|
||||
template_name = "notes/character_detail.html"
|
||||
template_name = "characters/detail.html"
|
||||
model = Character
|
||||
context_object_name = "character"
|
||||
|
||||
|
@ -36,27 +29,19 @@ class CharacterDetailView(generic.DetailView):
|
|||
).select_related()
|
||||
return data
|
||||
|
||||
# def get_object(self, queryset=None):
|
||||
# return Character.objects.get(
|
||||
# campaign__slug=self.kwargs['campslug'], slug=self.kwargs['charslug']
|
||||
# )
|
||||
|
||||
|
||||
class CharacterCreateView(generic.CreateView):
|
||||
template_name = "notes/loot_edit.html"
|
||||
template_name = "loot/edit.html"
|
||||
model = Character
|
||||
form_class = CharacterForm
|
||||
context_object_name = "object"
|
||||
|
||||
|
||||
class CharacterEditView(generic.UpdateView):
|
||||
template_name = "notes/loot_edit.html"
|
||||
class CharacterEditView(LoginRequiredMixin,generic.UpdateView):
|
||||
template_name = "loot/edit.html"
|
||||
model = Character
|
||||
form_class = CharacterForm
|
||||
|
||||
# def get_object(self, queryset=None):
|
||||
# return Character.objects.get(campaign__slug=self.kwargs['campslug'], slug=self.kwargs['charslug'])
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
data = super().get_context_data(**kwargs)
|
||||
data['edit'] = True
|
||||
|
@ -64,6 +49,6 @@ class CharacterEditView(generic.UpdateView):
|
|||
|
||||
|
||||
class CharacterDeleteView(generic.DeleteView):
|
||||
template_name = "notes/campaign_confirm_delete.html"
|
||||
template_name = "common/campaign_confirm_delete.html"
|
||||
model = Character
|
||||
success_url = reverse_lazy('characterlist')
|
|
@ -3,4 +3,4 @@ from django.apps import AppConfig
|
|||
|
||||
class NotesConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'notes'
|
||||
name = 'common'
|
23
common/management/commands/setup_tenants.py
Normal file
23
common/management/commands/setup_tenants.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
from getpass import getpass
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from tenant_users.tenants.tasks import provision_tenant
|
||||
from tenant_users.tenants.utils import create_public_tenant
|
||||
|
||||
from users.models import TenantUser
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'sets up DTU'
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Command, self).__init__(*args, **kwargs)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
create_public_tenant("test.localhost", "rpgnotes_admin@lw1.at")
|
||||
password = getpass()
|
||||
TenantUser.objects.create_superuser(email="superuser@example.com", password=password, is_active=True)
|
||||
TenantUser.objects.create_user(email="test@lw1.at", password=password, is_active=True, is_staff=True)
|
||||
provision_tenant("Test Campaign", "testcampaign", "test@lw1.at", is_staff=True)
|
||||
|
||||
print('Done')
|
2
common/models/__init__.py
Normal file
2
common/models/__init__.py
Normal file
|
@ -0,0 +1,2 @@
|
|||
from .descriptionmodel import DescriptionModel
|
||||
from .basemodel import BaseModel
|
|
@ -1,6 +1,6 @@
|
|||
from django.db import models
|
||||
|
||||
from notes.utils.markdown import md_to_html
|
||||
from utils.markdown import md_to_html
|
||||
|
||||
|
||||
class DescriptionModel(models.Model):
|
|
@ -1,7 +1,7 @@
|
|||
from django import template
|
||||
from django.template.defaultfilters import safe
|
||||
|
||||
from notes.utils.money import format_money as money_formatter
|
||||
from utils.money import format_money as money_formatter
|
||||
|
||||
register = template.Library()
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
from django.http import HttpResponse
|
||||
from django.views.decorators.cache import cache_page
|
||||
|
||||
from notes.utils.assets import get_css
|
||||
from utils.assets import get_css
|
||||
|
||||
@cache_page(60 * 15)
|
||||
def debug_css(request):
|
0
days/__init__.py
Normal file
0
days/__init__.py
Normal file
7
days/admin.py
Normal file
7
days/admin.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
from django.contrib import admin
|
||||
from simple_history.admin import SimpleHistoryAdmin
|
||||
|
||||
from days.models import IngameDay, Session
|
||||
|
||||
admin.site.register(IngameDay, SimpleHistoryAdmin)
|
||||
admin.site.register(Session, SimpleHistoryAdmin)
|
6
days/apps.py
Normal file
6
days/apps.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class DaysConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'days'
|
14
days/forms.py
Normal file
14
days/forms.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
from django.forms import ModelForm, ModelMultipleChoiceField, CheckboxSelectMultiple
|
||||
|
||||
from days.models import Session, IngameDay
|
||||
|
||||
|
||||
class DayForm(ModelForm):
|
||||
sessions = ModelMultipleChoiceField(
|
||||
queryset=Session.objects.all(),
|
||||
widget=CheckboxSelectMultiple()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = IngameDay
|
||||
fields = ["day", "description_md", "sessions"]
|
|
@ -1,4 +1,4 @@
|
|||
# Generated by Django 3.2.6 on 2021-08-22 18:28
|
||||
# Generated by Django 3.2.6 on 2021-08-29 15:14
|
||||
|
||||
import datetime
|
||||
from django.conf import settings
|
||||
|
@ -9,40 +9,35 @@ import simple_history.models
|
|||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('notes', '0010_alter_character_image'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='IngameDay',
|
||||
name='Session',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('day', models.PositiveIntegerField()),
|
||||
('day', models.DateField(default=datetime.date.today)),
|
||||
('created', models.DateTimeField(auto_now_add=True)),
|
||||
('last_modified', models.DateTimeField(auto_now=True)),
|
||||
('campaign', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='notes.campaign')),
|
||||
],
|
||||
options={
|
||||
'ordering': ['-day'],
|
||||
},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='loot',
|
||||
options={'ordering': ['name']},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Session',
|
||||
name='IngameDay',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('description_md', models.TextField(blank=True)),
|
||||
('description_html', models.TextField(blank=True, editable=False)),
|
||||
('day', models.DateField(default=datetime.date.today)),
|
||||
('day', models.PositiveIntegerField()),
|
||||
('created', models.DateTimeField(auto_now_add=True)),
|
||||
('last_modified', models.DateTimeField(auto_now=True)),
|
||||
('campaign', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='notes.campaign')),
|
||||
('ingame_days', models.ManyToManyField(related_name='sessions', to='notes.IngameDay')),
|
||||
('sessions', models.ManyToManyField(related_name='ingame_days', to='days.Session')),
|
||||
],
|
||||
options={
|
||||
'ordering': ['-day'],
|
||||
|
@ -52,8 +47,6 @@ class Migration(migrations.Migration):
|
|||
name='HistoricalSession',
|
||||
fields=[
|
||||
('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
|
||||
('description_md', models.TextField(blank=True)),
|
||||
('description_html', models.TextField(blank=True, editable=False)),
|
||||
('day', models.DateField(default=datetime.date.today)),
|
||||
('created', models.DateTimeField(blank=True, editable=False)),
|
||||
('last_modified', models.DateTimeField(blank=True, editable=False)),
|
||||
|
@ -61,7 +54,6 @@ class Migration(migrations.Migration):
|
|||
('history_date', models.DateTimeField()),
|
||||
('history_change_reason', models.CharField(max_length=100, null=True)),
|
||||
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
|
||||
('campaign', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='notes.campaign')),
|
||||
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
|
@ -75,6 +67,8 @@ class Migration(migrations.Migration):
|
|||
name='HistoricalIngameDay',
|
||||
fields=[
|
||||
('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
|
||||
('description_md', models.TextField(blank=True)),
|
||||
('description_html', models.TextField(blank=True, editable=False)),
|
||||
('day', models.PositiveIntegerField()),
|
||||
('created', models.DateTimeField(blank=True, editable=False)),
|
||||
('last_modified', models.DateTimeField(blank=True, editable=False)),
|
||||
|
@ -82,7 +76,6 @@ class Migration(migrations.Migration):
|
|||
('history_date', models.DateTimeField()),
|
||||
('history_change_reason', models.CharField(max_length=100, null=True)),
|
||||
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
|
||||
('campaign', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='notes.campaign')),
|
||||
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
0
days/migrations/__init__.py
Normal file
0
days/migrations/__init__.py
Normal file
|
@ -1,9 +1,27 @@
|
|||
from datetime import date
|
||||
|
||||
from django.contrib.humanize.templatetags.humanize import ordinal
|
||||
from django.db import models
|
||||
from django.urls import reverse
|
||||
from simple_history.models import HistoricalRecords
|
||||
|
||||
from notes.models import Session, DescriptionModel
|
||||
from common.models import DescriptionModel
|
||||
|
||||
|
||||
class Session(models.Model):
|
||||
day = models.DateField(default=date.today)
|
||||
created = models.DateTimeField(auto_now_add=True)
|
||||
last_modified = models.DateTimeField(auto_now=True)
|
||||
history = HistoricalRecords()
|
||||
|
||||
class Meta:
|
||||
ordering = ["-day"]
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse('sessiondetail', args=[self.id])
|
||||
|
||||
def __str__(self):
|
||||
return str(self.day)
|
||||
|
||||
|
||||
class IngameDay(DescriptionModel):
|
3
days/tests.py
Normal file
3
days/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
12
days/urls.py
Normal file
12
days/urls.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
from django.urls import path
|
||||
|
||||
from days import views
|
||||
|
||||
urlpatterns=[
|
||||
path("", views.list_day_redirect, name="daylist"),
|
||||
path("add", views.DayCreateView.as_view(), name="dayadd"),
|
||||
path("<int:day>", views.DayDetailView.as_view(), name="daydetail"),
|
||||
path("<int:day>/edit", views.DayEditView.as_view(), name="dayedit"),
|
||||
path("<int:day>/delete", views.DayDeleteView.as_view(), name="daydelete"),
|
||||
|
||||
]
|
|
@ -2,8 +2,8 @@ from django.shortcuts import redirect
|
|||
from django.urls import reverse_lazy
|
||||
from django.views import generic
|
||||
|
||||
from notes.forms import DayForm
|
||||
from notes.models import IngameDay
|
||||
from days.forms import DayForm
|
||||
from days.models import IngameDay
|
||||
|
||||
|
||||
def list_day_redirect(request, *args, **kwargs):
|
||||
|
@ -14,7 +14,7 @@ def list_day_redirect(request, *args, **kwargs):
|
|||
|
||||
|
||||
class DayDetailView(generic.DetailView):
|
||||
template_name = "notes/day_detail.html"
|
||||
template_name = "days/day_detail.html"
|
||||
model = IngameDay
|
||||
context_object_name = "day"
|
||||
|
||||
|
@ -28,14 +28,14 @@ class DayDetailView(generic.DetailView):
|
|||
|
||||
|
||||
class DayCreateView(generic.CreateView):
|
||||
template_name = "notes/loot_edit.html"
|
||||
template_name = "loot/edit.html"
|
||||
model = IngameDay
|
||||
form_class = DayForm
|
||||
context_object_name = "object"
|
||||
|
||||
|
||||
class DayEditView(generic.UpdateView):
|
||||
template_name = "notes/loot_edit.html"
|
||||
template_name = "loot/edit.html"
|
||||
model = IngameDay
|
||||
form_class = DayForm
|
||||
|
||||
|
@ -49,7 +49,7 @@ class DayEditView(generic.UpdateView):
|
|||
|
||||
|
||||
class DayDeleteView(generic.DeleteView):
|
||||
template_name = "notes/campaign_confirm_delete.html"
|
||||
template_name = "common/campaign_confirm_delete.html"
|
||||
model = IngameDay
|
||||
success_url = reverse_lazy('daylist')
|
||||
|
0
loot/__init__.py
Normal file
0
loot/__init__.py
Normal file
6
loot/admin.py
Normal file
6
loot/admin.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
from django.contrib import admin
|
||||
from simple_history.admin import SimpleHistoryAdmin
|
||||
|
||||
from loot.models import Loot
|
||||
|
||||
admin.site.register(Loot, SimpleHistoryAdmin)
|
6
loot/apps.py
Normal file
6
loot/apps.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class LootConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'loot'
|
9
loot/forms.py
Normal file
9
loot/forms.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
from django.forms import ModelForm
|
||||
|
||||
from loot.models import Loot
|
||||
|
||||
|
||||
class LootForm(ModelForm):
|
||||
class Meta:
|
||||
model = Loot
|
||||
fields = ["name", "description_md", "quantity", "value_gold", "owner", "magic_item"]
|
63
loot/migrations/0001_initial.py
Normal file
63
loot/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,63 @@
|
|||
# Generated by Django 3.2.6 on 2021-08-29 15:14
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import simple_history.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('characters', '0001_initial'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Loot',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('description_md', models.TextField(blank=True)),
|
||||
('description_html', models.TextField(blank=True, editable=False)),
|
||||
('name', models.CharField(max_length=1000)),
|
||||
('quantity', models.PositiveSmallIntegerField()),
|
||||
('value_gold', models.DecimalField(decimal_places=2, max_digits=7, verbose_name='Value (Gold)')),
|
||||
('magic_item', models.BooleanField(default=False)),
|
||||
('created', models.DateTimeField(auto_now_add=True)),
|
||||
('last_modified', models.DateTimeField(auto_now=True)),
|
||||
('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='characters.character')),
|
||||
],
|
||||
options={
|
||||
'ordering': ['name'],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HistoricalLoot',
|
||||
fields=[
|
||||
('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
|
||||
('description_md', models.TextField(blank=True)),
|
||||
('description_html', models.TextField(blank=True, editable=False)),
|
||||
('name', models.CharField(max_length=1000)),
|
||||
('quantity', models.PositiveSmallIntegerField()),
|
||||
('value_gold', models.DecimalField(decimal_places=2, max_digits=7, verbose_name='Value (Gold)')),
|
||||
('magic_item', models.BooleanField(default=False)),
|
||||
('created', models.DateTimeField(blank=True, editable=False)),
|
||||
('last_modified', models.DateTimeField(blank=True, editable=False)),
|
||||
('history_id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('history_date', models.DateTimeField()),
|
||||
('history_change_reason', models.CharField(max_length=100, null=True)),
|
||||
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
|
||||
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
|
||||
('owner', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='characters.character')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'historical loot',
|
||||
'ordering': ('-history_date', '-history_id'),
|
||||
'get_latest_by': 'history_date',
|
||||
},
|
||||
bases=(simple_history.models.HistoricalChanges, models.Model),
|
||||
),
|
||||
]
|
0
loot/migrations/__init__.py
Normal file
0
loot/migrations/__init__.py
Normal file
|
@ -1,7 +1,8 @@
|
|||
from django.db import models
|
||||
from simple_history.models import HistoricalRecords
|
||||
|
||||
from notes.models import DescriptionModel, Character
|
||||
from characters.models import Character
|
||||
from common.models import DescriptionModel
|
||||
|
||||
|
||||
class Loot(DescriptionModel):
|
3
loot/tests.py
Normal file
3
loot/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
11
loot/urls.py
Normal file
11
loot/urls.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
from django.urls import path
|
||||
|
||||
from loot import views
|
||||
|
||||
urlpatterns=[
|
||||
path("loot", views.LootListView.as_view(), name="lootlist"),
|
||||
path("<int:pk>/edit", views.LootEditView.as_view(), name="lootedit"),
|
||||
path("<int:pk>/delete", views.LootDeleteView.as_view(), name="lootdelete"),
|
||||
path("add", views.LootCreateView.as_view(), name="lootadd"),
|
||||
|
||||
]
|
|
@ -1,13 +1,13 @@
|
|||
from django.db.models import Sum
|
||||
from django.urls import reverse_lazy, reverse
|
||||
from django.urls import reverse_lazy
|
||||
from django.views import generic
|
||||
|
||||
from notes.forms import LootForm
|
||||
from notes.models import Loot
|
||||
from loot.models import Loot
|
||||
from loot.forms import LootForm
|
||||
|
||||
|
||||
class LootListView(generic.ListView):
|
||||
template_name = "notes/loot_overview.html"
|
||||
template_name = "loot/overview.html"
|
||||
model = Loot
|
||||
context_object_name = "loot"
|
||||
|
||||
|
@ -21,22 +21,21 @@ class LootListView(generic.ListView):
|
|||
return data
|
||||
|
||||
|
||||
class LootDetailView(generic.DetailView):
|
||||
template_name = "notes/loot_detail.html"
|
||||
model = Loot
|
||||
# class LootDetailView(generic.DetailView):
|
||||
# template_name = "common/loot_detail.html"
|
||||
# model = Loot
|
||||
|
||||
|
||||
class LootCreateView(generic.CreateView):
|
||||
template_name = "notes/loot_edit.html"
|
||||
template_name = "loot/edit.html"
|
||||
model = Loot
|
||||
form_class = LootForm
|
||||
|
||||
success_url = reverse_lazy("lootlist")
|
||||
|
||||
|
||||
|
||||
class LootEditView(generic.UpdateView):
|
||||
template_name = "notes/loot_edit.html"
|
||||
template_name = "loot/edit.html"
|
||||
model = Loot
|
||||
form_class = LootForm
|
||||
context_object_name = "object"
|
||||
|
@ -50,7 +49,7 @@ class LootEditView(generic.UpdateView):
|
|||
|
||||
|
||||
class LootDeleteView(generic.DeleteView):
|
||||
template_name = "notes/campaign_confirm_delete.html"
|
||||
template_name = "common/campaign_confirm_delete.html"
|
||||
model = Loot
|
||||
|
||||
success_url = reverse_lazy("lootlist")
|
|
@ -1,12 +0,0 @@
|
|||
from django.contrib import admin
|
||||
# Register your models here.
|
||||
from simple_history.admin import SimpleHistoryAdmin
|
||||
|
||||
from notes.models import Character, Faction, Location, Loot, IngameDay, Session
|
||||
|
||||
admin.site.register(Character, SimpleHistoryAdmin)
|
||||
admin.site.register(Faction, SimpleHistoryAdmin)
|
||||
admin.site.register(Location, SimpleHistoryAdmin)
|
||||
admin.site.register(Loot, SimpleHistoryAdmin)
|
||||
admin.site.register(IngameDay, SimpleHistoryAdmin)
|
||||
admin.site.register(Session, SimpleHistoryAdmin)
|
|
@ -1,27 +0,0 @@
|
|||
from django.forms import ModelForm, ModelMultipleChoiceField, CheckboxSelectMultiple
|
||||
|
||||
from notes.models import Loot, Character, IngameDay, Session
|
||||
|
||||
|
||||
|
||||
class LootForm(ModelForm):
|
||||
class Meta:
|
||||
model = Loot
|
||||
fields = ["name", "description_md", "quantity", "value_gold", "owner", "magic_item"]
|
||||
|
||||
|
||||
class CharacterForm(ModelForm):
|
||||
class Meta:
|
||||
model = Character
|
||||
fields = ["name", "description_md", "subtitle", "player", "faction", "location", "color", "image"]
|
||||
|
||||
|
||||
class DayForm(ModelForm):
|
||||
sessions = ModelMultipleChoiceField(
|
||||
queryset=Session.objects.all(),
|
||||
widget=CheckboxSelectMultiple()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = IngameDay
|
||||
fields = ["day", "description_md", "sessions"]
|
|
@ -1,83 +0,0 @@
|
|||
# Generated by Django 3.2.6 on 2021-08-22 11:02
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Campaign',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=1000)),
|
||||
('slug', models.SlugField(unique=True)),
|
||||
('notes', models.TextField()),
|
||||
('created', models.DateTimeField(auto_now_add=True)),
|
||||
('last_modified', models.DateTimeField(auto_now=True)),
|
||||
('dm', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Loot',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=1000)),
|
||||
('description', models.TextField()),
|
||||
('quantity', models.PositiveSmallIntegerField()),
|
||||
('value_gold', models.DecimalField(decimal_places=2, max_digits=7)),
|
||||
('magic_item', models.BooleanField(default=False)),
|
||||
('created', models.DateTimeField(auto_now_add=True)),
|
||||
('last_modified', models.DateTimeField(auto_now=True)),
|
||||
('campaign', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='notes.campaign')),
|
||||
('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Location',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=1000)),
|
||||
('slug', models.SlugField(unique=True)),
|
||||
('notes', models.TextField()),
|
||||
('created', models.DateTimeField(auto_now_add=True)),
|
||||
('last_modified', models.DateTimeField(auto_now=True)),
|
||||
('campaign', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='notes.campaign')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Faction',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=1000)),
|
||||
('slug', models.SlugField(unique=True)),
|
||||
('notes', models.TextField()),
|
||||
('created', models.DateTimeField(auto_now_add=True)),
|
||||
('last_modified', models.DateTimeField(auto_now=True)),
|
||||
('campaign', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='notes.campaign')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Character',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=1000)),
|
||||
('slug', models.SlugField(unique=True)),
|
||||
('notes', models.TextField()),
|
||||
('created', models.DateTimeField(auto_now_add=True)),
|
||||
('last_modified', models.DateTimeField(auto_now=True)),
|
||||
('campaign', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='notes.campaign')),
|
||||
('faction', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='notes.faction')),
|
||||
('location', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='notes.location')),
|
||||
('player', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
),
|
||||
]
|
|
@ -1,33 +0,0 @@
|
|||
# Generated by Django 3.2.6 on 2021-08-22 11:09
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('notes', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='campaign',
|
||||
name='slug',
|
||||
field=models.SlugField(editable=False, unique=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='character',
|
||||
name='slug',
|
||||
field=models.SlugField(editable=False, unique=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='faction',
|
||||
name='slug',
|
||||
field=models.SlugField(editable=False, unique=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='location',
|
||||
name='slug',
|
||||
field=models.SlugField(editable=False, unique=True),
|
||||
),
|
||||
]
|
|
@ -1,38 +0,0 @@
|
|||
# Generated by Django 3.2.6 on 2021-08-22 11:10
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('notes', '0002_auto_20210822_1109'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='campaign',
|
||||
name='notes',
|
||||
field=models.TextField(blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='character',
|
||||
name='notes',
|
||||
field=models.TextField(blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='faction',
|
||||
name='notes',
|
||||
field=models.TextField(blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='location',
|
||||
name='notes',
|
||||
field=models.TextField(blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='loot',
|
||||
name='description',
|
||||
field=models.TextField(blank=True),
|
||||
),
|
||||
]
|
|
@ -1,138 +0,0 @@
|
|||
# Generated by Django 3.2.6 on 2021-08-22 11:38
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import simple_history.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('notes', '0003_auto_20210822_1110'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='HistoricalLoot',
|
||||
fields=[
|
||||
('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=1000)),
|
||||
('description', models.TextField(blank=True)),
|
||||
('quantity', models.PositiveSmallIntegerField()),
|
||||
('value_gold', models.DecimalField(decimal_places=2, max_digits=7)),
|
||||
('magic_item', models.BooleanField(default=False)),
|
||||
('created', models.DateTimeField(blank=True, editable=False)),
|
||||
('last_modified', models.DateTimeField(blank=True, editable=False)),
|
||||
('history_id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('history_date', models.DateTimeField()),
|
||||
('history_change_reason', models.CharField(max_length=100, null=True)),
|
||||
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
|
||||
('campaign', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='notes.campaign')),
|
||||
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
|
||||
('owner', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'historical loot',
|
||||
'ordering': ('-history_date', '-history_id'),
|
||||
'get_latest_by': 'history_date',
|
||||
},
|
||||
bases=(simple_history.models.HistoricalChanges, models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HistoricalLocation',
|
||||
fields=[
|
||||
('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=1000)),
|
||||
('slug', models.SlugField(editable=False)),
|
||||
('notes', models.TextField(blank=True)),
|
||||
('created', models.DateTimeField(blank=True, editable=False)),
|
||||
('last_modified', models.DateTimeField(blank=True, editable=False)),
|
||||
('history_id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('history_date', models.DateTimeField()),
|
||||
('history_change_reason', models.CharField(max_length=100, null=True)),
|
||||
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
|
||||
('campaign', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='notes.campaign')),
|
||||
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'historical location',
|
||||
'ordering': ('-history_date', '-history_id'),
|
||||
'get_latest_by': 'history_date',
|
||||
},
|
||||
bases=(simple_history.models.HistoricalChanges, models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HistoricalFaction',
|
||||
fields=[
|
||||
('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=1000)),
|
||||
('slug', models.SlugField(editable=False)),
|
||||
('notes', models.TextField(blank=True)),
|
||||
('created', models.DateTimeField(blank=True, editable=False)),
|
||||
('last_modified', models.DateTimeField(blank=True, editable=False)),
|
||||
('history_id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('history_date', models.DateTimeField()),
|
||||
('history_change_reason', models.CharField(max_length=100, null=True)),
|
||||
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
|
||||
('campaign', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='notes.campaign')),
|
||||
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'historical faction',
|
||||
'ordering': ('-history_date', '-history_id'),
|
||||
'get_latest_by': 'history_date',
|
||||
},
|
||||
bases=(simple_history.models.HistoricalChanges, models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HistoricalCharacter',
|
||||
fields=[
|
||||
('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=1000)),
|
||||
('slug', models.SlugField(editable=False)),
|
||||
('notes', models.TextField(blank=True)),
|
||||
('created', models.DateTimeField(blank=True, editable=False)),
|
||||
('last_modified', models.DateTimeField(blank=True, editable=False)),
|
||||
('history_id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('history_date', models.DateTimeField()),
|
||||
('history_change_reason', models.CharField(max_length=100, null=True)),
|
||||
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
|
||||
('campaign', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='notes.campaign')),
|
||||
('faction', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='notes.faction')),
|
||||
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
|
||||
('location', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='notes.location')),
|
||||
('player', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'historical character',
|
||||
'ordering': ('-history_date', '-history_id'),
|
||||
'get_latest_by': 'history_date',
|
||||
},
|
||||
bases=(simple_history.models.HistoricalChanges, models.Model),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HistoricalCampaign',
|
||||
fields=[
|
||||
('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=1000)),
|
||||
('slug', models.SlugField(editable=False)),
|
||||
('notes', models.TextField(blank=True)),
|
||||
('created', models.DateTimeField(blank=True, editable=False)),
|
||||
('last_modified', models.DateTimeField(blank=True, editable=False)),
|
||||
('history_id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('history_date', models.DateTimeField()),
|
||||
('history_change_reason', models.CharField(max_length=100, null=True)),
|
||||
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
|
||||
('dm', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)),
|
||||
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'historical campaign',
|
||||
'ordering': ('-history_date', '-history_id'),
|
||||
'get_latest_by': 'history_date',
|
||||
},
|
||||
bases=(simple_history.models.HistoricalChanges, models.Model),
|
||||
),
|
||||
]
|
|
@ -1,40 +0,0 @@
|
|||
# Generated by Django 3.2.6 on 2021-08-22 12:59
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('notes', '0004_historicalcampaign_historicalcharacter_historicalfaction_historicallocation_historicalloot'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='character',
|
||||
name='slug',
|
||||
field=models.SlugField(editable=False),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='faction',
|
||||
name='slug',
|
||||
field=models.SlugField(editable=False),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='location',
|
||||
name='slug',
|
||||
field=models.SlugField(editable=False),
|
||||