Changeset - 621ace848827
[Not reviewed]
0 2 1
Brett Smith (brett) - 2 years ago 2018-11-18 19:39:18
brett@sfconservancy.org
fundgoal: Add goal providers.
3 files changed with 44 insertions and 2 deletions:
0 comments (0 inline, 0 general)
www/conservancy/apps/fundgoal/admin.py
Show inline comments
 
from django.contrib import admin
 
from conservancy.apps.fundgoal.models import FundraisingGoal
 
from conservancy.apps.fundgoal import models as fundgoal_models
 

	
 
class FundraisingGoalAdmin(admin.ModelAdmin):
 
    list_display = ('fundraiser_code_name', 'fundraiser_goal_amount')
 

	
 
admin.site.register(FundraisingGoal, FundraisingGoalAdmin)
 
class GoalProviderAdmin(admin.ModelAdmin):
 
    fields = [
 
        'fundraising_goal',
 
        'provider_name',
 
    ]
 

	
 
admin.site.register(fundgoal_models.FundraisingGoal, FundraisingGoalAdmin)
 
admin.site.register(fundgoal_models.GoalProvider, GoalProviderAdmin)
www/conservancy/apps/fundgoal/migrations/0002_goalprovider.py
Show inline comments
 
new file 100644
 
# -*- coding: utf-8 -*-
 
# Generated by Django 1.10.7 on 2018-11-18 12:11
 
from __future__ import unicode_literals
 

	
 
from django.db import migrations, models
 
import django.db.models.deletion
 

	
 

	
 
class Migration(migrations.Migration):
 

	
 
    dependencies = [
 
        ('fundgoal', '0001_initial'),
 
    ]
 

	
 
    operations = [
 
        migrations.CreateModel(
 
            name='GoalProvider',
 
            fields=[
 
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
 
                ('provider_name', models.CharField(max_length=512)),
 
                ('fundraising_goal', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fundgoal.FundraisingGoal')),
 
            ],
 
        ),
 
    ]
www/conservancy/apps/fundgoal/models.py
Show inline comments
...
 
@@ -18,3 +18,14 @@ class FundraisingGoal(models.Model):
 
    
 
    class Meta:
 
        ordering = ('fundraiser_code_name',)
 

	
 

	
 
class GoalProvider(models.Model):
 
    fundraising_goal = models.ForeignKey(
 
        'FundraisingGoal',
 
        on_delete=models.CASCADE,
 
    )
 
    provider_name = models.CharField(max_length=512)
 

	
 
    def __unicode__(self):
 
        return self.provider_name
0 comments (0 inline, 0 general)