From 63c257e68b057501d90c348019c1cc4befd3f8bf Mon Sep 17 00:00:00 2001 From: Kumi Date: Sat, 29 Oct 2022 17:04:02 +0000 Subject: [PATCH] Current changes --- .gitignore | 1 + auction/views.py | 5 ++++- frontend/templatetags/mapimage.py | 2 +- partners/models.py | 21 +++++++++++++-------- payment/models/invoice.py | 3 ++- templates/auction/bidding_list.html | 5 +++-- 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 0eac599..0f25de9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ venv/ db.sqlite3 localsettings.py uwsgi.local.sh +config.ini \ No newline at end of file diff --git a/auction/views.py b/auction/views.py index e926a11..a04fa53 100644 --- a/auction/views.py +++ b/auction/views.py @@ -15,6 +15,8 @@ from partners.models import Establishment from payment.models import BillingAddress, Invoice, InvoiceItem, InvoicePayment from clients.models import ClientProfile +from payment.demo.models import DemoInvoicePayment # TODO: Remove when no longer needed + from .models import Inquiry, Offer from .forms import InquiryProcessForm, OfferSelectionForm @@ -94,7 +96,8 @@ class InquiryPaymentView(View): invoice = inquiry.invoice except Invoice.DoesNotExist: invoice = Invoice.from_inquiry(inquiry) - payment_url = InvoicePayment.from_invoice(invoice, inquiry.gateway) + # payment_url = InvoicePayment.from_invoice(invoice, inquiry.gateway) # TODO: Make this work again + payment_url = DemoInvoicePayment.initiate(invoice) if not payment_url: messages.error(request, "Die Zahlung ist leider fehlgeschlagen. Versuche es bitte nochmals!") diff --git a/frontend/templatetags/mapimage.py b/frontend/templatetags/mapimage.py index 3955e90..976959b 100644 --- a/frontend/templatetags/mapimage.py +++ b/frontend/templatetags/mapimage.py @@ -11,7 +11,7 @@ register = template.Library() @register.simple_tag def mapimage(location, zoom=7, width=348, height=250): - smap = StaticMap(width, height, url_template="http://a.tile.osm.org/{z}/{x}/{y}.png") + smap = StaticMap(width, height, url_template="https://tile.openstreetmap.de/{z}/{x}/{y}.png") marker = CircleMarker((location.x, location.y), color="orange", width=20) smap.add_marker(marker) image = smap.render(zoom) diff --git a/partners/models.py b/partners/models.py index f6b107f..21be9c2 100644 --- a/partners/models.py +++ b/partners/models.py @@ -49,15 +49,20 @@ class RoomCategory(GalleryMixin): rooms = models.IntegerField(default=0) active = models.BooleanField(default=True) - def average_price(self, date=None): - dobj = timezone.datetime.strptime(date, "%Y-%m-%d") if date else timezone.now() + # TODO: Pricing via Pricing objects - return RoomCategoryPricing.for_date(self, dobj).average_price - - def minimum_price(self, date=None): - dobj = timezone.datetime.strptime(date, "%Y-%m-%d") if date else timezone.now() - - return RoomCategoryPricing.for_date(self, dobj).minimum_price + average_price = models.DecimalField(max_digits=12, decimal_places=2) + minimum_price = models.DecimalField(max_digits=12, decimal_places=2, default=0) + +# def average_price(self, date=None): +# dobj = timezone.datetime.strptime(date, "%Y-%m-%d") if date else timezone.now() +# +# return RoomCategoryPricing.for_date(self, dobj).average_price +# +# def minimum_price(self, date=None): +# dobj = timezone.datetime.strptime(date, "%Y-%m-%d") if date else timezone.now() +# +# return RoomCategoryPricing.for_date(self, dobj).minimum_price class RoomCategoryPricing(models.Model): roomcategory = models.ForeignKey(RoomCategory, models.CASCADE) diff --git a/payment/models/invoice.py b/payment/models/invoice.py index 02fc37b..0abe469 100644 --- a/payment/models/invoice.py +++ b/payment/models/invoice.py @@ -88,7 +88,8 @@ class Invoice(models.Model): bottom_tip += "Dokument erstellt: %s" % str(timezone.now()) args = { - "type": InvoiceTypeChoices._value2label_map_[self.type], + # "type": InvoiceTypeChoices._value2label_map_[self.type], # TODO: Make this work again + "type": "Rechnung", "object": self, "bottom_tip": bottom_tip } diff --git a/templates/auction/bidding_list.html b/templates/auction/bidding_list.html index 53599ac..1630b4a 100644 --- a/templates/auction/bidding_list.html +++ b/templates/auction/bidding_list.html @@ -2,6 +2,7 @@ {% load i18n %} {% load bootstrap4 %} {% load static %} +{% load distance %} {% block "styles" %} @@ -30,10 +31,10 @@ Gebotener Betrag - {% for inquiry in object_list %}{% if inquiry.is_paid and inquiry.destination_radius == 0 or inquiry.distance.m < inquiry.destination_radius %} + {% for inquiry in object_list %}{% distance inquiry.destination_coords establishment.coords as distance %}{% if inquiry.is_paid and inquiry.destination_radius == 0 or distance < inquiry.destination_radius %} {{ inquiry.id }} - {{ inquiry.destination_name }} ({{ inquiry.distance.km | floatformat:1 }}km) + {{ inquiry.destination_name }} ({{ distance | floatformat:0 }}m) {{ inquiry.arrival }} {% if inquiry.min_nights == 0 %}Egal!{% elif inquiry.min_nights == 1 %}Kurztrip (2-3 Nächte){% else %}Min. 3 Nächte{% endif %} {{ inquiry.adults }} + {{ inquiry.children }}