diff --git a/README.md b/README.md index e557514..d84db1e 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ You have to bring your own PostgreSQL Database though. ## Setup, Installation, Updating and Dependencies -see [Setup](docs/Setup.md) +You can find the latest releases [here](https://gitlab.com/W13R/drinks-manager/-/releases), but for Installation/Updating, you should consider using Git. +For more information see [Setup](docs/Setup.md). ## Configuration @@ -28,17 +29,3 @@ see [Configuration](docs/Configuration.md) After setup, run ```./run.sh help``` to see a help text. Start the production server with ```./run.sh server```. You can ignore the error message about the "lifespan error". For more commands, see [Commands](docs/Commands.md). - - -## Versions - -You can find the latest releases [here](https://gitlab.com/W13R/drinks-manager/-/releases). -For Installation/Updating, you should consider using git, -though (for more information see [Setup](docs/Setup.md)). - -The releases are versioned after the following scheme: - -`MAJOR`.`MINOR` - -- `MAJOR`: may include **breaking changes** and/or significant new features -- `MINOR`: will only include bugfixes and smaller, **non-breaking changes** diff --git a/application/app/admin.py b/application/app/admin.py index c3b7b20..66b072a 100644 --- a/application/app/admin.py +++ b/application/app/admin.py @@ -66,7 +66,7 @@ class CustomDrinkAdmin(admin.ModelAdmin): model = Drink form = CustomDrinkForm - list_display = ["product_name", "content_litres", "price", "available", "binary_availability", "deleted"] + list_display = ["product_name", "content_litres", "price", "available", "do_not_count", "deleted"] adminSite.register(Drink, CustomDrinkAdmin) diff --git a/application/app/forms.py b/application/app/forms.py index 6f14d23..6dc4900 100644 --- a/application/app/forms.py +++ b/application/app/forms.py @@ -26,7 +26,7 @@ class CustomDrinkForm(forms.ModelForm): class Meta: model = Drink - fields = ("product_name", "content_litres", "price", "binary_availability", "available", "deleted") + fields = ("product_name", "content_litres", "price", "do_not_count", "available", "deleted") class CustomRegisterTransactionForm(forms.ModelForm): diff --git a/application/app/models.py b/application/app/models.py index 2e544dc..95692b0 100644 --- a/application/app/models.py +++ b/application/app/models.py @@ -41,10 +41,11 @@ class Drink(models.Model): available = models.PositiveIntegerField(default=0) deleted = models.BooleanField(default=False) - # when the following field is true: + # when the following field is true, the amount of drinks will + # not change and will not be displayed. # available > 0 -> there is a indefinetly amount of drinks left # available < 1 -> there are no drinks left - binary_availability = models.BooleanField(default=False) + do_not_count = models.BooleanField(default=False) def delete(self, *args, **kwargs): self.deleted = True @@ -123,7 +124,7 @@ class Order(models.Model): def save(self, *args, **kwargs): drink = Drink.objects.get(pk=self.drink.pk) if self._state.adding and drink.available > 0: - if not drink.binary_availability: + if not drink.do_not_count: drink.available -= self.amount drink.save() self.product_name = drink.product_name @@ -139,7 +140,7 @@ class Order(models.Model): self.user.balance += self.price_sum self.user.save() drink = Drink.objects.get(pk=self.drink.pk) - if not drink.binary_availability: + if not drink.do_not_count: drink.available += self.amount drink.save() super().delete(*args, **kwargs) diff --git a/application/app/templates/index.html b/application/app/templates/index.html index d8d8b71..c639390 100644 --- a/application/app/templates/index.html +++ b/application/app/templates/index.html @@ -20,7 +20,7 @@