Compare commits
No commits in common. "82c7a03965087eb90a299eefb404d3ea2b33b866" and "0e1c1be1899c95685fc166e60e1ce05e0efadeab" have entirely different histories.
82c7a03965
...
0e1c1be189
12 changed files with 35 additions and 34 deletions
8
nummi/main/admin.py
Normal file
8
nummi/main/admin.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from .models import Category, Invoice, Snapshot, Transaction
|
||||||
|
|
||||||
|
admin.site.register(Transaction)
|
||||||
|
admin.site.register(Invoice)
|
||||||
|
admin.site.register(Category)
|
||||||
|
admin.site.register(Snapshot)
|
|
@ -2,4 +2,5 @@ from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
class MainConfig(AppConfig):
|
class MainConfig(AppConfig):
|
||||||
|
default_auto_field = "django.db.models.BigAutoField"
|
||||||
name = "main"
|
name = "main"
|
||||||
|
|
Binary file not shown.
|
@ -7,7 +7,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: 0.0.1\n"
|
"Project-Id-Version: 0.0.1\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2023-04-22 09:41+0200\n"
|
"POT-Creation-Date: 2023-04-21 15:41+0200\n"
|
||||||
"PO-Revision-Date: 2022-12-21 17:30+0100\n"
|
"PO-Revision-Date: 2022-12-21 17:30+0100\n"
|
||||||
"Last-Translator: edpibu <git@edgarpierre.fr>\n"
|
"Last-Translator: edpibu <git@edgarpierre.fr>\n"
|
||||||
"Language-Team: edpibu <git@edgarpierre.fr>\n"
|
"Language-Team: edpibu <git@edgarpierre.fr>\n"
|
||||||
|
@ -67,7 +67,7 @@ msgid "Budget"
|
||||||
msgstr "Budget"
|
msgstr "Budget"
|
||||||
|
|
||||||
#: .\models.py:114 .\templates\main\form\snapshot.html:23
|
#: .\models.py:114 .\templates\main\form\snapshot.html:23
|
||||||
#: .\templates\main\index.html:30
|
#: .\templates\main\index.html:32
|
||||||
msgid "Categories"
|
msgid "Categories"
|
||||||
msgstr "Catégories"
|
msgstr "Catégories"
|
||||||
|
|
||||||
|
@ -150,7 +150,6 @@ msgstr "Paiement"
|
||||||
#: .\templates\main\form\snapshot.html:27 .\templates\main\index.html:26
|
#: .\templates\main\form\snapshot.html:27 .\templates\main\index.html:26
|
||||||
#: .\templates\main\list\transaction.html:6
|
#: .\templates\main\list\transaction.html:6
|
||||||
#: .\templates\main\list\transaction.html:23
|
#: .\templates\main\list\transaction.html:23
|
||||||
#: .\templates\main\month\transaction.html:15
|
|
||||||
#: .\templates\main\table\snapshot.html:28
|
#: .\templates\main\table\snapshot.html:28
|
||||||
msgid "Transactions"
|
msgid "Transactions"
|
||||||
msgstr "Transactions"
|
msgstr "Transactions"
|
||||||
|
@ -171,7 +170,7 @@ msgstr "Aller au contenu principal"
|
||||||
msgid "Home"
|
msgid "Home"
|
||||||
msgstr "Accueil"
|
msgstr "Accueil"
|
||||||
|
|
||||||
#: .\templates\main\base.html:38 .\templates\main\index.html:40
|
#: .\templates\main\base.html:38 .\templates\main\index.html:42
|
||||||
msgid "Snapshots"
|
msgid "Snapshots"
|
||||||
msgstr "Relevés"
|
msgstr "Relevés"
|
||||||
|
|
||||||
|
@ -200,10 +199,6 @@ msgstr "Se déconnecter"
|
||||||
msgid "Log in"
|
msgid "Log in"
|
||||||
msgstr "Se connecter"
|
msgstr "Se connecter"
|
||||||
|
|
||||||
#: .\templates\main\base.html:83
|
|
||||||
msgid "Logged in as <strong>%(user)s</strong>"
|
|
||||||
msgstr "Connecté en tant que <strong>%(user)s</strong>"
|
|
||||||
|
|
||||||
#: .\templates\main\confirm_delete.html:19
|
#: .\templates\main\confirm_delete.html:19
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Are you sure you want do delete <strong>%(object)s</strong> ?"
|
msgid "Are you sure you want do delete <strong>%(object)s</strong> ?"
|
||||||
|
@ -222,7 +217,7 @@ msgid "New account"
|
||||||
msgstr "Nouveau compte"
|
msgstr "Nouveau compte"
|
||||||
|
|
||||||
#: .\templates\main\form\account.html:19 .\templates\main\form\category.html:15
|
#: .\templates\main\form\account.html:19 .\templates\main\form\category.html:15
|
||||||
#: .\templates\main\index.html:44
|
#: .\templates\main\index.html:28
|
||||||
msgid "History"
|
msgid "History"
|
||||||
msgstr "Historique"
|
msgstr "Historique"
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,16 @@ class UserModel(models.Model):
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
|
|
||||||
class Account(UserModel):
|
class NummiModel(UserModel):
|
||||||
|
@property
|
||||||
|
def adding(self):
|
||||||
|
return self._state.adding
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
abstract = True
|
||||||
|
|
||||||
|
|
||||||
|
class Account(NummiModel):
|
||||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
name = models.CharField(max_length=64, default=_("Account"), verbose_name=_("Name"))
|
name = models.CharField(max_length=64, default=_("Account"), verbose_name=_("Name"))
|
||||||
icon = models.SlugField(
|
icon = models.SlugField(
|
||||||
|
@ -63,7 +72,7 @@ class Account(UserModel):
|
||||||
verbose_name_plural = _("Accounts")
|
verbose_name_plural = _("Accounts")
|
||||||
|
|
||||||
|
|
||||||
class AccountModel(UserModel):
|
class AccountModel(NummiModel):
|
||||||
account = models.ForeignKey(
|
account = models.ForeignKey(
|
||||||
Account,
|
Account,
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
|
@ -74,7 +83,7 @@ class AccountModel(UserModel):
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
|
|
||||||
class Category(UserModel):
|
class Category(NummiModel):
|
||||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
max_length=64, default=_("Category"), verbose_name=_("Name")
|
max_length=64, default=_("Category"), verbose_name=_("Name")
|
||||||
|
@ -185,7 +194,7 @@ class Snapshot(AccountModel):
|
||||||
verbose_name_plural = _("Statements")
|
verbose_name_plural = _("Statements")
|
||||||
|
|
||||||
|
|
||||||
class Transaction(UserModel):
|
class Transaction(NummiModel):
|
||||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
max_length=256, default=_("Transaction"), verbose_name=_("Name")
|
max_length=256, default=_("Transaction"), verbose_name=_("Name")
|
||||||
|
@ -255,7 +264,7 @@ class Transaction(UserModel):
|
||||||
verbose_name_plural = _("Transactions")
|
verbose_name_plural = _("Transactions")
|
||||||
|
|
||||||
|
|
||||||
class Invoice(UserModel):
|
class Invoice(NummiModel):
|
||||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
max_length=256, default=_("Invoice"), verbose_name=_("Name")
|
max_length=256, default=_("Invoice"), verbose_name=_("Name")
|
||||||
|
|
|
@ -79,11 +79,6 @@
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
{% if user %}
|
|
||||||
<p>
|
|
||||||
{% blocktranslate %}Logged in as <strong>{{ user }}</strong>{% endblocktranslate %}
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
|
||||||
</nav>
|
</nav>
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block h2 %}{{ form.instance.icon|remix }}{{ form.instance }}{% endblock %}
|
{% block h2 %}{{ form.instance.icon|remix }}{{ form.instance }}{% endblock %}
|
||||||
{% block tables %}
|
{% block tables %}
|
||||||
{% if not form.instance|adding %}
|
{% if not form.instance.adding %}
|
||||||
<h3>{% translate "Statements" %}</h3>
|
<h3>{% translate "Statements" %}</h3>
|
||||||
{% include "main/table/snapshot.html" %}
|
{% include "main/table/snapshot.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{% load main_extras %}
|
{% load main_extras %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% if form.instance|adding %}
|
{% if form.instance.adding %}
|
||||||
{% block title_new %}{% endblock %}
|
{% block title_new %}{% endblock %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ form.instance }}
|
{{ form.instance }}
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
{% with instance=form.instance %}
|
{% with instance=form.instance %}
|
||||||
{% if instance|adding %}
|
{% if instance.adding %}
|
||||||
<h2 class="new">
|
<h2 class="new">
|
||||||
{% block h2_new %}{% endblock %}
|
{% block h2_new %}{% endblock %}
|
||||||
</h2>
|
</h2>
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
{% block pre %}{% endblock %}
|
{% block pre %}{% endblock %}
|
||||||
<form method="post">
|
<form method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% if instance|adding %}<input hidden name="next" value="{{ request.path }}" />{% endif %}
|
{% if instance.adding %}<input hidden name="next" value="{{ request.path }}" />{% endif %}
|
||||||
{{ form }}
|
{{ form }}
|
||||||
</form>
|
</form>
|
||||||
{% block tables %}{% endblock %}
|
{% block tables %}{% endblock %}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load main_extras %}
|
|
||||||
{% block fields %}
|
{% block fields %}
|
||||||
{% if form.non_field_errors %}
|
{% if form.non_field_errors %}
|
||||||
<ul class='errorlist'>
|
<ul class='errorlist'>
|
||||||
|
@ -26,11 +25,11 @@
|
||||||
<tr class="buttons">
|
<tr class="buttons">
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
{% block buttons %}
|
{% block buttons %}
|
||||||
{% if not form.instance|adding %}
|
{% if not form.instance.adding %}
|
||||||
<a class="del" href="{{ form.instance.get_delete_url }}">{% translate "Delete" %}</a>
|
<a class="del" href="{{ form.instance.get_delete_url }}">{% translate "Delete" %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<input type="reset" value="{% translate "Reset" %}" />
|
<input type="reset" value="{% translate "Reset" %}" />
|
||||||
{% if form.instance|adding %}
|
{% if form.instance.adding %}
|
||||||
<input type="submit" value="{% translate "Create" %}" />
|
<input type="submit" value="{% translate "Create" %}" />
|
||||||
{% else %}
|
{% else %}
|
||||||
<input type="submit" value="{% translate "Save" %}" />
|
<input type="submit" value="{% translate "Save" %}" />
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<h3>{% translate "Categories" %}</h3>
|
<h3>{% translate "Categories" %}</h3>
|
||||||
{% include "main/plot/category.html" %}
|
{% include "main/plot/category.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if not form.instance|adding %}
|
{% if not form.instance.adding %}
|
||||||
<h3>{% translate "Transactions" %} ({{ form.instance.sum|pmvalue }} / {{ form.instance.diff|pmvalue }})</h3>
|
<h3>{% translate "Transactions" %} ({{ form.instance.sum|pmvalue }} / {{ form.instance.diff|pmvalue }})</h3>
|
||||||
{% include "main/table/transaction.html" %}
|
{% include "main/table/transaction.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
{% extends "main/form/base.html" %}
|
{% extends "main/form/base.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load main_extras %}
|
|
||||||
{% block title_new %}
|
{% block title_new %}
|
||||||
{% translate "Create transaction" %}
|
{% translate "Create transaction" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -15,7 +14,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block tables %}
|
{% block tables %}
|
||||||
{% if not form.instance|adding %}
|
{% if not form.instance.adding %}
|
||||||
<h3>{% translate "Invoices" %}</h3>
|
<h3>{% translate "Invoices" %}</h3>
|
||||||
{% include "main/table/invoice.html" %}
|
{% include "main/table/invoice.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -54,8 +54,3 @@ def extension(file):
|
||||||
@register.filter
|
@register.filter
|
||||||
def verbose_name(obj):
|
def verbose_name(obj):
|
||||||
return obj._meta.verbose_name
|
return obj._meta.verbose_name
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
|
||||||
def adding(obj):
|
|
||||||
return obj._state.adding
|
|
||||||
|
|
Loading…
Reference in a new issue