mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 03:17:07 +00:00
[FEAT] Update dependencies
Upgrade versions of most packages and make other required changes to ensure compatibility. Update database models and migrations to match new requirements set by Django
This commit is contained in:
8
people/forms.py
Normal file → Executable file
8
people/forms.py
Normal file → Executable file
@@ -5,7 +5,7 @@ import typing
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
|
||||
from bootstrap_datepicker_plus import DatePickerInput
|
||||
from bootstrap_datepicker_plus.widgets import DatePickerInput
|
||||
from django_select2.forms import ModelSelect2Widget, Select2Widget, Select2MultipleWidget
|
||||
|
||||
from . import models
|
||||
@@ -185,8 +185,8 @@ class PersonAnswerSetForm(forms.ModelForm, DynamicAnswerSetBase):
|
||||
widgets = {
|
||||
'nationality': Select2MultipleWidget(),
|
||||
'country_of_residence': Select2Widget(),
|
||||
'organisation_started_date': DatePickerInput(format='%Y-%m-%d'),
|
||||
'project_started_date': DatePickerInput(format='%Y-%m-%d'),
|
||||
'organisation_started_date': DatePickerInput(),
|
||||
'project_started_date': DatePickerInput(),
|
||||
'latitude': forms.HiddenInput,
|
||||
'longitude': forms.HiddenInput,
|
||||
}
|
||||
@@ -325,7 +325,7 @@ class OrganisationRelationshipAnswerSetForm(forms.ModelForm,
|
||||
class DateForm(forms.Form):
|
||||
date = forms.DateField(
|
||||
required=False,
|
||||
widget=DatePickerInput(format='%Y-%m-%d'),
|
||||
widget=DatePickerInput(),
|
||||
help_text='Show relationships as they were on this date'
|
||||
)
|
||||
|
||||
|
||||
4
people/migrations/0002_add_relationship_models.py
Normal file → Executable file
4
people/migrations/0002_add_relationship_models.py
Normal file → Executable file
@@ -50,10 +50,10 @@ class Migration(migrations.Migration):
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='relationshipquestionchoice',
|
||||
constraint=models.UniqueConstraint(fields=('question', 'text'), name='unique_question_answer'),
|
||||
constraint=models.UniqueConstraint(fields=('question', 'text'), name='unique_question_answer_relationshipquestionchoice'),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='relationship',
|
||||
constraint=models.UniqueConstraint(fields=('source', 'target'), name='unique_relationship'),
|
||||
constraint=models.UniqueConstraint(fields=('source', 'target'), name='unique_relationship_relationship'),
|
||||
),
|
||||
]
|
||||
|
||||
2
people/migrations/0022_refactor_person_questions.py
Normal file → Executable file
2
people/migrations/0022_refactor_person_questions.py
Normal file → Executable file
@@ -50,6 +50,6 @@ class Migration(migrations.Migration):
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='personquestionchoice',
|
||||
constraint=models.UniqueConstraint(fields=('question', 'text'), name='unique_question_answer'),
|
||||
constraint=models.UniqueConstraint(fields=('question', 'text'), name='unique_question_answer_personquestionchoice'),
|
||||
),
|
||||
]
|
||||
|
||||
2
people/migrations/0035_add_organisation_questions.py
Normal file → Executable file
2
people/migrations/0035_add_organisation_questions.py
Normal file → Executable file
@@ -56,6 +56,6 @@ class Migration(migrations.Migration):
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='organisationquestionchoice',
|
||||
constraint=models.UniqueConstraint(fields=('question', 'text'), name='unique_question_answer'),
|
||||
constraint=models.UniqueConstraint(fields=('question', 'text'), name='unique_question_answer_organisationquestionchoice'),
|
||||
),
|
||||
]
|
||||
|
||||
4
people/migrations/0039_add_organisation_relationship.py
Normal file → Executable file
4
people/migrations/0039_add_organisation_relationship.py
Normal file → Executable file
@@ -67,10 +67,10 @@ class Migration(migrations.Migration):
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='organisationrelationshipquestionchoice',
|
||||
constraint=models.UniqueConstraint(fields=('question', 'text'), name='unique_question_answer'),
|
||||
constraint=models.UniqueConstraint(fields=('question', 'text'), name='unique_question_answer_organisationrelationshipquestionchoice'),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='organisationrelationship',
|
||||
constraint=models.UniqueConstraint(fields=('source', 'target'), name='unique_relationship'),
|
||||
constraint=models.UniqueConstraint(fields=('source', 'target'), name='unique_relationship_organisationrelationship'),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
# Generated by Django 4.1.4 on 2023-01-05 16:57
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('people', '0054_add_option_for_auto_negative_response'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveConstraint(
|
||||
model_name='organisationrelationship',
|
||||
name='unique_relationship_organisationrelationship',
|
||||
),
|
||||
migrations.RemoveConstraint(
|
||||
model_name='relationship',
|
||||
name='unique_relationship_relationship',
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='organisation',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='organisationanswerset',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='organisationquestion',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='organisationquestionchoice',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='organisationrelationship',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='organisationrelationshipanswerset',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='organisationrelationshipquestion',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='organisationrelationshipquestionchoice',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='person',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='personanswerset',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='personquestion',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='personquestionchoice',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='relationship',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='relationshipanswerset',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='relationshipquestion',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='relationshipquestionchoice',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='user',
|
||||
name='first_name',
|
||||
field=models.CharField(blank=True, max_length=150, verbose_name='first name'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='user',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='organisationrelationship',
|
||||
constraint=models.UniqueConstraint(fields=('source', 'target'), name='unique_relationship_modelorganisationrelationship'),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='relationship',
|
||||
constraint=models.UniqueConstraint(fields=('source', 'target'), name='unique_relationship_modelrelationship'),
|
||||
),
|
||||
]
|
||||
5
people/models/organisation.py
Normal file → Executable file
5
people/models/organisation.py
Normal file → Executable file
@@ -35,6 +35,11 @@ class OrganisationQuestionChoice(QuestionChoice):
|
||||
on_delete=models.CASCADE,
|
||||
blank=False,
|
||||
null=False)
|
||||
class Meta(QuestionChoice.Meta):
|
||||
constraints = [
|
||||
models.UniqueConstraint(fields=['question', 'text'],
|
||||
name='unique_question_answer_organisationquestionchoice')
|
||||
]
|
||||
|
||||
|
||||
class Organisation(models.Model):
|
||||
|
||||
5
people/models/person.py
Normal file → Executable file
5
people/models/person.py
Normal file → Executable file
@@ -77,6 +77,11 @@ class PersonQuestionChoice(QuestionChoice):
|
||||
on_delete=models.CASCADE,
|
||||
blank=False,
|
||||
null=False)
|
||||
class Meta(QuestionChoice.Meta):
|
||||
constraints = [
|
||||
models.UniqueConstraint(fields=['question', 'text'],
|
||||
name='unique_question_answer_personquestionchoice')
|
||||
]
|
||||
|
||||
|
||||
class Person(models.Model):
|
||||
|
||||
2
people/models/question.py
Normal file → Executable file
2
people/models/question.py
Normal file → Executable file
@@ -92,7 +92,7 @@ class QuestionChoice(models.Model):
|
||||
abstract = True
|
||||
constraints = [
|
||||
models.UniqueConstraint(fields=['question', 'text'],
|
||||
name='unique_question_answer')
|
||||
name='unique_question_answer_modelquestionchoice')
|
||||
]
|
||||
ordering = [
|
||||
'question__order',
|
||||
|
||||
14
people/models/relationship.py
Normal file → Executable file
14
people/models/relationship.py
Normal file → Executable file
@@ -33,6 +33,11 @@ class RelationshipQuestionChoice(QuestionChoice):
|
||||
on_delete=models.CASCADE,
|
||||
blank=False,
|
||||
null=False)
|
||||
class Meta(QuestionChoice.Meta):
|
||||
constraints = [
|
||||
models.UniqueConstraint(fields=['question', 'text'],
|
||||
name='unique_question_answer_relationshipquestionchoice')
|
||||
]
|
||||
|
||||
|
||||
class Relationship(models.Model):
|
||||
@@ -40,7 +45,7 @@ class Relationship(models.Model):
|
||||
class Meta:
|
||||
constraints = [
|
||||
models.UniqueConstraint(fields=['source', 'target'],
|
||||
name='unique_relationship'),
|
||||
name='unique_relationship_modelrelationship'),
|
||||
]
|
||||
|
||||
#: Person reporting the relationship
|
||||
@@ -122,6 +127,11 @@ class OrganisationRelationshipQuestionChoice(QuestionChoice):
|
||||
on_delete=models.CASCADE,
|
||||
blank=False,
|
||||
null=False)
|
||||
class Meta(QuestionChoice.Meta):
|
||||
constraints = [
|
||||
models.UniqueConstraint(fields=['question', 'text'],
|
||||
name='unique_question_answer_organisationrelationshipquestionchoice')
|
||||
]
|
||||
|
||||
|
||||
class OrganisationRelationship(models.Model):
|
||||
@@ -129,7 +139,7 @@ class OrganisationRelationship(models.Model):
|
||||
class Meta:
|
||||
constraints = [
|
||||
models.UniqueConstraint(fields=['source', 'target'],
|
||||
name='unique_relationship'),
|
||||
name='unique_relationship_modelorganisationrelationship'),
|
||||
]
|
||||
|
||||
#: Person reporting the relationship
|
||||
|
||||
2
people/templates/people/map.html
Normal file → Executable file
2
people/templates/people/map.html
Normal file → Executable file
@@ -3,7 +3,7 @@
|
||||
{% block extra_head %}
|
||||
{{ map_markers|json_script:'map-markers' }}
|
||||
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
<script src="{% static 'js/map.js' %}"></script>
|
||||
|
||||
<script async defer
|
||||
|
||||
2
people/templates/people/network.html
Normal file → Executable file
2
people/templates/people/network.html
Normal file → Executable file
@@ -97,6 +97,6 @@
|
||||
integrity="sha512-Qlv6VSKh1gDKGoJbnyA5RMXYcvnpIqhO++MhIM2fStMcGT9i2T//tSwYFlcyoRRDcDZ+TYHpH8azBBCyhpSeqw=="
|
||||
crossorigin="anonymous"></script>
|
||||
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
<script src="{% static 'js/network.js' %}"></script>
|
||||
{% endblock %}
|
||||
2
people/templates/people/organisation/detail.html
Normal file → Executable file
2
people/templates/people/organisation/detail.html
Normal file → Executable file
@@ -3,7 +3,7 @@
|
||||
{% block extra_head %}
|
||||
{{ map_markers|json_script:'map-markers' }}
|
||||
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
<script src="{% static 'js/map.js' %}"></script>
|
||||
|
||||
<script async defer src="https://maps.googleapis.com/maps/api/js?key={{ settings.GOOGLE_MAPS_API_KEY }}&callback=initMap"
|
||||
|
||||
2
people/templates/people/organisation/update.html
Normal file → Executable file
2
people/templates/people/organisation/update.html
Normal file → Executable file
@@ -1,7 +1,7 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block extra_head %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
{{ map_markers|json_script:'map-markers' }}
|
||||
|
||||
<script src="{% static 'js/map.js' %}"></script>
|
||||
|
||||
14
people/templates/people/person/detail_full.html
Normal file → Executable file
14
people/templates/people/person/detail_full.html
Normal file → Executable file
@@ -3,7 +3,7 @@
|
||||
{% block extra_head %}
|
||||
{{ map_markers|json_script:'map-markers' }}
|
||||
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
<script src="{% static 'js/map.js' %}"></script>
|
||||
|
||||
<script async defer src="https://maps.googleapis.com/maps/api/js?key={{ settings.GOOGLE_MAPS_API_KEY }}&callback=initMap"
|
||||
@@ -64,17 +64,19 @@
|
||||
<a class="btn btn-success"
|
||||
href="{% url 'people:person.update' pk=person.pk %}">Update</a>
|
||||
|
||||
{% load hijack_tags %}
|
||||
{% if person.user == request.user and not request|is_hijacked %}
|
||||
{% load hijack %}
|
||||
{% if person.user == request.user and not request.user.is_hijacked %}
|
||||
<a class="btn btn-info"
|
||||
href="{% url 'password_change' %}?next={{ person.get_absolute_url }}">Change Password</a>
|
||||
{% endif %}
|
||||
|
||||
{% if request.user.is_superuser and person.user and person.user != request.user %}
|
||||
<form style="display: inline;" action="/hijack/{{ person.user.pk }}/" method="post">
|
||||
{% csrf_token %}
|
||||
<form action="{% url 'hijack:acquire' %}" method="POST">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="user_pk" value="{{ person.pk }}">
|
||||
<button class="btn btn-warning" type="submit">Become {{ person.name }}</button>
|
||||
</form>
|
||||
<input type="hidden" name="next" value="{{ request.path }}">
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
<hr>
|
||||
|
||||
2
people/templates/people/person/detail_partial.html
Normal file → Executable file
2
people/templates/people/person/detail_partial.html
Normal file → Executable file
@@ -3,7 +3,7 @@
|
||||
{% block extra_head %}
|
||||
{{ map_markers|json_script:'map-markers' }}
|
||||
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
<script src="{% static 'js/map.js' %}"></script>
|
||||
|
||||
<script async defer src="https://maps.googleapis.com/maps/api/js?key={{ settings.GOOGLE_MAPS_API_KEY }}&callback=initMap"
|
||||
|
||||
2
people/templates/people/person/update.html
Normal file → Executable file
2
people/templates/people/person/update.html
Normal file → Executable file
@@ -1,7 +1,7 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block extra_head %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
{{ map_markers|json_script:'map-markers' }}
|
||||
|
||||
<script src="{% static 'js/map.js' %}"></script>
|
||||
|
||||
2
people/templates/people/relationship/update.html
Normal file → Executable file
2
people/templates/people/relationship/update.html
Normal file → Executable file
@@ -23,6 +23,6 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_script %}
|
||||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
<script async defer src="{% static 'js/hide_free_text.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user