Improved currency display
Implemented RedirectViews Changed URL scheme for submodules Updated kumisms and ratesapi submodules
This commit is contained in:
parent
e7feba94ae
commit
fb02819e36
8 changed files with 24 additions and 24 deletions
|
@ -1,5 +1,3 @@
|
|||
from django.conf import settings
|
||||
|
||||
from core.exceptions.mail import NoSuchTemplate
|
||||
|
||||
from dbsettings.functions import getValue
|
||||
|
|
|
@ -11,9 +11,9 @@ for module in settings.EXPEPHALON_MODULES:
|
|||
mou = importlib.import_module(f"{module}.urls")
|
||||
if "ADMIN_URLS" in mou.__dict__.keys():
|
||||
for url, action, name in mou.ADMIN_URLS:
|
||||
URLPATTERNS.append(path(f'admin/modules/{module}/{url}', action, name=f"{module}_{name}"))
|
||||
URLPATTERNS.append(path(f'admin/modules/{module}/{url}', action, name=f"module_{module}_{name}"))
|
||||
if "API_URLS" in mou.__dict__.keys():
|
||||
for url, action, name in mou.API_URLS:
|
||||
URLPATTERNS.append(path(f"api/modules/{module}/{url}", action, name=f"api_{module}_{name}"))
|
||||
URLPATTERNS.append(path(f"api/modules/{module}/{url}", action, name=f"api_module_{module}_{name}"))
|
||||
except ModuleNotFoundError:
|
||||
pass
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
from core.modules.navigation import navigations
|
||||
from core.classes.navigation import NavSection, NavItem
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
# Dashboard Section
|
||||
|
||||
dashboard_section = NavSection("Dashboard")
|
||||
|
|
|
@ -7,10 +7,11 @@ from core.views.backend.generic import BackendListView, BackendUpdateView, Backe
|
|||
class CurrencyListView(BackendListView):
|
||||
template_name = f"{settings.EXPEPHALON_BACKEND}/currencies/index.html"
|
||||
model = Currency
|
||||
title = "Currency Settings"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["title"] = "Currency Settings"
|
||||
context["base_currency"] = Currency.get_base()
|
||||
return context
|
||||
|
||||
class CurrencyEditView(BackendUpdateView):
|
||||
|
@ -18,29 +19,17 @@ class CurrencyEditView(BackendUpdateView):
|
|||
model = Currency
|
||||
success_url = reverse_lazy("currencies")
|
||||
fields = ["name", "code", "symbol", "base", "rate"]
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["title"] = "Edit Currency"
|
||||
return context
|
||||
title = "Edit Currency"
|
||||
|
||||
class CurrencyDeleteView(BackendDeleteView):
|
||||
template_name = f"{settings.EXPEPHALON_BACKEND}/currencies/delete.html"
|
||||
model = Currency
|
||||
success_url = reverse_lazy("currencies")
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["title"] = "Delete Currency"
|
||||
return context
|
||||
title = "Delete Currency"
|
||||
|
||||
class CurrencyCreateView(BackendCreateView):
|
||||
template_name = f"{settings.EXPEPHALON_BACKEND}/currencies/create.html"
|
||||
model = Currency
|
||||
success_url = reverse_lazy("currencies")
|
||||
fields = ["name", "code", "symbol", "base", "rate"]
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["title"] = "Create Currency"
|
||||
return context
|
||||
title = "Create Currency"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from django.views.generic import TemplateView, ListView, CreateView, FormView, DeleteView, UpdateView
|
||||
|
||||
from core.mixins.auth import AdminMixin
|
||||
from core.views.generic import RedirectView
|
||||
|
||||
class BackendViewMixin(AdminMixin):
|
||||
def get_context_data(self, **kwargs):
|
||||
|
@ -28,3 +29,6 @@ class BackendDeleteView(BackendViewMixin, DeleteView):
|
|||
|
||||
class BackendUpdateView(BackendViewMixin, UpdateView):
|
||||
pass
|
||||
|
||||
class BackendRedirectView(AdminMixin, RedirectView):
|
||||
pass
|
9
core/views/generic.py
Normal file
9
core/views/generic.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
from django.views import View
|
||||
from django.shortcuts import redirect
|
||||
|
||||
class RedirectView(View):
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
try:
|
||||
return redirect(request.GET.get("next"))
|
||||
except:
|
||||
return redirect(self.next)
|
2
kumisms
2
kumisms
|
@ -1 +1 @@
|
|||
Subproject commit 0aa67e65c1a0eede3016e727e587ca21fb5b4bc9
|
||||
Subproject commit 8ee4066973d81d3556b021e0b892ae325fc89b48
|
|
@ -39,15 +39,17 @@
|
|||
<th>Name</th>
|
||||
<th>Code</th>
|
||||
<th>Symbol</th>
|
||||
<th>Exchange Rate to {{ base_currency.code }}</th>
|
||||
<th>Options</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for currency in object_list %}
|
||||
<tr>
|
||||
<td>{{ currency.name }}</td>
|
||||
<td>{% if currency == base_currency %}<b>{{ currency.name }}</b>{% else %}{{ currency.name }}{% endif %}</td>
|
||||
<td>{{ currency.code }}</td>
|
||||
<td>{{ currency.symbol }}</td>
|
||||
<td>{{ currency.rate }}</td>
|
||||
<td><a href="{% url "currencies_edit" currency.id %}"><i class="fas fa-edit" title="Edit Currency"></i></a> <a href="{% url "currencies_delete" currency.id %}"><i style="color: darkred;" class="fas fa-trash-alt" title="Delete Currency"></i></a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
Loading…
Reference in a new issue