Adds a demo RelatedField to the database to demonstrate reporting.

This commit is contained in:
Christopher Neugebauer 2016-10-06 10:53:38 -07:00
parent c1fab4fcc2
commit 737db640aa
3 changed files with 47 additions and 0 deletions

View file

@ -7,3 +7,7 @@ from django.utils.translation import ugettext_lazy as _
class UserProfileAdmin(admin.ModelAdmin): class UserProfileAdmin(admin.ModelAdmin):
model = models.AttendeeProfile model = models.AttendeeProfile
list_display = ("name", "company", "name_per_invoice") list_display = ("name", "company", "name_per_invoice")
@admin.register(models.DynamicValues)
class DynamicValuesAdmin(admin.ModelAdmin):
pass

View file

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-10-05 18:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pinaxcon_registrasion', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='DynamicValues',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=64)),
('value', models.IntegerField()),
],
),
migrations.AddField(
model_name='attendeeprofile',
name='db_defined_values',
field=models.ManyToManyField(to='pinaxcon_registrasion.DynamicValues'),
),
]

View file

@ -1,6 +1,18 @@
from django.db import models from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from registrasion import models as rego from registrasion import models as rego
@python_2_unicode_compatible
class DynamicValues(models.Model):
name = models.CharField(max_length=64)
value = models.IntegerField()
def __str__(self):
return "%s - %d" % (self.name, self.value)
class AttendeeProfile(rego.AttendeeProfileBase): class AttendeeProfile(rego.AttendeeProfileBase):
@classmethod @classmethod
@ -74,6 +86,9 @@ class AttendeeProfile(rego.AttendeeProfileBase):
max_length=64, max_length=64,
blank=True, blank=True,
) )
db_defined_values = models.ManyToManyField(
DynamicValues
)
class DemoPayment(rego.PaymentBase): class DemoPayment(rego.PaymentBase):