diff --git a/orchestra/contrib/musician/forms.py b/orchestra/contrib/musician/forms.py
index 50fa75ca..9440c88e 100644
--- a/orchestra/contrib/musician/forms.py
+++ b/orchestra/contrib/musician/forms.py
@@ -153,3 +153,10 @@ class RecordCreateForm(forms.ModelForm):
if commit:
super().save(commit=True)
return instance
+
+
+class RecordUpdateForm(forms.ModelForm):
+
+ class Meta:
+ model = Record
+ fields = ("ttl", "type", "value")
diff --git a/orchestra/contrib/musician/templates/musician/domain_detail.html b/orchestra/contrib/musician/templates/musician/domain_detail.html
index 333ceee3..121f6342 100644
--- a/orchestra/contrib/musician/templates/musician/domain_detail.html
+++ b/orchestra/contrib/musician/templates/musician/domain_detail.html
@@ -22,7 +22,13 @@
{% for record in object.records.all %}
{{ record.type }} |
- {{ record.value }} |
+
+
+ {{ record.value }}
+
+
+
+ |
{% endfor %}
diff --git a/orchestra/contrib/musician/templates/musician/record_confirm_delete.html b/orchestra/contrib/musician/templates/musician/record_confirm_delete.html
new file mode 100644
index 00000000..fe8e04a0
--- /dev/null
+++ b/orchestra/contrib/musician/templates/musician/record_confirm_delete.html
@@ -0,0 +1,13 @@
+{% extends "musician/base.html" %}
+{% load i18n %}
+
+{% block content %}
+
+{% endblock %}
diff --git a/orchestra/contrib/musician/templates/musician/record_form.html b/orchestra/contrib/musician/templates/musician/record_form.html
index 43f7252b..4088dcca 100644
--- a/orchestra/contrib/musician/templates/musician/record_form.html
+++ b/orchestra/contrib/musician/templates/musician/record_form.html
@@ -2,7 +2,7 @@
{% load bootstrap4 i18n %}
{% block content %}
-{% trans "Go back" %}
+{% trans "Go back" %}
{% trans "Add record for" %} {{ form.domain.name }}
@@ -10,11 +10,11 @@
{% csrf_token %}
{% bootstrap_form form %}
{% buttons %}
- {% trans "Cancel" %}
+ {% trans "Cancel" %}
{% if form.instance.pk %}
{% endif %}
{% endbuttons %}
diff --git a/orchestra/contrib/musician/urls.py b/orchestra/contrib/musician/urls.py
index fda9df2b..1305fd9c 100644
--- a/orchestra/contrib/musician/urls.py
+++ b/orchestra/contrib/musician/urls.py
@@ -14,8 +14,12 @@ urlpatterns = [
path('auth/login/', views.LoginView.as_view(), name='login'),
path('auth/logout/', views.LogoutView.as_view(), name='logout'),
path('dashboard/', views.DashboardView.as_view(), name='dashboard'),
+
path('domains//', views.DomainDetailView.as_view(), name='domain-detail'),
path('domains//add-record/', views.DomainAddRecordView.as_view(), name='domain-add-record'),
+ path('domains//records//update/', views.DomainUpdateRecordView.as_view(), name='domain-update-record'),
+ path('domains//records//delete/', views.DomainDeleteRecordView.as_view(), name='domain-delete-record'),
+
path('billing/', views.BillingView.as_view(), name='billing'),
path('bills//download/', views.BillDownloadView.as_view(), name='bill-download'),
path('profile/', views.ProfileView.as_view(), name='profile'),
diff --git a/orchestra/contrib/musician/views.py b/orchestra/contrib/musician/views.py
index a6b38db0..fc692fd5 100644
--- a/orchestra/contrib/musician/views.py
+++ b/orchestra/contrib/musician/views.py
@@ -33,7 +33,8 @@ from orchestra.utils.html import html_to_pdf
# from .auth import login as auth_login
from .auth import logout as auth_logout
from .forms import (LoginForm, MailboxChangePasswordForm, MailboxCreateForm,
- MailboxUpdateForm, MailForm, RecordCreateForm)
+ MailboxUpdateForm, MailForm, RecordCreateForm,
+ RecordUpdateForm)
from .mixins import (CustomContextMixin, ExtendedPaginationMixin,
UserTokenRequiredMixin)
from .models import Address as AddressService
@@ -483,6 +484,33 @@ class DomainAddRecordView(CustomContextMixin, UserTokenRequiredMixin, CreateView
return reverse_lazy("musician:domain-detail", kwargs={"pk": self.kwargs["pk"]})
+class DomainUpdateRecordView(CustomContextMixin, UserTokenRequiredMixin, UpdateView):
+ model = Record
+ form_class = RecordUpdateForm
+ template_name = "musician/record_form.html"
+ pk_url_kwarg = "record_pk"
+
+ def get_queryset(self):
+ qs = Record.objects.filter(domain__account=self.request.user, domain=self.kwargs["pk"])
+ return qs
+
+ def get_success_url(self):
+ return reverse_lazy("musician:domain-detail", kwargs={"pk": self.kwargs["pk"]})
+
+
+class DomainDeleteRecordView(CustomContextMixin, UserTokenRequiredMixin, DeleteView):
+ model = Record
+ template_name = "musician/record_confirm_delete.html"
+ pk_url_kwarg = "record_pk"
+
+ def get_queryset(self):
+ qs = Record.objects.filter(domain__account=self.request.user, domain=self.kwargs["pk"])
+ return qs
+
+ def get_success_url(self):
+ return reverse_lazy("musician:domain-detail", kwargs={"pk": self.kwargs["pk"]})
+
+
class LoginView(FormView):
template_name = 'auth/login.html'
form_class = LoginForm