-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add whipreport/annotation admin and basic display
- Loading branch information
Showing
5 changed files
with
197 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,67 @@ | ||
# Register your models here. | ||
from django.contrib import admin | ||
|
||
from .models import AnalysisOverride, Update | ||
from .models import ( | ||
Agreement, | ||
AgreementAnnotation, | ||
AnalysisOverride, | ||
Division, | ||
DivisionAnnotation, | ||
Person, | ||
Update, | ||
VoteAnnotation, | ||
WhipReport, | ||
) | ||
|
||
admin.site.register(Update) | ||
|
||
|
||
@admin.register(Division) | ||
class DivisionAdmin(admin.ModelAdmin): | ||
list_display = ("id", "key") | ||
search_fields = ("key",) | ||
|
||
|
||
@admin.register(Agreement) | ||
class AgreementAdmin(admin.ModelAdmin): | ||
list_display = ("id", "key") | ||
search_fields = ("key",) | ||
|
||
|
||
@admin.register(Person) | ||
class PersonAdmin(admin.ModelAdmin): | ||
list_display = ("id", "name") | ||
search_fields = ("id",) | ||
|
||
|
||
@admin.register(AnalysisOverride) | ||
class DivisionOverrideAdmin(admin.ModelAdmin): | ||
list_display = ("id", "decision_key", "banned_motion_ids", "parl_dynamics_group") | ||
|
||
|
||
@admin.register(WhipReport) | ||
class WhipReportAdmin(admin.ModelAdmin): | ||
list_display = ("id", "division", "party", "whip_direction", "whip_priority") | ||
search_fields = ("division",) | ||
autocomplete_fields = ("division",) | ||
|
||
|
||
@admin.register(DivisionAnnotation) | ||
class DivisionAnnotationAdmin(admin.ModelAdmin): | ||
list_display = ("id", "division", "detail", "link") | ||
search_fields = ("division",) | ||
autocomplete_fields = ("division",) | ||
|
||
|
||
@admin.register(AgreementAnnotation) | ||
class AgreementAnnotationAdmin(admin.ModelAdmin): | ||
list_display = ("id", "agreement", "detail", "link") | ||
search_fields = ("agreement",) | ||
autocomplete_fields = ("agreement",) | ||
|
||
|
||
@admin.register(VoteAnnotation) | ||
class VoteAnnotationAdmin(admin.ModelAdmin): | ||
list_display = ("id", "division", "person", "detail", "link") | ||
search_fields = ("division",) | ||
autocomplete_fields = ("division", "person") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/votes/migrations/0011_whipreport_evidence_detai_whipreport_evidence_type_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Generated by Django 4.2.15 on 2024-12-20 15:39 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('votes', '0010_userpersonlink'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='whipreport', | ||
name='evidence_detai', | ||
field=models.TextField(blank=True, default=''), | ||
), | ||
migrations.AddField( | ||
model_name='whipreport', | ||
name='evidence_type', | ||
field=models.CharField(choices=[('from_rep', 'From Rep'), ('from_whip', 'From Whip'), ('from_reporting', 'From Reporting'), ('from_other', 'From Other')], default='from_other', max_length=255), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name='whipreport', | ||
name='party', | ||
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.DO_NOTHING, related_name='whip_reports', to='votes.organization'), | ||
preserve_default=False, | ||
), | ||
migrations.AlterField( | ||
model_name='divisionannotation', | ||
name='link', | ||
field=models.CharField(default='', max_length=255), | ||
), | ||
migrations.CreateModel( | ||
name='AgreementAnnotation', | ||
fields=[ | ||
('id', models.BigAutoField(default=None, primary_key=True, serialize=False)), | ||
('detail', models.CharField(default='', max_length=255)), | ||
('link', models.CharField(default='', max_length=255)), | ||
('agreement', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='agreement_annotations', to='votes.agreement')), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters