diff --git a/nummi/main/models.py b/nummi/main/models.py index 5b3773a..b6e57d9 100644 --- a/nummi/main/models.py +++ b/nummi/main/models.py @@ -7,7 +7,7 @@ from django.core.validators import validate_unicode_slug, FileExtensionValidator class Category(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) - name = models.CharField(max_length=64, validators=[validate_unicode_slug]) + name = models.CharField(max_length=64, validators=[validate_unicode_slug], default="New Category") full_name = models.CharField(max_length=512, editable=False, default="") parent = models.ForeignKey("self", on_delete=models.SET_NULL, blank=True, null=True) @@ -40,7 +40,7 @@ class CategoryForm(ModelForm): class Transaction(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) - name = models.CharField(max_length=256, default="Transaction") + name = models.CharField(max_length=256, default="New Transaction") description = models.TextField(null=True, blank=True) value = models.DecimalField(max_digits=12, decimal_places=2, default=0) date = models.DateField(default=date.today) @@ -67,7 +67,7 @@ class TransactionForm(ModelForm): class Invoice(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) - name = models.CharField(max_length=256) + name = models.CharField(max_length=256, default="New Invoice") file = models.FileField( upload_to="invoices/", validators=[FileExtensionValidator(["pdf"])] ) diff --git a/nummi/main/static/css/index.css b/nummi/main/static/css/index.css index 90649d9..6e3addd 100644 --- a/nummi/main/static/css/index.css +++ b/nummi/main/static/css/index.css @@ -1,3 +1,11 @@ +h1 { + font-size: 4rem; + font-variant: small-caps; + font-weight: 850; + letter-spacing: -.05em; + margin: 0; +} + #transactions { display: grid; grid-template-columns: repeat(6, auto); diff --git a/nummi/main/static/css/main.css b/nummi/main/static/css/main.css index dd4ff82..bd1652d 100644 --- a/nummi/main/static/css/main.css +++ b/nummi/main/static/css/main.css @@ -6,6 +6,8 @@ body { font-family: "Inter var experimental", "Inter var", "Inter", sans-serif; + margin: 0; + padding: 2em; } :root { @@ -17,3 +19,7 @@ body { --bg-01: #dedede; } + +h1 { + margin: 0; +} diff --git a/nummi/main/static/css/nav.css b/nummi/main/static/css/nav.css new file mode 100644 index 0000000..4afe7b8 --- /dev/null +++ b/nummi/main/static/css/nav.css @@ -0,0 +1,37 @@ +:root { + --nav-lh: 2em; + --nav-pad: 1em; + --nav-height: calc(2 * var(--nav-pad) + var(--nav-lh)); +} + +body { + margin-top: var(--nav-height); +} + +nav { + background: var(--bg-inv); + color: var(--text-inv); + position: absolute; + top: 0; + left: 0; + right: 0; + height: var(--nav-height); + line-height: var(--nav-lh); + padding: var(--nav-pad); +} +nav > a { + display: inline-block; + color: inherit; + text-decoration: inherit; + height: var(--nav-lh); + margin: 0 var(--nav-pad); +} +nav > a.cur { + font-weight: 750; +} +nav > a.home { + font-variant: small-caps; +} +nav > a.logout { + float: right; +} diff --git a/nummi/main/templates/main/base.html b/nummi/main/templates/main/base.html index 779b24e..4b0de87 100644 --- a/nummi/main/templates/main/base.html +++ b/nummi/main/templates/main/base.html @@ -9,9 +9,32 @@ {% block link %} + {% endblock %} + {% block nav %} + {% spaceless %} + + {% endspaceless %} + {% endblock %} {% block body %} {% endblock %} diff --git a/nummi/main/templates/main/category.html b/nummi/main/templates/main/category.html index 07ed357..7273947 100644 --- a/nummi/main/templates/main/category.html +++ b/nummi/main/templates/main/category.html @@ -1,8 +1,6 @@ {% extends "main/base.html" %} {% block body %} -Home -

{{ category.tree|join:" → " }}

diff --git a/nummi/main/templates/main/index.html b/nummi/main/templates/main/index.html index 262b396..89db979 100644 --- a/nummi/main/templates/main/index.html +++ b/nummi/main/templates/main/index.html @@ -9,9 +9,6 @@ {% block body %}

Nummi

-Logout -Add transaction - {% if transactions %}
diff --git a/nummi/main/templates/main/transaction.html b/nummi/main/templates/main/transaction.html index 74996a1..8527b27 100644 --- a/nummi/main/templates/main/transaction.html +++ b/nummi/main/templates/main/transaction.html @@ -1,9 +1,8 @@ {% extends "main/base.html" %} {% block body %} -Home -

{{ transaction }}

+ {% csrf_token %} {{ form.as_p }}