diff --git a/.drone.yml b/.drone.yml index da91dc7..46cc277 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,3 +8,8 @@ steps: settings: repo: git.thisfro.ch/pflaenz.li/pflaenzli dockerfile: Dockerfile + registry: git.thisfro.ch/pflaenz.li/pflaenzli + username: + from_secret: docker_username + password: + from_secret: docker_password \ No newline at end of file diff --git a/.gitignore b/.gitignore index f4bfa8e..8a19bc4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,14 @@ +# Project +plz_verzeichnis_v2.json +django.po +plz.pkl + .vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -!.vscode/*.code-snippets +.vscode/settings.json +.vscode/tasks.json +.vscode/launch.json +.vscode/extensions.json +.vscode/*.code-snippets # Local History for Visual Studio Code .history/ diff --git a/COLORS.md b/COLORS.md new file mode 100644 index 0000000..a812fbc --- /dev/null +++ b/COLORS.md @@ -0,0 +1,163 @@ + + +# Colors + +## Basics +There is a set of colors for each the light and dark theme. + +## Light theme + +### Main colors +
+ --pfl-color: +
+ #4c6e4dff +
+ +
+ --pfl-dark-green: +
+ #374139ff +
+ +
+ --pfl-grey: +
+ #93877a +
+ +
+ --pfl-brown: +
+ #dbc8baff +
+ +
+ --pfl-orange: +
+ #ed7e2cff +
+ +### Background colors +
+ --bg-pfl-color: +
+ #3f5b40ff +
+ +
+ --bg-pfl-dark-green: +
+ #2f3831ff +
+ +
+ --bg-pfl-grey: +
+ #7b7166 +
+ +
+ --bg-pfl-brown: +
+ #c4a58fff +
+ +
+ --bg-pfl-orange: +
+ #d96513ff +
+ +------------------------------------------------------------------------- + +## Dark theme + +### Main colors +
+
+ --pfl-color: +
+ #8eb57b +
+ +
+ --pfl-dark-green: +
+ #4c6e4dff +
+ +
+ --pfl-grey: +
+ #bbbbbb +
+ +
+ --pfl-brown: +
+ #8f7e6b +
+ +
+ --pfl-orange: +
+ #e1ad45 +
+
+ +### Background colors +
+
+ --bg-pfl-color: +
+ #728f64 +
+ +
+ --bg-pfl-dark-green: +
+ #3d583e +
+ +
+ --bg-pfl-grey: +
+ #9b9b9b +
+ +
+ --bg-pfl-brown: +
+ #7b7166 +
+ +
+ --bg-pfl-orange: +
+ #c98f44ff +
+
diff --git a/README.md b/README.md index a68daac..88cd6e9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Pflänz.li [![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0) +[![Build Status](https://drone.thisfro.ch/api/badges/pflaenz.li/pflaenz.li/status.svg?ref=refs/heads/main)](https://drone.thisfro.ch/pflaenz.li/pflaenz.li) ## Idea A platform where people can trade their plants. You can post what you have and search for others with [filters](#filters). The aim is to make it easier to trade plants and collect as few data as possible. Only the email/username and a postal code is required. @@ -26,7 +27,8 @@ It would be nice to have categories somehow, but it would be hard to make it com Searching with filters such as: | Filter Name | Type | Input type | |--------------|---------------|------------| -| Indoor only | `boolean` | checkbox | +| Distance | `int` | numfield | +| ZIP code | `int` | numfield | | Name | `string` | textfield | | Category | `Category` | dropdown | diff --git a/pflaenzli/pflaenzli/forms.py b/pflaenzli/pflaenzli/forms.py index b4f8bfa..4209387 100644 --- a/pflaenzli/pflaenzli/forms.py +++ b/pflaenzli/pflaenzli/forms.py @@ -10,7 +10,7 @@ from .models import Offer, PflaenzliUser, Wish class CreateOfferForm(forms.ModelForm): class Meta: model = Offer - fields = ['title', 'description', 'zipcode', 'image'] + fields = ['title', 'description', 'category', 'zipcode', 'image'] class RegistrationForm(UserCreationForm): @@ -22,6 +22,7 @@ class RegistrationForm(UserCreationForm): class FilterForm(forms.Form): + category = forms.ChoiceField(choices=Offer.FILTER_CATEGORIES, label=_("Category")) text = forms.CharField(max_length=128, required=False, label=_("Search")) zipcode = forms.CharField(max_length=4, required=False, label=_("ZIP code")) distance = forms.IntegerField(required=False, label=_("Distance")) @@ -29,7 +30,14 @@ class FilterForm(forms.Form): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + # Overwrite default + self.fields['category'].initial = 'ALL' + # Set the translated labels with the selected language and icons for each form field + self.fields['category'].label = mark_safe( + f' {self.fields["category"].label}' + ) + self.fields['text'].label = mark_safe( f' {self.fields["text"].label}' ) diff --git a/pflaenzli/pflaenzli/migrations/0004_offer_category.py b/pflaenzli/pflaenzli/migrations/0004_offer_category.py new file mode 100644 index 0000000..3d4910f --- /dev/null +++ b/pflaenzli/pflaenzli/migrations/0004_offer_category.py @@ -0,0 +1,28 @@ +# Generated by Django 4.1.7 on 2023-05-19 10:10 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("pflaenzli", "0003_alter_offer_description_alter_offer_image_and_more"), + ] + + operations = [ + migrations.AddField( + model_name="offer", + name="category", + field=models.CharField( + choices=[ + ("PLNT", "Plant"), + ("SEED", "Seedling"), + ("POT", "Pot"), + ("TOOL", "Tools"), + ("OTHR", "Other"), + ], + default="PLNT", + max_length=4, + ), + ), + ] diff --git a/pflaenzli/pflaenzli/models.py b/pflaenzli/pflaenzli/models.py index cc0a54a..1923aea 100644 --- a/pflaenzli/pflaenzli/models.py +++ b/pflaenzli/pflaenzli/models.py @@ -14,12 +14,25 @@ class PflaenzliUser(AbstractUser): class Offer(models.Model): + CATEGORIES = [ + ('PLNT', _('Plant')), + ('SEED', _('Seedling')), + ('POT', _('Pots')), + ('TOOL', _('Tools')), + ('OTHR', _('Other')), + ] + + FILTER_CATEGORIES = [ + ('ALL', _('All')), + ] + CATEGORIES + created = models.DateTimeField(default=timezone.now) user = models.ForeignKey(PflaenzliUser, on_delete=models.CASCADE) title = models.CharField(max_length=50, verbose_name=_('Title')) description = models.TextField(max_length=5000, verbose_name=_('Description')) zipcode = models.IntegerField(blank=True, default=0, verbose_name=_('ZIP code')) image = models.ImageField(upload_to="uploads/", verbose_name=_('Image')) + category = models.CharField(choices=CATEGORIES, max_length=4, default='PLNT', verbose_name=_('Category')) class Wish(models.Model): diff --git a/pflaenzli/pflaenzli/static/base.css b/pflaenzli/pflaenzli/static/base.css index 62a3e99..ca3d96e 100644 --- a/pflaenzli/pflaenzli/static/base.css +++ b/pflaenzli/pflaenzli/static/base.css @@ -1,6 +1,18 @@ :root { - --pfl-color: #188d1c; - --bg-pfl-color: #59af5c; + /* Primary */ + --pfl-color: #4c6e4dff; + --pfl-dark-green: #374139ff; + --pfl-grey: #93877a; + --pfl-brown: #dbc8baff; + --pfl-orange: #ed7e2cff; + + /* Muted */ + --bg-pfl-color: #3f5b40ff; + --bg-pfl-dark-green: #2f3831ff; + --bg-pfl-grey: #7b7166; + --bg-pfl-brown: #c4a58fff; + --bg-pfl-orange: #d96513ff; + --pfl-primary-bg-subtle: #cbf7cd; --pfl-primary-text: var(--bg-pfl-color); --pfl-primary-border-subtle: #6db770; @@ -11,8 +23,21 @@ } :root[data-bs-theme='dark'] { - --pfl-primary-bg-subtle: #183119; - --pfl-primary-text: #5aac5d; + /* Primary */ + --pfl-color: #8eb57b; + --pfl-dark-green: #4c6e4dff; + --pfl-grey: #bbbbbb; + --pfl-brown: #8f7e6b; + --pfl-orange: #d3a569ff; + + /* Muted */ + --bg-pfl-color: #728f64; + --bg-pfl-dark-green: #3d583e; + --bg-pfl-grey: #9b9b9b; + --bg-pfl-brown: #7d6e5d; + --bg-pfl-orange: #c98f44ff; + + --pfl-primary-text: var(--pfl-color); --pfl-primary-border-subtle: var(--pfl-color); --bs-heading-color: #fff; --pfl-logo: url('/static/dark.png'); @@ -20,20 +45,22 @@ } .btn-pfl { - --bs-btn-color: #fff; + --bs-btn-color: var(--bs-body-bg); + --bs-btn-hover-color: var(--bs-body-bg); --bs-btn-bg: var(--pfl-color); --bs-btn-border-color: var(--pfl-color); - --bs-btn-hover-color: #fff; - --bs-btn-hover-bg: #117314; - --bs-btn-hover-border-color: var(--pfl-color); + --bs-btn-hover-bg: var(--bg-pfl-color); + --bs-btn-hover-border-color: var(--bg-pfl-color); --bs-btn-focus-shadow-rgb: 49, 132, 253; - --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--pfl-color); - --bs-btn-active-border-color: #0a53be; --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); - --bs-btn-disabled-color: #fff; - --bs-btn-disabled-bg: var(--pfl-color); - --bs-btn-disabled-border-color: var(--pfl-color); +} + +.btn-pfl-secondary { + --bs-btn-bg: var(--pfl-brown); + --bs-btn-hover-bg: var(--bg-pfl-brown); + --bs-btn-color: var(--bs-heading-color); + --bs-btn-hover-color: var(--bs-heading-color); } .bg-pfl { @@ -98,4 +125,38 @@ a { background-repeat: no-repeat; background-position: center; background-size: contain; +} + +.pfl-plnt { + background-color: var(--pfl-color); + color: var(--bs-body-bg); +} + +.pfl-seed { + background-color: var(--pfl-dark-green); +} + +.pfl-pot { + background-color: var(--pfl-brown); + color: var(--bs-heading-color); +} + +.pfl-tool { + background-color: var(--pfl-grey); + color: var(--bs-body-bg); +} + +.pfl-othr { + background-color: var(--bs-heading-color); + color: var(--bs-body-bg); +} + +.btn-danger { + --bs-btn-color: var(--bs-body-bg); + --bs-btn-bg: var(--pfl-orange); + --bs-btn-hover-color: var(--bs-body-bg); + --bs-btn-border-color: var(--pfl-orange); + --bs-btn-hover-bg: var(--bg-pfl-orange); + --bs-btn-hover-border-color: var(--bg-pfl-orange); + --bs-btn-active-bg: var(--pfl-orange); } \ No newline at end of file diff --git a/pflaenzli/pflaenzli/templates/403.html b/pflaenzli/pflaenzli/templates/403.html index 75dc473..6fe8c33 100644 --- a/pflaenzli/pflaenzli/templates/403.html +++ b/pflaenzli/pflaenzli/templates/403.html @@ -1,7 +1,7 @@ {% extends 'base.html' %} {% load i18n %} {% block title %} - {% trans "Not found" %} + {% trans "Forbidden" %} {% endblock title %} {% block content %}
@@ -13,6 +13,6 @@

{% trans "What now?" %}

{% trans "Go home" %} - {% trans "Report error" %} + {% trans "Report error" %}
{% endblock content %} diff --git a/pflaenzli/pflaenzli/templates/403_csrf.html b/pflaenzli/pflaenzli/templates/403_csrf.html index 541ecb2..a448edc 100644 --- a/pflaenzli/pflaenzli/templates/403_csrf.html +++ b/pflaenzli/pflaenzli/templates/403_csrf.html @@ -1,7 +1,7 @@ {% extends 'base.html' %} {% load i18n %} {% block title %} - {% trans "Not found" %} + {% trans "Forbidden" %} {% endblock title %} {% block content %}
@@ -13,6 +13,6 @@

{% trans "What now?" %}

{% trans "Go home" %} - {% trans "Report error" %} + {% trans "Report error" %}
{% endblock content %} diff --git a/pflaenzli/pflaenzli/templates/404.html b/pflaenzli/pflaenzli/templates/404.html index ab7fa5d..ed0b68f 100644 --- a/pflaenzli/pflaenzli/templates/404.html +++ b/pflaenzli/pflaenzli/templates/404.html @@ -13,6 +13,6 @@

{% trans "What now?" %}

{% trans "Go home" %} - {% trans "Report error" %} + {% trans "Report error" %} {% endblock content %} diff --git a/pflaenzli/pflaenzli/templates/500.html b/pflaenzli/pflaenzli/templates/500.html index 79184d8..03bd578 100644 --- a/pflaenzli/pflaenzli/templates/500.html +++ b/pflaenzli/pflaenzli/templates/500.html @@ -1,18 +1,18 @@ {% extends 'base.html' %} {% load i18n %} {% block title %} - {% trans "Not found" %} + {% trans "Server error" %} {% endblock title %} {% block content %}

- Error 500 {% trans "Forbidden" %} + Error 500 {% trans "Server error" %}

{% blocktrans %}Uh-oh! The delicate balance of the botanical realms has been disrupted. The forces of nature are in disarray, and our plant guardians are diligently working to restore harmony. We apologize for any inconvenience caused during this mystical turbulence. Please bear with us as we channel our magic to mend the rupture. Please contact us, if you have any information that could help to dispel the dark magic!{% endblocktrans %}

{% trans "What now?" %}

{% trans "Go home" %} - {% trans "Report error" %} + {% trans "Report error" %}
{% endblock content %} diff --git a/pflaenzli/pflaenzli/templates/app/faq.html b/pflaenzli/pflaenzli/templates/app/faq.html index d43616e..57bf1ef 100644 --- a/pflaenzli/pflaenzli/templates/app/faq.html +++ b/pflaenzli/pflaenzli/templates/app/faq.html @@ -1,5 +1,7 @@ {% extends 'base.html' %} -{% block title %}Privacy Policy{% endblock %} +{% load i18n %} +{% block title %}FAQ{% endblock %} +{% block meta %}{% endblock %} {% block content %}

Frequently Asked Questions

Is it free?

diff --git a/pflaenzli/pflaenzli/templates/app/imprint.html b/pflaenzli/pflaenzli/templates/app/imprint.html index 38708cc..757ef73 100644 --- a/pflaenzli/pflaenzli/templates/app/imprint.html +++ b/pflaenzli/pflaenzli/templates/app/imprint.html @@ -1,5 +1,11 @@ {% extends 'base.html' %} -{% block title %}Privacy Policy{% endblock %} +{% load i18n %} +{% block title %} + {% trans 'Imprint' %} +{% endblock %} +{% block meta %} + +{% endblock %} {% block content %}

Privacy Policy

diff --git a/pflaenzli/pflaenzli/templates/app/index.html b/pflaenzli/pflaenzli/templates/app/index.html index c3acfd1..ce5e1ab 100644 --- a/pflaenzli/pflaenzli/templates/app/index.html +++ b/pflaenzli/pflaenzli/templates/app/index.html @@ -2,7 +2,10 @@ {% load static %} {% load i18n %} {% block title %}Home{% endblock %} -{% block meta %}{% endblock %} +{% block meta %} + +{% endblock %} {% block background %}home-background{% endblock %} {% block content %}

@@ -20,7 +23,7 @@ class="btn btn-pfl btn-lg mb-3" type="button">{% trans "Show offers" %} {% trans "Register" %}
diff --git a/pflaenzli/pflaenzli/templates/base.html b/pflaenzli/pflaenzli/templates/base.html index 66ec25a..cf44b72 100644 --- a/pflaenzli/pflaenzli/templates/base.html +++ b/pflaenzli/pflaenzli/templates/base.html @@ -4,9 +4,12 @@ Pflänz.li - - {% block title %}{% endblock %} + {% block title %} + {% endblock title %} + {% block meta %} + {% endblock meta %}
-

{{ offer.title }}

+

+ {{ offer.title }}{{ offer.get_category_display }} +

@@ -66,7 +68,7 @@