Skip to content

Commit

Permalink
feat(views): add ReferenceUpdateView for editing exising references
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Aug 26, 2024
1 parent be6a403 commit df36657
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
8 changes: 8 additions & 0 deletions apis_bibsonomy/templates/apis_bibsonomy/reference_form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends "base.html" %}
{% load crispy_forms_tags %}

{% block content %}
<div class="container">
{% crispy form form.helper %}
</div>
{% endblock content %}
5 changes: 5 additions & 0 deletions apis_bibsonomy/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
views.ReferenceDetailView.as_view(),
name="referencedetail",
),
path(
"references/<int:pk>/update",
views.ReferenceUpdateView.as_view(),
name="referenceupdate",
),
path(
"references/<int:pk>/delete",
views.ReferenceDeleteView.as_view(),
Expand Down
7 changes: 6 additions & 1 deletion apis_bibsonomy/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.contrib.contenttypes.models import ContentType
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.views.generic.edit import DeleteView, FormMixin, ProcessFormView
from django.views.generic.edit import DeleteView, FormMixin, ProcessFormView, UpdateView
from django.urls import reverse_lazy, reverse
from django.http import Http404
from django.contrib.auth.mixins import LoginRequiredMixin
Expand Down Expand Up @@ -29,6 +29,11 @@ def get_success_url(self):
return red


class ReferenceUpdateView(LoginRequiredMixin, UpdateView):
model = Reference
form_class = ReferenceNewForm


class ReferenceListView(ListView):
model = Reference

Expand Down

0 comments on commit df36657

Please sign in to comment.