diff --git a/clients/urls.py b/clients/urls.py
index 4ed5ae4..8dc9ac0 100644
--- a/clients/urls.py
+++ b/clients/urls.py
@@ -1,10 +1,11 @@
from django.urls import path
-from .views import ClientRegistrationView, ClientProfileView
+from .views import ClientRegistrationView, ClientProfileView, ClientDashboardView
app_name = "clients"
urlpatterns = [
+ path('dashboard/', ClientDashboardView.as_view(), name="dashboard"),
path('register/', ClientRegistrationView.as_view(), name="register"),
path('profile/', ClientProfileView.as_view(), name="profile"),
]
\ No newline at end of file
diff --git a/clients/views.py b/clients/views.py
index e5ccdef..688db5c 100644
--- a/clients/views.py
+++ b/clients/views.py
@@ -1,4 +1,4 @@
-from django.views.generic import CreateView, UpdateView
+from django.views.generic import CreateView, UpdateView, TemplateView
from django.urls import reverse_lazy
from django.shortcuts import redirect
from django.contrib import messages
@@ -56,4 +56,7 @@ class ClientProfileView(InConstructionMixin, LoginRequiredMixin, UpdateView):
try:
return super().get(request, *args, **kwargs)
except ClientProfile.DoesNotExist:
- return redirect("clients:register")
\ No newline at end of file
+ return redirect("clients:register")
+
+class ClientDashboardView(InConstructionMixin, LoginRequiredMixin, TemplateView):
+ template_name = "clients/dashboard.html"
\ No newline at end of file
diff --git a/localauth/helpers.py b/localauth/helpers.py
index 35e2d07..88bbf10 100644
--- a/localauth/helpers.py
+++ b/localauth/helpers.py
@@ -2,6 +2,8 @@ from django.conf import settings
from geopy.geocoders import Nominatim
+import uuid
+
def name_to_coords(name):
geocoder = Nominatim(user_agent="JourneyJoker.at")
@@ -10,4 +12,7 @@ def name_to_coords(name):
return result.latitude, result.longitude
def profile_to_coords(profile):
- return name_to_coords("%s, %s, %s, %s" % (profile.address, profile.city, profile.zip, profile.country))
\ No newline at end of file
+ return name_to_coords("%s, %s, %s, %s" % (profile.address, profile.city, profile.zip, profile.country))
+
+def upload_path(instance, filename):
+ return f'userfiles/{instance.user.id}/{uuid.uuid4()}/{filename}'
\ No newline at end of file
diff --git a/localauth/models.py b/localauth/models.py
index 5163bf9..7e3e3da 100644
--- a/localauth/models.py
+++ b/localauth/models.py
@@ -6,7 +6,7 @@ from django.utils import timezone
from django_countries.fields import CountryField
-from .helpers import profile_to_coords
+from .helpers import profile_to_coords, upload_path
class UserManager(BaseUserManager):
use_in_migrations = True
@@ -70,6 +70,10 @@ class AddressMixin(models.Model):
state = models.CharField(max_length=64, null=True, blank=True)
country = CountryField()
+ @property
+ def full_address(self):
+ return f"{self.street}, {self.city}, {self.zip}, {self.state}, {self.country}"
+
class Meta:
abstract = True
@@ -85,7 +89,13 @@ class LocationMixin(AddressMixin):
class Meta:
abstract = True
-class Profile(AddressMixin, models.Model):
+class ImageMixin(models.Model):
+ image = models.ImageField(upload_to=upload_path)
+
+ class Meta:
+ abstract = True
+
+class Profile(AddressMixin):
user = models.OneToOneField(User, models.CASCADE)
company = models.CharField(max_length=64, null=True, blank=True)
vat_id = models.CharField(max_length=32, null=True, blank=True)
diff --git a/partners/models.py b/partners/models.py
index 4708793..85156c9 100644
--- a/partners/models.py
+++ b/partners/models.py
@@ -1,19 +1,20 @@
from django.contrib.gis.db import models
-from localauth.models import User, Profile, LocationMixin
+from localauth.models import User, Profile, LocationMixin, ImageMixin
from django_countries.fields import CountryField
class PartnerProfile(Profile):
pass
-class Establishment(LocationMixin, models.Model):
+class Establishment(LocationMixin, ImageMixin):
owner = models.ForeignKey(PartnerProfile, models.CASCADE)
name = models.CharField(max_length=64)
stars = models.IntegerField(null=True, blank=True)
superior = models.BooleanField(default=False)
verified = models.BooleanField(default=False)
-class RoomCategory(models.Model):
+class RoomCategory(ImageMixin):
establishment = models.ForeignKey(Establishment, models.CASCADE)
- name = models.CharField(max_length=64)
\ No newline at end of file
+ name = models.CharField(max_length=64)
+ price = models.DecimalField(max_digits=10, decimal_places=2)
\ No newline at end of file
diff --git a/templates/clients/base.html b/templates/clients/base.html
new file mode 100644
index 0000000..129eb8c
--- /dev/null
+++ b/templates/clients/base.html
@@ -0,0 +1,37 @@
+{% extends "frontend/base.html" %}
+{% block "content" %}
+
+ Servus {{ request.user.get_full_name }}, willkommen in deinem JourneyJoker-Profil! Hier siehst du all deine gebuchten Reisen und kannst deine Daten verwalten!Dein Profil
+
Bewertungen
+Euro
+Städte
+Reisen
++ | Deine Bewertung für Habbo Hotel wurde freigeschaltet! | ++ |
+ | Wie war dein Aufenthalt bei Habbo Hotel? Gib eine Bewertung ab! | ++ |
+ | Deine Buchung war erfolgreich! Mehr Details zu deinem Aufenthalt bei Habbo Hotel! | ++ |
+ | Du hast Angebote zu deiner Reiseanfrage erhalten! Jetzt ansehen? | ++ |
+ | Deine Reiseanfrage wurde freigeschaltet! Bald wirst du erste Angebote erhalten! | ++ |
+ |
+ Reiseanfrage+
|
+ + |