Up min versions to py3.9, Django 4

This commit is contained in:
Griatch 2022-02-04 23:24:48 +01:00
parent 89f9eaffcc
commit b76c5d2bab
15 changed files with 44 additions and 58 deletions

View file

@ -278,7 +278,7 @@ class AccountAdmin(BaseUserAdmin):
return str(dbserialize.pack_dbobj(obj))
serialized_string.help_text = (
"Copy & paste this string into an Attribute's `value` field to store it there."
"Copy & paste this string into an Attribute's `value` field to store this account there."
)
def puppeted_objects(self, obj):

View file

@ -129,7 +129,8 @@ class MsgAdmin(admin.ModelAdmin):
return str(dbserialize.pack_dbobj(obj))
serialized_string.help_text = (
"Copy & paste this string into an Attribute's `value` field to store it there."
"Copy & paste this string into an Attribute's `value` field to store "
"this message-object there."
)
def get_form(self, request, obj=None, **kwargs):
@ -246,7 +247,7 @@ class ChannelAdmin(admin.ModelAdmin):
return str(dbserialize.pack_dbobj(obj))
serialized_string.help_text = (
"Copy & paste this string into an Attribute's `value` field to store it there."
"Copy & paste this string into an Attribute's `value` field to store this channel there."
)
def get_form(self, request, obj=None, **kwargs):

View file

@ -4,10 +4,9 @@
#
from django.conf import settings
from django import forms
from django.urls import reverse
from django.urls import reverse, path
from django.http import HttpResponseRedirect
from django.conf import settings
from django.conf.urls import url
from django.contrib import admin, messages
from django.contrib.admin.utils import flatten_fieldsets
from django.contrib.admin.widgets import ForeignKeyRawIdWidget
@ -227,7 +226,7 @@ class ObjectAdmin(admin.ModelAdmin):
return str(dbserialize.pack_dbobj(obj))
serialized_string.help_text = (
"Copy & paste this string into an Attribute's `value` field to store it there."
"Copy & paste this string into an Attribute's `value` field to store this object there."
)
def get_fieldsets(self, request, obj=None):
@ -266,8 +265,8 @@ class ObjectAdmin(admin.ModelAdmin):
def get_urls(self):
urls = super().get_urls()
custom_urls = [
url(
r"^account-object-link/(?P<object_id>.+)/$",
path(
"account-object-link/<int:pk>",
self.admin_site.admin_view(self.link_object_to_account),
name="object-account-link"
)

View file

@ -125,7 +125,7 @@ class ScriptAdmin(admin.ModelAdmin):
return str(dbserialize.pack_dbobj(obj))
serialized_string.help_text = (
"Copy & paste this string into an Attribute's `value` field to store it there."
"Copy & paste this string into an Attribute's `value` field to store this script there."
)

View file

@ -5,15 +5,14 @@ Tests for the REST API.
from evennia.utils.test_resources import BaseEvenniaTest
from evennia.web.api import serializers
from rest_framework.test import APIClient
from django.urls import reverse
from django.urls import reverse, path, include
from django.test import override_settings
from collections import namedtuple
from django.conf.urls import url, include
from django.core.exceptions import ObjectDoesNotExist
urlpatterns = [
url(r"^", include("evennia.web.website.urls")),
url(r"^api/", include("evennia.web.api.urls", namespace="api")),
path(r"^", include("evennia.web.website.urls")),
path(r"^api/", include("evennia.web.api.urls", namespace="api")),
]

View file

@ -199,8 +199,8 @@ class CharacterDeleteView(CharacterMixin, ObjectDeleteView):
ObjectDeleteView) can delete a character they own.
"""
pass
# using the character form fails there
form_class = forms.EvenniaForm
class CharacterCreateView(CharacterMixin, ObjectCreateView):

View file

@ -87,5 +87,3 @@ class EvenniaDeleteView(DeleteView, TypeclassMixin):
def page_title(self):
# Makes sure the page has a sensible title.
return "Delete %s" % self.typeclass._meta.verbose_name.title()

View file

@ -162,27 +162,6 @@ class ObjectDeleteView(LoginRequiredMixin, ObjectDetailView, EvenniaDeleteView):
# -- Evennia constructs --
access_type = "delete"
def delete(self, request, *args, **kwargs):
"""
Calls the delete() method on the fetched object and then
redirects to the success URL.
We extend this so we can capture the name for the sake of confirmation.
"""
# Get the object in question. ObjectDetailView.get_object() will also
# check to make sure the current user (authenticated or not) has
# permission to delete it!
obj = str(self.get_object())
# Perform the actual deletion (the parent class handles this, which will
# in turn call the delete() method on the object)
response = super().delete(request, *args, **kwargs)
# Notify the user of the deletion
messages.success(request, "Successfully deleted '%s'." % obj)
return response
class ObjectUpdateView(LoginRequiredMixin, ObjectDetailView, EvenniaUpdateView):
"""