Replaced the get_absolute_url() method in the user data model with the get_success_url() method in the user and my account form model, and added the current application to the arguments to enable multiple instances of the application in the accounting application.
This commit is contained in:
parent
8cadb02d2d
commit
c400d65f91
@ -139,9 +139,6 @@ class User(DirtyFieldsMixin, models.Model):
|
||||
using=using, update_fields=update_fields)
|
||||
User.objects.filter(pk=self.pk).update(updated_at=Now())
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse("mia_core:users.detail", args=(self,))
|
||||
|
||||
class Meta:
|
||||
db_table = "users"
|
||||
app_label = "mia_core"
|
||||
|
@ -300,6 +300,11 @@ class UserFormView(FormView):
|
||||
obj.is_disabled = form["is_disabled"].value()
|
||||
obj.current_user = self.request.user
|
||||
|
||||
def get_success_url(self) -> str:
|
||||
"""Returns the URL on success."""
|
||||
return reverse("mia_core:users.detail", args=(self.get_object(),),
|
||||
current_app=self.request.resolver_match.namespace)
|
||||
|
||||
def get_object(self) -> Optional[Model]:
|
||||
"""Returns the current object, or None on a create form."""
|
||||
return self.kwargs.get("user")
|
||||
|
Loading…
Reference in New Issue
Block a user