diff --git a/legislature/management/commands/legislature_updates_models.py b/legislature/management/commands/legislature_updates_models.py index 05130733a7c9aecbbb6b31e6c8dd3af03f8dadce..5ce72595e3219e57e23f5cf11ebf590fae5ea66e 100644 --- a/legislature/management/commands/legislature_updates_models.py +++ b/legislature/management/commands/legislature_updates_models.py @@ -29,11 +29,12 @@ class Command(BaseCommand): # Group creation try: - mgroup = MGroup(group_ptr=mandate.group) + mgroup = MGroup.objects.get(group_ptr=mandate.group) except MGroup.DoesNotExist: mgroup = MGroup(group_ptr=mandate.group) mgroup.__dict__.update(mandate.group.__dict__) mgroup.save() + #print(mgroup) mmandate.mgroup = mgroup mmandate.save() @@ -47,4 +48,3 @@ class Command(BaseCommand): print('Groups') for i, mgroup in enumerate(MGroup.objects.all()): mgroup.update_active() - diff --git a/legislature/templates/legislature/representative_view.html b/legislature/templates/legislature/representative_view.html index 3a3c1815acd85cdc88bbb8bc00757e34ee4caaaf..1750369a64300465956916cfac8d3514d4e0aa1c 100644 --- a/legislature/templates/legislature/representative_view.html +++ b/legislature/templates/legislature/representative_view.html @@ -31,7 +31,7 @@ <p> {{ mandate.begin_date }} to {{ mandate.end_date }} <br> <a href="{{ mandate|by_mandate_url }}"> - <strong>{{ mandate.group.kind }}</strong> : <em>{{ mandate.group.name }} ({{ mandate.group.abbreviation }})</em> + <strong>{{ mandate.group.kind }}</strong> : <em>{{ mandate.group.name }} ({{ mandate.group.abbreviation }})</em> </a> <br> Constituency : {{ mandate.constituency.name }} <br> diff --git a/legislature/views.py b/legislature/views.py index 31c9634eaea1961deb3aaeb06e0970bf8f477e20..e5a011e800d4b322c5a9692e0bc4f6decc9623a2 100644 --- a/legislature/views.py +++ b/legislature/views.py @@ -17,6 +17,7 @@ def representatives_index(request): def representative_by_name(request, name): representative = get_object_or_404( MRepresentative, full_name=name) + return render( request, 'legislature/representative_view.html', @@ -26,7 +27,6 @@ def representative_by_name(request, name): def representative_view(request, num): representative = get_object_or_404(MRepresentative, pk=num) - return render( request, 'legislature/representative_view.html',