-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from open-austin/add-job-type
Add job type
- Loading branch information
Showing
5 changed files
with
115 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,3 +1,34 @@ | ||
from django.contrib import admin | ||
from . import models | ||
|
||
# Register your models here. | ||
|
||
class JobAdmin(admin.ModelAdmin): | ||
list_display = ('employer', 'position', 'held_by', 'financial_disclosure') | ||
readonly_fields = ('legislator', ) | ||
|
||
|
||
admin.site.register(models.Job, JobAdmin) | ||
|
||
|
||
class JobTypeAdmin(admin.ModelAdmin): | ||
list_display = ('name', "view_jobs_count") | ||
|
||
def view_jobs_count(self, obj): | ||
return obj.jobs.count() | ||
view_jobs_count.short_description = "Jobs" | ||
|
||
|
||
admin.site.register(models.JobType, JobTypeAdmin) | ||
|
||
|
||
class FinancialDisclosureAdmin(admin.ModelAdmin): | ||
list_display = ("legislator", "year", "elected_officer", "candidate") | ||
readonly_fields = ('legislator', ) | ||
|
||
|
||
admin.site.register(models.FinancialDisclosure, FinancialDisclosureAdmin) | ||
|
||
|
||
admin.site.register(models.Gift) | ||
admin.site.register(models.Board) | ||
admin.site.register(models.Stock) |
26 changes: 26 additions & 0 deletions
26
src/influencetx/finances/migrations/0002_auto_20200829_1856.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,26 @@ | ||
# Generated by Django 2.2.14 on 2020-08-29 18:56 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('finances', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='JobType', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=100)), | ||
], | ||
), | ||
migrations.AddField( | ||
model_name='job', | ||
name='job_type', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='finances.JobType'), | ||
), | ||
] |
19 changes: 19 additions & 0 deletions
19
src/influencetx/finances/migrations/0003_auto_20200829_2102.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,19 @@ | ||
# Generated by Django 2.2.14 on 2020-08-29 21:02 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('finances', '0002_auto_20200829_1856'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='job', | ||
name='job_type', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='jobs', to='finances.JobType'), | ||
), | ||
] |
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
18 changes: 18 additions & 0 deletions
18
src/influencetx/users/migrations/0004_auto_20200829_1856.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,18 @@ | ||
# Generated by Django 2.2.14 on 2020-08-29 18:56 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('users', '0003_auto_20200826_0033'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='user', | ||
name='last_name', | ||
field=models.CharField(blank=True, max_length=150, verbose_name='last name'), | ||
), | ||
] |