Skip to content

Commit

Permalink
deps: django upgrade to 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
m4ra committed Feb 7, 2024
1 parent 4bfd476 commit a6f9f0a
Show file tree
Hide file tree
Showing 50 changed files with 203 additions and 82 deletions.
1 change: 0 additions & 1 deletion adhocracy-plus/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@

USE_I18N = True

USE_L10N = True

USE_TZ = True

Expand Down
2 changes: 1 addition & 1 deletion adhocracy-plus/config/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
if os.getenv("DATABASE") == "postgresql":
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"ENGINE": "django.db.backends.postgresql",
"NAME": "django",
"USER": "django",
"PASSWORD": "",
Expand Down
2 changes: 1 addition & 1 deletion adhocracy-plus/config/settings/travis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"ENGINE": "django.db.backends.postgresql",
"USER": "postgres",
"NAME": "django",
"TEST": {"NAME": "django_test"},
Expand Down
36 changes: 18 additions & 18 deletions adhocracy-plus/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,21 @@
urlpatterns = [
# General platform urls
re_path(r"^django-admin/", admin.site.urls),
re_path(r"^admin/", include("wagtail.admin.urls")),
re_path(r"^documents/", include(wagtaildocs_urls)),
re_path(r"^accounts/", include("allauth.urls")),
re_path(r"^account/", include("apps.account.urls")),
re_path(r"^profile/", include("apps.users.urls")),
re_path(r"^userdashboard/", include("apps.userdashboard.urls")),
re_path(r"^i18n/", include(i18n)),
path("admin/", include("wagtail.admin.urls")),
path("documents/", include(wagtaildocs_urls)),
path("accounts/", include("allauth.urls")),
path("account/", include("apps.account.urls")),
path("profile/", include("apps.users.urls")),
path("userdashboard/", include("apps.userdashboard.urls")),
path("i18n/", include(i18n)),
# API urls
re_path(r"^api/", include(ct_router.urls)),
re_path(r"^api/", include(module_router.urls)),
re_path(r"^api/", include(orga_router.urls)),
re_path(r"^api/", include(likes_router.urls)),
re_path(r"^api/", include(comment_router.urls)),
re_path(r"^api/", include(moderation_router.urls)),
re_path(r"^api/", include(router.urls)),
path("api/", include(ct_router.urls)),
path("api/", include(module_router.urls)),
path("api/", include(orga_router.urls)),
path("api/", include(likes_router.urls)),
path("api/", include(comment_router.urls)),
path("api/", include(moderation_router.urls)),
path("api/", include(router.urls)),
re_path(r"^api/login", obtain_auth_token, name="api-login"),
re_path(r"^api/account/", AccountViewSet.as_view(), name="api-account"),
re_path(
Expand All @@ -115,8 +115,8 @@
never_cache(user_is_project_admin(ck_views.browse)),
name="ckeditor_browse",
),
re_path(r"^components/$", contrib_views.ComponentLibraryView.as_view()),
re_path(r"^jsi18n/$", JavaScriptCatalog.as_view(), name="javascript-catalog"),
path("components/", contrib_views.ComponentLibraryView.as_view()),
path("jsi18n/", JavaScriptCatalog.as_view(), name="javascript-catalog"),
re_path(
r"^(?P<organisation_slug>[-\w_]+)/",
include(
Expand Down Expand Up @@ -216,6 +216,6 @@

# generic patterns at the very end
urlpatterns += [
re_path(r"", include("apps.organisations.urls")),
re_path(r"", include("wagtail.urls")),
path("", include("apps.organisations.urls")),
path("", include("wagtail.urls")),
]
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
{% else %}
<nav class="d-inline-block d-sm-none" aria-label="{% trans 'Dashboard' %}">
<a href="{% url 'userdashboard-overview' %}"
class="tab {% ifequal view.menu_item 'overview' %}active{% endifequal %}">
class="tab {% if view.menu_item == 'overview' %}active{% endif %}">

{% trans 'Overview' %}
</a>
Expand Down
1 change: 0 additions & 1 deletion apps/account/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.account.apps.Config"
1 change: 0 additions & 1 deletion apps/actions/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.actions.apps.Config"
1 change: 0 additions & 1 deletion apps/activities/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.activities.apps.Config"
1 change: 0 additions & 1 deletion apps/budgeting/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.budgeting.apps.Config"
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Generated by Django 4.0 on 2024-02-07 14:42

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
dependencies = [
("a4modules", "0008_alter_module_blueprint_type"),
("a4labels", "0003_labelalias"),
("a4_candy_budgeting", "0002_rename_moderatorfeedback_fields"),
]

operations = [
migrations.AlterField(
model_name="proposal",
name="item_ptr",
field=models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
related_name="%(app_label)s_%(class)s",
serialize=False,
to="a4modules.item",
),
),
migrations.AlterField(
model_name="proposal",
name="labels",
field=models.ManyToManyField(
related_name="%(app_label)s_%(class)s_label",
to="a4labels.Label",
verbose_name="Labels",
),
),
]
1 change: 0 additions & 1 deletion apps/captcha/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.captcha.apps.Config"
1 change: 0 additions & 1 deletion apps/cms/contacts/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.cms.contacts.apps.Config"
1 change: 0 additions & 1 deletion apps/cms/images/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.cms.images.apps.Config"
1 change: 0 additions & 1 deletion apps/cms/news/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.cms.news.apps.Config"
1 change: 0 additions & 1 deletion apps/cms/pages/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.cms.pages.apps.Config"
1 change: 0 additions & 1 deletion apps/cms/settings/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.cms.settings.apps.Config"
1 change: 0 additions & 1 deletion apps/cms/use_cases/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.cms.use_cases.apps.Config"
1 change: 0 additions & 1 deletion apps/contrib/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.contrib.apps.Config"
2 changes: 0 additions & 2 deletions apps/dashboard/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from adhocracy4.dashboard import ProjectDashboard
from adhocracy4.dashboard import components

default_app_config = "apps.dashboard.apps.Config"


class TypedProjectDashboard(ProjectDashboard):
def get_project_components(self):
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class ModuleDeleteView(mixins.DashboardBaseMixin, generic.DeleteView):
model = module_models.Module
success_message = _("The module has been deleted")

def delete(self, request, *args, **kwargs):
def form_valid(self, request, *args, **kwargs):
if not self.get_object().is_draft:
messages.error(
self.request,
Expand All @@ -214,7 +214,7 @@ def delete(self, request, *args, **kwargs):
failure_url = self.get_failure_url()
return HttpResponseRedirect(failure_url)
messages.success(self.request, self.success_message)
return super().delete(request, *args, **kwargs)
return super().form_valid(request, *args, **kwargs)

def get_permission_object(self):
return self.get_object().project
Expand Down
1 change: 0 additions & 1 deletion apps/debate/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.debate.apps.Config"
1 change: 0 additions & 1 deletion apps/documents/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.documents.apps.Config"
1 change: 0 additions & 1 deletion apps/exports/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.exports.apps.Config"
1 change: 0 additions & 1 deletion apps/ideas/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.ideas.apps.Config"
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Generated by Django 4.0 on 2024-02-07 14:42

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
dependencies = [
("a4modules", "0008_alter_module_blueprint_type"),
("a4labels", "0003_labelalias"),
("a4_candy_ideas", "0002_rename_moderatorfeedback_fields"),
]

operations = [
migrations.AlterField(
model_name="idea",
name="item_ptr",
field=models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
related_name="%(app_label)s_%(class)s",
serialize=False,
to="a4modules.item",
),
),
migrations.AlterField(
model_name="idea",
name="labels",
field=models.ManyToManyField(
related_name="%(app_label)s_%(class)s_label",
to="a4labels.Label",
verbose_name="Labels",
),
),
]
4 changes: 2 additions & 2 deletions apps/ideas/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ def get_success_url(self):
},
)

