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:
parent
f62e4e3d6f
commit
7c932104b0
|
@ -2,21 +2,18 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import models, migrations
|
from django.db import models, migrations
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('waffles', '0001_initial'),
|
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Calculation',
|
name='Calculation',
|
||||||
fields=[
|
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')),
|
('amount', models.IntegerField(verbose_name='Amount owed')),
|
||||||
('date', models.DateTimeField(verbose_name='Date integrated')),
|
('date', models.DateTimeField(verbose_name='Date integrated')),
|
||||||
],
|
],
|
||||||
|
@ -28,12 +25,8 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Debt',
|
name='Debt',
|
||||||
fields=[
|
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')),
|
('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={
|
options={
|
||||||
'verbose_name': 'Total debt',
|
'verbose_name': 'Total debt',
|
||||||
|
@ -43,24 +36,14 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Settlement',
|
name='Settlement',
|
||||||
fields=[
|
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')),
|
('date', models.DateField(verbose_name='Date made')),
|
||||||
('amount', models.IntegerField(verbose_name='Amount owed')),
|
('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={
|
options={
|
||||||
'verbose_name': 'Cash settlement',
|
'verbose_name': 'Cash settlement',
|
||||||
'verbose_name_plural': 'Cash settlements',
|
'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'),
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -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'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -25,7 +25,7 @@ class Calculation(models.Model):
|
||||||
This is a single calculation of debt from an event.
|
This is a single calculation of debt from an event.
|
||||||
"""
|
"""
|
||||||
debt = models.ForeignKey(Debt, verbose_name=_("Connected debt"))
|
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"))
|
amount = models.IntegerField(verbose_name=_("Amount owed"))
|
||||||
date = models.DateTimeField(verbose_name=_("Date integrated"))
|
date = models.DateTimeField(verbose_name=_("Date integrated"))
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,7 @@ USE_L10N = True
|
||||||
|
|
||||||
USE_TZ = True
|
USE_TZ = True
|
||||||
|
|
||||||
|
LOGIN_URL = '/accounts/login/'
|
||||||
|
|
||||||
# Static files (CSS, JavaScript, Images)
|
# Static files (CSS, JavaScript, Images)
|
||||||
# https://docs.djangoproject.com/en/1.8/howto/static-files/
|
# https://docs.djangoproject.com/en/1.8/howto/static-files/
|
||||||
|
|
|
@ -17,5 +17,6 @@ from django.conf.urls import include, url
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
url(r'^$', 'waffles.views.dashboard'),
|
||||||
url(r'^admin/', include(admin.site.urls)),
|
url(r'^admin/', include(admin.site.urls)),
|
||||||
]
|
]
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import models, migrations
|
from django.db import models, migrations
|
||||||
import django.contrib.auth.models
|
|
||||||
import django.utils.timezone
|
|
||||||
import django.core.validators
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
import django.contrib.auth.models
|
||||||
|
import django.core.validators
|
||||||
|
import django.utils.timezone
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
@ -18,40 +18,38 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='UserProfile',
|
name='UserProfile',
|
||||||
fields=[
|
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')),
|
('password', models.CharField(max_length=128, verbose_name='password')),
|
||||||
('last_login', models.DateTimeField(blank=True, verbose_name='last login', null=True)),
|
('last_login', models.DateTimeField(null=True, blank=True, verbose_name='last login')),
|
||||||
('is_superuser', models.BooleanField(default=False,
|
('is_superuser', models.BooleanField(default=False, verbose_name='superuser status',
|
||||||
help_text='Designates that this user has all permissions without explicitly assigning them.',
|
help_text='Designates that this user has all permissions without explicitly assigning them.')),
|
||||||
verbose_name='superuser status')),
|
('username',
|
||||||
('username', models.CharField(max_length=30, verbose_name='username', validators=[
|
models.CharField(max_length=30, error_messages={'unique': 'A user with that username already exists.'},
|
||||||
django.core.validators.RegexValidator('^[\\w.@+-]+$',
|
verbose_name='username', validators=[
|
||||||
'Enter a valid username. This value may contain only letters, numbers and @/./+/-/_ characters.',
|
django.core.validators.RegexValidator('^[\\w.@+-]+$',
|
||||||
'invalid')], unique=True,
|
'Enter a valid username. This value may contain only letters, numbers and @/./+/-/_ characters.',
|
||||||
help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.',
|
'invalid')], unique=True,
|
||||||
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')),
|
('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')),
|
('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')),
|
('email', models.EmailField(max_length=254, blank=True, verbose_name='email address')),
|
||||||
('is_staff', models.BooleanField(default=False,
|
('is_staff', models.BooleanField(default=False, verbose_name='staff status',
|
||||||
help_text='Designates whether the user can log into this admin site.',
|
help_text='Designates whether the user can log into this admin site.')),
|
||||||
verbose_name='staff status')),
|
('is_active', models.BooleanField(default=True, verbose_name='active',
|
||||||
('is_active', models.BooleanField(default=True,
|
help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.')),
|
||||||
help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.',
|
|
||||||
verbose_name='active')),
|
|
||||||
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
|
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
|
||||||
('groups',
|
('groups', models.ManyToManyField(related_name='user_set',
|
||||||
models.ManyToManyField(related_query_name='user', verbose_name='groups', related_name='user_set',
|
help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.',
|
||||||
help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.',
|
to='auth.Group', blank=True, verbose_name='groups',
|
||||||
blank=True, to='auth.Group')),
|
related_query_name='user')),
|
||||||
('user_permissions', models.ManyToManyField(related_query_name='user', verbose_name='user permissions',
|
('user_permissions',
|
||||||
related_name='user_set',
|
models.ManyToManyField(related_name='user_set', help_text='Specific permissions for this user.',
|
||||||
help_text='Specific permissions for this user.', blank=True,
|
to='auth.Permission', blank=True, verbose_name='user permissions',
|
||||||
to='auth.Permission')),
|
related_query_name='user')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name_plural': 'User profiles',
|
|
||||||
'verbose_name': 'User profile',
|
'verbose_name': 'User profile',
|
||||||
|
'verbose_name_plural': 'User profiles',
|
||||||
},
|
},
|
||||||
managers=[
|
managers=[
|
||||||
('objects', django.contrib.auth.models.UserManager()),
|
('objects', django.contrib.auth.models.UserManager()),
|
||||||
|
@ -60,76 +58,76 @@ class Migration(migrations.Migration):
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Community',
|
name='Community',
|
||||||
fields=[
|
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')),
|
('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={
|
options={
|
||||||
'verbose_name_plural': 'Communities',
|
|
||||||
'verbose_name': 'Community',
|
'verbose_name': 'Community',
|
||||||
|
'verbose_name_plural': 'Communities',
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Event',
|
name='Event',
|
||||||
fields=[
|
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')),
|
('name', models.CharField(max_length=64, verbose_name='Event name')),
|
||||||
('description', models.TextField(verbose_name='Description/text')),
|
('description', models.TextField(verbose_name='Description/text')),
|
||||||
('open', models.BooleanField(verbose_name='Open for new participants')),
|
('open', models.BooleanField(verbose_name='Open for new participants')),
|
||||||
('status', models.BooleanField(verbose_name='Finalized')),
|
('status', models.BooleanField(verbose_name='Finalized')),
|
||||||
('timeFrom', models.DateTimeField(verbose_name='Start time')),
|
('timeFrom', models.DateTimeField(verbose_name='Start time')),
|
||||||
('timeTo', models.DateTimeField(verbose_name='End 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={
|
options={
|
||||||
'verbose_name_plural': 'Events',
|
|
||||||
'verbose_name': 'Event',
|
'verbose_name': 'Event',
|
||||||
|
'verbose_name_plural': 'Events',
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Listing',
|
name='Listing',
|
||||||
fields=[
|
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')),
|
('timeFrom', models.DateTimeField(verbose_name='Start time')),
|
||||||
('timeTo', models.DateTimeField(verbose_name='End time')),
|
('timeTo', models.DateTimeField(verbose_name='End time')),
|
||||||
('description', models.TextField(verbose_name='Description/text')),
|
('description', models.TextField(verbose_name='Description/text')),
|
||||||
('community', models.ForeignKey(verbose_name='Community', to='waffles.Community')),
|
('community', models.ForeignKey(to='waffles.Community', verbose_name='Community')),
|
||||||
('user', models.ForeignKey(verbose_name='Requesting user', to=settings.AUTH_USER_MODEL)),
|
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, verbose_name='Requesting user')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name_plural': 'Listing',
|
|
||||||
'verbose_name': 'Listing',
|
'verbose_name': 'Listing',
|
||||||
|
'verbose_name_plural': 'Listing',
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='ShoppingList',
|
name='ShoppingList',
|
||||||
fields=[
|
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')),
|
('name', models.CharField(max_length=64, verbose_name='Name')),
|
||||||
('price', models.IntegerField(verbose_name='Price')),
|
('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={
|
options={
|
||||||
'verbose_name_plural': 'Shopping lists',
|
|
||||||
'verbose_name': 'Shopping list',
|
'verbose_name': 'Shopping list',
|
||||||
|
'verbose_name_plural': 'Shopping lists',
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='SubEvent',
|
name='SubEvent',
|
||||||
fields=[
|
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')),
|
('name', models.CharField(max_length=64, verbose_name='Name')),
|
||||||
('event', models.ForeignKey(verbose_name='Parent event', to='waffles.Event')),
|
('event', models.ForeignKey(to='waffles.Event', verbose_name='Parent event')),
|
||||||
('participants', models.ManyToManyField(verbose_name='Participants', to=settings.AUTH_USER_MODEL)),
|
('participants', models.ManyToManyField(to=settings.AUTH_USER_MODEL, verbose_name='Participants')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name_plural': 'Sub Events',
|
|
||||||
'verbose_name': 'Sub Event',
|
'verbose_name': 'Sub Event',
|
||||||
|
'verbose_name_plural': 'Sub Events',
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='shoppinglist',
|
model_name='shoppinglist',
|
||||||
name='subevent',
|
name='subevent',
|
||||||
field=models.ForeignKey(verbose_name='Connected sub-event', to='waffles.SubEvent'),
|
field=models.ForeignKey(to='waffles.SubEvent', verbose_name='Connected sub-event'),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -64,6 +64,9 @@ class Event(models.Model):
|
||||||
verbose_name = _('Event')
|
verbose_name = _('Event')
|
||||||
verbose_name_plural = _('Events')
|
verbose_name_plural = _('Events')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return "<Event name={name}>".format(name=self.name)
|
||||||
|
|
||||||
|
|
||||||
class SubEvent(models.Model):
|
class SubEvent(models.Model):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1 +1,12 @@
|
||||||
# Create your views here.
|
# 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")
|
||||||
|
|
Loading…
Reference in New Issue