mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-27 02:43:01 +00:00
improve transaction template management
This commit is contained in:
parent
c10f0a21a4
commit
4dead7edf2
@ -5,6 +5,7 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
from .notes import Note,NoteClub
|
from .notes import Note,NoteClub
|
||||||
|
|
||||||
@ -37,6 +38,9 @@ class TransactionTemplate(models.Model):
|
|||||||
verbose_name = _("transaction template")
|
verbose_name = _("transaction template")
|
||||||
verbose_name_plural = _("transaction templates")
|
verbose_name_plural = _("transaction templates")
|
||||||
|
|
||||||
|
def get_absolute_url(self):
|
||||||
|
return reverse('note:template_update',args=(self.pk,))
|
||||||
|
|
||||||
|
|
||||||
class Transaction(models.Model):
|
class Transaction(models.Model):
|
||||||
source = models.ForeignKey(
|
source = models.ForeignKey(
|
||||||
|
@ -10,6 +10,6 @@ app_name = 'note'
|
|||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('transfer/', views.TransactionCreate.as_view(), name='transfer'),
|
path('transfer/', views.TransactionCreate.as_view(), name='transfer'),
|
||||||
path('buttons/create/',views.TransactionTemplateCreateView.as_view(),name='template_create'),
|
path('buttons/create/',views.TransactionTemplateCreateView.as_view(),name='template_create'),
|
||||||
path('buttons/detail/<int:pk>/',views.TransactionTemplateDetailView.as_view(),name='template_detail'),
|
path('buttons/update/<int:pk>/',views.TransactionTemplateUpdateView.as_view(),name='template_update'),
|
||||||
path('buttons/',views.TransactionTemplateListView.as_view(),name='template_list')
|
path('buttons/',views.TransactionTemplateListView.as_view(),name='template_list')
|
||||||
]
|
]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.views.generic import CreateView, ListView, DetailView
|
from django.views.generic import CreateView, ListView, DetailView, UpdateView
|
||||||
|
|
||||||
from .models import Transaction,TransactionTemplate
|
from .models import Transaction,TransactionTemplate
|
||||||
from .forms import TransactionTemplateForm
|
from .forms import TransactionTemplateForm
|
||||||
@ -33,13 +33,16 @@ class TransactionTemplateCreateView(LoginRequiredMixin,CreateView):
|
|||||||
"""
|
"""
|
||||||
model = TransactionTemplate
|
model = TransactionTemplate
|
||||||
form_class = TransactionTemplateForm
|
form_class = TransactionTemplateForm
|
||||||
|
|
||||||
class TransactionTemplateListView(LoginRequiredMixin,ListView):
|
class TransactionTemplateListView(LoginRequiredMixin,ListView):
|
||||||
"""
|
"""
|
||||||
List TransactionsTemplates
|
List TransactionsTemplates
|
||||||
"""
|
"""
|
||||||
model = TransactionTemplate
|
model = TransactionTemplate
|
||||||
form_class = TransactionTemplateForm
|
form_class = TransactionTemplateForm
|
||||||
class TransactionTemplateDetailView(LoginRequiredMixin,DetailView):
|
|
||||||
|
class TransactionTemplateUpdateView(LoginRequiredMixin,UpdateView):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
model = TransactionTemplate
|
model = TransactionTemplate
|
||||||
|
form_class=TransactionTemplateForm
|
||||||
|
Loading…
Reference in New Issue
Block a user