def delete(self, request, *args, **kwargs):
def form_valid(self, request, *args, **kwargs):
messages.success(self.request, self.success_message)
return super(AbstractIdeaDeleteView, self).delete(request, *args, **kwargs)
return super(AbstractIdeaDeleteView, self).form_valid(request, *args, **kwargs)


class IdeaDeleteView(AbstractIdeaDeleteView):
Expand Down
1 change: 0 additions & 1 deletion apps/interactiveevents/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.interactiveevents.apps.Config"
1 change: 0 additions & 1 deletion apps/mapideas/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.mapideas.apps.Config"
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Generated by Django 4.0 on 2024-02-07 14:42

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
dependencies = [
("a4modules", "0008_alter_module_blueprint_type"),
("a4labels", "0003_labelalias"),
("a4_candy_mapideas", "0002_moderatorfeedback_fields"),
]

operations = [
migrations.AlterField(
model_name="mapidea",
name="item_ptr",
field=models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
related_name="%(app_label)s_%(class)s",
serialize=False,
to="a4modules.item",
),
),
migrations.AlterField(
model_name="mapidea",
name="labels",
field=models.ManyToManyField(
related_name="%(app_label)s_%(class)s_label",
to="a4labels.Label",
verbose_name="Labels",
),
),
]
1 change: 0 additions & 1 deletion apps/maps/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.maps.apps.Config"
1 change: 0 additions & 1 deletion apps/moderatorfeedback/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.moderatorfeedback.apps.Config"
1 change: 0 additions & 1 deletion apps/moderatorremark/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.moderatorremark.apps.Config"
1 change: 0 additions & 1 deletion apps/newsletters/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.newsletters.apps.Config"
1 change: 0 additions & 1 deletion apps/notifications/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.notifications.apps.Config"
1 change: 0 additions & 1 deletion apps/offlineevents/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.offlineevents.apps.Config"
4 changes: 2 additions & 2 deletions apps/offlineevents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ class OfflineEventDeleteView(
template_name = "a4_candy_offlineevents/offlineevent_confirm_delete.html"
get_context_from_object = True

def delete(self, request, *args, **kwargs):
def form_valid(self, request, *args, **kwargs):
messages.success(self.request, self.success_message)
return super().delete(request, *args, **kwargs)
return super().form_valid(request, *args, **kwargs)

def get_success_url(self):
return reverse(
Expand Down
1 change: 0 additions & 1 deletion apps/organisations/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.organisations.apps.Config"
1 change: 0 additions & 1 deletion apps/polls/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.polls.apps.Config"
1 change: 0 additions & 1 deletion apps/projects/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.projects.apps.Config"
8 changes: 2 additions & 6 deletions apps/projects/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,16 @@
from adhocracy4.projects.admin import ProjectAdminForm


@admin.action(description=_("archive"))
def set_is_archived_true(modeladmin, request, queryset):
queryset.update(is_archived=True)


set_is_archived_true.short_description = _("archive")


@admin.action(description=_("dearchive"))
def set_is_archived_false(modeladmin, request, queryset):
queryset.update(is_archived=False)


set_is_archived_false.short_description = _("dearchive")


class ProjectAdmin(admin.ModelAdmin):
form = ProjectAdminForm
list_display = ("__str__", "organisation", "is_draft", "is_archived", "created")
Expand Down
4 changes: 2 additions & 2 deletions apps/projects/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,10 @@ def get_success_url(self):
kwargs={"organisation_slug": self.get_object().organisation.slug},
)

def delete(self, request, *args, **kwargs):
def form_valid(self, request, *args, **kwargs):
obj = self.get_object()
messages.success(self.request, self.success_message % obj.__dict__)
return super().delete(request, *args, **kwargs)
return super().form_valid(request, *args, **kwargs)


class ProjectDetailView(
Expand Down
1 change: 0 additions & 1 deletion apps/topicprio/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "apps.topicprio.apps.Config"
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Generated by Django 4.0 on 2024-02-07 14:42

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
dependencies = [
("a4modules", "0008_alter_module_blueprint_type"),
("a4labels", "0003_labelalias"),
("a4_candy_topicprio", "0002_topic_description_add_verbose_name"),
]

operations = [
migrations.AlterField(
model_name="topic",
name="item_ptr",
field=models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
related_name="%(app_label)s_%(class)s",
serialize=False,
to="a4modules.item",
),
),
migrations.AlterField(
model_name="topic",
name="labels",
field=models.ManyToManyField(
related_name="%(app_label)s_%(class)s_label",
to="a4labels.Label",
verbose_name="Labels",
),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="container">
<nav class="d-none d-sm-inline-block" aria-label="{% trans 'My dashboard' %}">
<a href="{% url 'userdashboard-overview' %}"
class="tab {% ifequal view.menu_item 'overview' %}active{% endifequal %}">
class="tab {% if view.menu_item == 'overview' %}active{% endif %}">

{% trans 'Overview' %}
</a>
Expand Down
2 changes: 0 additions & 2 deletions apps/users/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from django.contrib.auth.signals import user_logged_in
from django.utils.translation import gettext_lazy as _

default_app_config = "apps.users.apps.Config"

USERNAME_REGEX = r"^[\w]+[ \w.@+-]*$"
USERNAME_INVALID_MESSAGE = _(
"Enter a valid username. This value may contain "
Expand Down
Loading

0 comments on commit a6f9f0a

Please sign in to comment.