mirror of https://github.com/snachodog/mybuddy.git
Update Django to 4.x
This commit is contained in:
parent
81f0fb94e7
commit
226f67f02c
2
Pipfile
2
Pipfile
|
@ -5,7 +5,7 @@ url = "https://pypi.python.org/simple"
|
|||
[packages]
|
||||
boto3 = "*"
|
||||
dj-database-url = "*"
|
||||
django = "==3.*"
|
||||
django = "==4.*"
|
||||
django-axes = "*"
|
||||
django-filter = "*"
|
||||
django-imagekit = "*"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
{% blocktrans trimmed %}
|
||||
<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>
|
||||
{% endblocktrans %}
|
||||
<input type="submit" value="Delete" class="btn btn-danger" />
|
||||
<input type="submit" value="{% trans "Delete" %}" class="btn btn-danger" />
|
||||
<a href="{% url 'babybuddy:user-list' %}" class="btn btn-default">{% trans "Cancel" %}</a>
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -89,18 +89,16 @@ class UserUpdate(StaffOnlyMixin, PermissionRequiredMixin,
|
|||
|
||||
|
||||
class UserDelete(StaffOnlyMixin, PermissionRequiredMixin,
|
||||
DeleteView):
|
||||
DeleteView, SuccessMessageMixin):
|
||||
model = User
|
||||
template_name = 'babybuddy/user_confirm_delete.html'
|
||||
permission_required = ('admin.delete_user',)
|
||||
success_url = reverse_lazy('babybuddy:user-list')
|
||||
|
||||
def delete(self, request, *args, **kwargs):
|
||||
success_message = format_lazy(gettext_lazy(
|
||||
def get_success_message(self, cleaned_data):
|
||||
return format_lazy(gettext_lazy(
|
||||
'User {user} deleted.'), user=self.get_object()
|
||||
)
|
||||
messages.success(request, success_message)
|
||||
return super(UserDelete, self).delete(request, *args, **kwargs)
|
||||
|
||||
|
||||
class UserPassword(LoginRequiredMixin, View):
|
||||
|
|
|
@ -66,17 +66,11 @@ class CoreUpdateView(PermissionRequiredMixin, SuccessMessageMixin,
|
|||
return self.success_message % cleaned_data
|
||||
|
||||
|
||||
class CoreDeleteView(PermissionRequiredMixin, DeleteView):
|
||||
"""
|
||||
SuccessMessageMixin is not compatible DeleteView.
|
||||
See: https://code.djangoproject.com/ticket/21936
|
||||
"""
|
||||
def delete(self, request, *args, **kwargs):
|
||||
success_message = _('%(model)s entry deleted.') % {
|
||||
class CoreDeleteView(PermissionRequiredMixin, SuccessMessageMixin, DeleteView):
|
||||
def get_success_message(self, cleaned_data):
|
||||
return _('%(model)s entry deleted.') % {
|
||||
'model': self.model._meta.verbose_name.title()
|
||||
}
|
||||
messages.success(request, success_message)
|
||||
return super(CoreDeleteView, self).delete(request, *args, **kwargs)
|
||||
|
||||
|
||||
class ChildList(PermissionRequiredMixin, BabyBuddyFilterView):
|
||||
|
|
|
@ -20,7 +20,7 @@ django-import-export==2.7.1
|
|||
django-ipware==4.0.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
|
||||
django-storages==1.12.3
|
||||
django-widget-tweaks==1.4.12
|
||||
django==3.2.11
|
||||
django==4.0.1
|
||||
djangorestframework==3.13.1
|
||||
et-xmlfile==1.1.0; python_version >= '3.6'
|
||||
faker==11.3.0
|
||||
|
|
Loading…
Reference in New Issue