This is emberassing; forgot verbose_name

New migrations require total wipe of database.
Expect a couple of migration complete reboots during initial dev.
This commit is contained in:
Christoffer Viken 2015-09-20 12:23:10 +02:00
parent f62e4e3d6f
commit 7c932104b0
8 changed files with 102 additions and 69 deletions

View File

@ -2,21 +2,18 @@
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('waffles', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Calculation',
fields=[
('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)),
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
('amount', models.IntegerField(verbose_name='Amount owed')),
('date', models.DateTimeField(verbose_name='Date integrated')),
],
@ -28,12 +25,8 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='Debt',
fields=[
('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)),
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
('amount', models.BigIntegerField(verbose_name='Amount owed')),
(
'debtee', models.ForeignKey(verbose_name='Debtee', related_name='debtee', to=settings.AUTH_USER_MODEL)),
(
'debtor', models.ForeignKey(verbose_name='Debtor', related_name='debtor', to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'Total debt',
@ -43,24 +36,14 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='Settlement',
fields=[
('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)),
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
('date', models.DateField(verbose_name='Date made')),
('amount', models.IntegerField(verbose_name='Amount owed')),
('debt', models.ForeignKey(verbose_name='Connected debt', to='mercantile.Debt')),
('debt', models.ForeignKey(to='mercantile.Debt', verbose_name='Connected debt')),
],
options={
'verbose_name': 'Cash settlement',
'verbose_name_plural': 'Cash settlements',
},
),
migrations.AddField(
model_name='calculation',
name='debt',
field=models.ForeignKey(verbose_name='Connected debt', to='mercantile.Debt'),
),
migrations.AddField(
model_name='calculation',
name='event',
field=models.ForeignKey(to_field='Connected event', to='waffles.Event'),
),
]

View File

@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('mercantile', '0001_initial'),
('waffles', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='debt',
name='debtee',
field=models.ForeignKey(related_name='debtee', to=settings.AUTH_USER_MODEL, verbose_name='Debtee'),
),
migrations.AddField(
model_name='debt',
name='debtor',
field=models.ForeignKey(related_name='debtor', to=settings.AUTH_USER_MODEL, verbose_name='Debtor'),
),
migrations.AddField(
model_name='calculation',
name='debt',
field=models.ForeignKey(to='mercantile.Debt', verbose_name='Connected debt'),
),
migrations.AddField(
model_name='calculation',
name='event',
field=models.ForeignKey(to='waffles.Event', verbose_name='Connected event'),
),
]

View File

@ -25,7 +25,7 @@ class Calculation(models.Model):
This is a single calculation of debt from an event.
"""
debt = models.ForeignKey(Debt, verbose_name=_("Connected debt"))
event = models.ForeignKey(Event, _("Connected event"))
event = models.ForeignKey(Event, verbose_name=_("Connected event"))
amount = models.IntegerField(verbose_name=_("Amount owed"))
date = models.DateTimeField(verbose_name=_("Date integrated"))

View File

@ -97,6 +97,7 @@ USE_L10N = True
USE_TZ = True
LOGIN_URL = '/accounts/login/'
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/

View File

@ -17,5 +17,6 @@ from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^$', 'waffles.views.dashboard'),
url(r'^admin/', include(admin.site.urls)),
]

View File

@ -2,10 +2,10 @@
from __future__ import unicode_literals
from django.db import models, migrations
import django.contrib.auth.models
import django.utils.timezone
import django.core.validators
from django.conf import settings
import django.contrib.auth.models
import django.core.validators
import django.utils.timezone
class Migration(migrations.Migration):
@ -18,40 +18,38 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='UserProfile',
fields=[
('id', models.AutoField(serialize=False, auto_created=True, primary_key=True, verbose_name='ID')),
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, verbose_name='last login', null=True)),
('is_superuser', models.BooleanField(default=False,
help_text='Designates that this user has all permissions without explicitly assigning them.',
verbose_name='superuser status')),
('username', models.CharField(max_length=30, verbose_name='username', validators=[
('last_login', models.DateTimeField(null=True, blank=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, verbose_name='superuser status',
help_text='Designates that this user has all permissions without explicitly assigning them.')),
('username',
models.CharField(max_length=30, error_messages={'unique': 'A user with that username already exists.'},
verbose_name='username', validators=[
django.core.validators.RegexValidator('^[\\w.@+-]+$',
'Enter a valid username. This value may contain only letters, numbers and @/./+/-/_ characters.',
'invalid')], unique=True,
help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.',
error_messages={'unique': 'A user with that username already exists.'})),
help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.')),
('first_name', models.CharField(max_length=30, blank=True, verbose_name='first name')),
('last_name', models.CharField(max_length=30, blank=True, verbose_name='last name')),
('email', models.EmailField(max_length=254, blank=True, verbose_name='email address')),
('is_staff', models.BooleanField(default=False,
help_text='Designates whether the user can log into this admin site.',
verbose_name='staff status')),
('is_active', models.BooleanField(default=True,
help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.',
verbose_name='active')),
('is_staff', models.BooleanField(default=False, verbose_name='staff status',
help_text='Designates whether the user can log into this admin site.')),
('is_active', models.BooleanField(default=True, verbose_name='active',
help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('groups',
models.ManyToManyField(related_query_name='user', verbose_name='groups', related_name='user_set',
('groups', models.ManyToManyField(related_name='user_set',
help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.',
blank=True, to='auth.Group')),
('user_permissions', models.ManyToManyField(related_query_name='user', verbose_name='user permissions',
related_name='user_set',
help_text='Specific permissions for this user.', blank=True,
to='auth.Permission')),
to='auth.Group', blank=True, verbose_name='groups',
related_query_name='user')),
('user_permissions',
models.ManyToManyField(related_name='user_set', help_text='Specific permissions for this user.',
to='auth.Permission', blank=True, verbose_name='user permissions',
related_query_name='user')),
],
options={
'verbose_name_plural': 'User profiles',
'verbose_name': 'User profile',
'verbose_name_plural': 'User profiles',
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
@ -60,76 +58,76 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='Community',
fields=[
('id', models.AutoField(serialize=False, auto_created=True, primary_key=True, verbose_name='ID')),
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
('name', models.CharField(max_length=64, verbose_name='Community name')),
('members', models.ManyToManyField(verbose_name='Community members', to=settings.AUTH_USER_MODEL)),
('members', models.ManyToManyField(to=settings.AUTH_USER_MODEL, verbose_name='Community members')),
],
options={
'verbose_name_plural': 'Communities',
'verbose_name': 'Community',
'verbose_name_plural': 'Communities',
},
),
migrations.CreateModel(
name='Event',
fields=[
('id', models.AutoField(serialize=False, auto_created=True, primary_key=True, verbose_name='ID')),
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
('name', models.CharField(max_length=64, verbose_name='Event name')),
('description', models.TextField(verbose_name='Description/text')),
('open', models.BooleanField(verbose_name='Open for new participants')),
('status', models.BooleanField(verbose_name='Finalized')),
('timeFrom', models.DateTimeField(verbose_name='Start time')),
('timeTo', models.DateTimeField(verbose_name='End time')),
('participants', models.ManyToManyField(verbose_name='Participants', to=settings.AUTH_USER_MODEL)),
('participants', models.ManyToManyField(to=settings.AUTH_USER_MODEL, verbose_name='Participants')),
],
options={
'verbose_name_plural': 'Events',
'verbose_name': 'Event',
'verbose_name_plural': 'Events',
},
),
migrations.CreateModel(
name='Listing',
fields=[
('id', models.AutoField(serialize=False, auto_created=True, primary_key=True, verbose_name='ID')),
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
('timeFrom', models.DateTimeField(verbose_name='Start time')),
('timeTo', models.DateTimeField(verbose_name='End time')),
('description', models.TextField(verbose_name='Description/text')),
('community', models.ForeignKey(verbose_name='Community', to='waffles.Community')),
('user', models.ForeignKey(verbose_name='Requesting user', to=settings.AUTH_USER_MODEL)),
('community', models.ForeignKey(to='waffles.Community', verbose_name='Community')),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, verbose_name='Requesting user')),
],
options={
'verbose_name_plural': 'Listing',
'verbose_name': 'Listing',
'verbose_name_plural': 'Listing',
},
),
migrations.CreateModel(
name='ShoppingList',
fields=[
('id', models.AutoField(serialize=False, auto_created=True, primary_key=True, verbose_name='ID')),
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
('name', models.CharField(max_length=64, verbose_name='Name')),
('price', models.IntegerField(verbose_name='Price')),
('payers', models.ManyToManyField(verbose_name='Payers', to=settings.AUTH_USER_MODEL)),
('payers', models.ManyToManyField(to=settings.AUTH_USER_MODEL, verbose_name='Payers')),
],
options={
'verbose_name_plural': 'Shopping lists',
'verbose_name': 'Shopping list',
'verbose_name_plural': 'Shopping lists',
},
),
migrations.CreateModel(
name='SubEvent',
fields=[
('id', models.AutoField(serialize=False, auto_created=True, primary_key=True, verbose_name='ID')),
('id', models.AutoField(primary_key=True, auto_created=True, verbose_name='ID', serialize=False)),
('name', models.CharField(max_length=64, verbose_name='Name')),
('event', models.ForeignKey(verbose_name='Parent event', to='waffles.Event')),
('participants', models.ManyToManyField(verbose_name='Participants', to=settings.AUTH_USER_MODEL)),
('event', models.ForeignKey(to='waffles.Event', verbose_name='Parent event')),
('participants', models.ManyToManyField(to=settings.AUTH_USER_MODEL, verbose_name='Participants')),
],
options={
'verbose_name_plural': 'Sub Events',
'verbose_name': 'Sub Event',
'verbose_name_plural': 'Sub Events',
},
),
migrations.AddField(
model_name='shoppinglist',
name='subevent',
field=models.ForeignKey(verbose_name='Connected sub-event', to='waffles.SubEvent'),
field=models.ForeignKey(to='waffles.SubEvent', verbose_name='Connected sub-event'),
),
]

View File

@ -64,6 +64,9 @@ class Event(models.Model):
verbose_name = _('Event')
verbose_name_plural = _('Events')
def __str__(self):
return "<Event name={name}>".format(name=self.name)
class SubEvent(models.Model):
"""

View File

@ -1 +1,12 @@
# Create your views here.
from django.utils import timezone
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from waffles.models import *
@login_required
def dashboard(request):
events = Event.objects.filter(timeTo__gt=timezone.now()).all()
return HttpResponse([e for e in events], content_type="text/plain")