add form for edit institution details
This commit is contained in:
parent
b620079da7
commit
3b70a6c7cc
|
@ -8,5 +8,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<a href="{% url 'admin:institution' user.institution.pk %}" class="btn btn-green-admin">
|
||||||
|
{% translate "Institution" %}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -9,4 +9,5 @@ urlpatterns = [
|
||||||
path("users/new", views.CreateUserView.as_view(), name="new_user"),
|
path("users/new", views.CreateUserView.as_view(), name="new_user"),
|
||||||
path("users/edit/<int:pk>", views.EditUserView.as_view(), name="edit_user"),
|
path("users/edit/<int:pk>", views.EditUserView.as_view(), name="edit_user"),
|
||||||
path("users/delete/<int:pk>", views.DeleteUserView.as_view(), name="delete_user"),
|
path("users/delete/<int:pk>", views.DeleteUserView.as_view(), name="delete_user"),
|
||||||
|
path("institution/<int:pk>", views.InstitutionView.as_view(), name="institution"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -8,7 +8,7 @@ from django.views.generic.edit import (
|
||||||
DeleteView,
|
DeleteView,
|
||||||
)
|
)
|
||||||
from dashboard.mixins import DashboardView
|
from dashboard.mixins import DashboardView
|
||||||
from user.models import User
|
from user.models import User, Institution
|
||||||
|
|
||||||
|
|
||||||
class PanelView(DashboardView, TemplateView):
|
class PanelView(DashboardView, TemplateView):
|
||||||
|
@ -87,3 +87,24 @@ class EditUserView(DashboardView, UpdateView):
|
||||||
#self.object.set_password(self.object.password)
|
#self.object.set_password(self.object.password)
|
||||||
kwargs = super().get_form_kwargs()
|
kwargs = super().get_form_kwargs()
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
|
|
||||||
|
class InstitutionView(DashboardView, UpdateView):
|
||||||
|
template_name = "institution.html"
|
||||||
|
title = _("Edit institution")
|
||||||
|
section = "admin"
|
||||||
|
subtitle = _('Edit institution')
|
||||||
|
model = Institution
|
||||||
|
success_url = reverse_lazy('admin:panel')
|
||||||
|
fields = (
|
||||||
|
"name",
|
||||||
|
"logo",
|
||||||
|
"location",
|
||||||
|
"responsable_person",
|
||||||
|
"supervisor_person"
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_form_kwargs(self):
|
||||||
|
self.object = self.request.user.institution
|
||||||
|
kwargs = super().get_form_kwargs()
|
||||||
|
return kwargs
|
||||||
|
|
Loading…
Reference in New Issue