From 5d50ade420382c1efd15a57d6cc78b634118b87b Mon Sep 17 00:00:00 2001 From: Michael Rollins Date: Tue, 25 Aug 2020 20:33:43 -0500 Subject: [PATCH] NOREF: added admin page functionality. --- src/.dockerignore | 1 + src/config/settings/base.py | 6 ++--- src/config/urls.py | 2 +- src/docker-compose.vagrant | 1 + src/frontend/package.json | 2 +- src/influencetx/bills/admin.py | 2 +- .../migrations/0002_auto_20200826_0033.py | 25 +++++++++++++++++++ src/influencetx/legislators/models.py | 4 ++- src/influencetx/tpj/admin.py | 9 +++++++ .../migrations/0003_auto_20200826_0033.py | 20 +++++++++++++++ src/requirements/base.txt | 8 +++--- 11 files changed, 70 insertions(+), 10 deletions(-) create mode 100644 src/influencetx/legislators/migrations/0002_auto_20200826_0033.py create mode 100644 src/influencetx/tpj/admin.py create mode 100644 src/influencetx/users/migrations/0003_auto_20200826_0033.py diff --git a/src/.dockerignore b/src/.dockerignore index a95f2e6..4778553 100644 --- a/src/.dockerignore +++ b/src/.dockerignore @@ -6,3 +6,4 @@ nginx.conf-integration __pycache__ *.pyc influencetx/static/react-app +frontend/ diff --git a/src/config/settings/base.py b/src/config/settings/base.py index 33f40b1..a58de3c 100644 --- a/src/config/settings/base.py +++ b/src/config/settings/base.py @@ -43,12 +43,12 @@ # 'django.contrib.humanize', # Admin - #'django.contrib.admin', + 'django.contrib.admin', ] THIRD_PARTY_APPS = [ 'crispy_forms', # Form layouts - #'allauth', # registration - #'allauth.account', # registration + 'allauth', # registration + 'allauth.account', # registration #'allauth.socialaccount', # registration ] diff --git a/src/config/urls.py b/src/config/urls.py index 0ceaa54..aabb399 100644 --- a/src/config/urls.py +++ b/src/config/urls.py @@ -17,7 +17,7 @@ url(r'^findreps/$', TemplateView.as_view(template_name='pages/findreps.html'), name='findreps'), # Django Admin, use {% url 'admin:index' %} - #url(settings.ADMIN_URL, admin.site.urls), + url(settings.ADMIN_URL, admin.site.urls), # User management # url(r'^users/', include('influencetx.users.urls', namespace='users')), diff --git a/src/docker-compose.vagrant b/src/docker-compose.vagrant index 6e981cd..f52be34 100644 --- a/src/docker-compose.vagrant +++ b/src/docker-compose.vagrant @@ -36,6 +36,7 @@ services: container_name: frontend build: context: ./frontend + dockerfile: Dockerfile.local image: inftxosfrontend:dev command: "npm start" environment: diff --git a/src/frontend/package.json b/src/frontend/package.json index a3de080..3ec3408 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -2,7 +2,7 @@ "name": "frontend", "version": "0.1.0", "private": true, - "homepage": "/static/react-app", + "homepage": ".", "dependencies": { "@apollo/react-hooks": "^3.1.3", "@material-ui/core": "^4.8.2", diff --git a/src/influencetx/bills/admin.py b/src/influencetx/bills/admin.py index 2f89b5a..fc28d00 100644 --- a/src/influencetx/bills/admin.py +++ b/src/influencetx/bills/admin.py @@ -4,6 +4,6 @@ admin.site.register(models.Bill) admin.site.register(models.SubjectTag) -admin.site.register(models.ActionDates) +admin.site.register(models.ActionDate) admin.site.register(models.VoteTally) admin.site.register(models.SingleVote) diff --git a/src/influencetx/legislators/migrations/0002_auto_20200826_0033.py b/src/influencetx/legislators/migrations/0002_auto_20200826_0033.py new file mode 100644 index 0000000..ffd4d11 --- /dev/null +++ b/src/influencetx/legislators/migrations/0002_auto_20200826_0033.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2020-08-26 00:33 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('legislators', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='legislator', + name='tpj_filer_id', + field=models.IntegerField(blank=True, db_index=True, default=0), + ), + migrations.AddField( + model_name='legislator', + name='tx_lege_id', + field=models.CharField(blank=True, db_index=True, max_length=48), + ), + ] diff --git a/src/influencetx/legislators/models.py b/src/influencetx/legislators/models.py index 9e5dbeb..69fd2d0 100644 --- a/src/influencetx/legislators/models.py +++ b/src/influencetx/legislators/models.py @@ -7,6 +7,8 @@ class Legislator(models.Model): # Legislator ID from Open States API. openstates_leg_id = models.CharField(max_length=48, db_index=True) + tpj_filer_id = models.IntegerField(default=0, blank=True, db_index=True) + tx_lege_id = models.CharField(max_length=48, blank=True, db_index=True) name = models.CharField(max_length=45) first_name = models.CharField(max_length=20, blank=True) last_name = models.CharField(max_length=20, blank=True) @@ -34,7 +36,7 @@ def chamber_label(self): return utils.chamber_label(self.chamber) def __str__(self): - return self.name + return f'{self.name} {self.tx_lege_id}' class LegislatorIdMap(models.Model): diff --git a/src/influencetx/tpj/admin.py b/src/influencetx/tpj/admin.py new file mode 100644 index 0000000..4950923 --- /dev/null +++ b/src/influencetx/tpj/admin.py @@ -0,0 +1,9 @@ +from django.contrib import admin + +from . import models + +admin.site.register(models.Donor) +admin.site.register(models.Filer) +admin.site.register(models.Contribution) +admin.site.register(models.Contributionsummary) +admin.site.register(models.Contributiontotalbydonor) diff --git a/src/influencetx/users/migrations/0003_auto_20200826_0033.py b/src/influencetx/users/migrations/0003_auto_20200826_0033.py new file mode 100644 index 0000000..0bfc61a --- /dev/null +++ b/src/influencetx/users/migrations/0003_auto_20200826_0033.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2020-08-26 00:33 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0002_auto_20200709_0256'), + ] + + operations = [ + migrations.AlterField( + model_name='user', + name='last_name', + field=models.CharField(blank=True, max_length=30, verbose_name='last name'), + ), + ] diff --git a/src/requirements/base.txt b/src/requirements/base.txt index bea1d5a..2990be8 100644 --- a/src/requirements/base.txt +++ b/src/requirements/base.txt @@ -5,10 +5,11 @@ wheel==0.33.1 django==2.2.14 -graphene -graphene-django -django-cors-headers +graphene==2.1.8 +graphene-django==2.13.0 +django-cors-headers==3.5.0 django-filter>=2 +django-allauth==0.42.0 # Configuration django-environ==0.4.5 @@ -25,6 +26,7 @@ django-model-utils==3.1.2 Pillow==6.2.0 # Password storage +argon2-cffi==20.1.0 # For user registration, either via email or social # Well-built with regular release cycles!