Procházet zdrojové kódy

postleitzahl; urls in german

Juan Carlos před 4 roky
rodič
revize
e5d33eb155

+ 11 - 2
marktplatz/forms.py

@@ -238,7 +238,7 @@ class SignUpForm(UserCreationForm):
 class ProductForm(forms.ModelForm, GeneralFields):
 
     # terms = forms.BooleanField(required=True,  label= ('Ich habe die Teilnahmebedingungen gelesen und akzeptiert.'))
-    product_fields = ( 'terms', 'name','claim','beschreibung','learning','gruendungsjahr','betriebgenommen','status','adresse','website','email','frei','kfrei','ort','rechtsform','orga','mitmachen','edit','public', )
+    product_fields = ( 'terms', 'name','claim','beschreibung','learning','gruendungsjahr','betriebgenommen','status','adresse', 'adresse_zusatz', 'plz', 'website','email','frei','kfrei','ort','rechtsform','orga','mitmachen','edit','public', )
     product_layout = Layout(
         Fieldset(
             ('Über dein Projekt'),
@@ -250,8 +250,13 @@ class ProductForm(forms.ModelForm, GeneralFields):
             'learning','status',
            Div(
                Div('adresse',  css_class='col-sm-6 col-6'),
+               Div('adresse_zusatz', css_class='col-sm-6 col-6'),
+               css_class='form-row  row'),
+           Div(
+               Div('plz',  css_class='col-sm-6 col-6'),
                Div('ort', css_class='col-sm-6 col-6'),
                css_class='form-row  row'),
+
            'rechtsform','orga',
            Div(
                Div('website',  css_class='col-sm-6 col-6'),
@@ -291,10 +296,14 @@ class ProductForm(forms.ModelForm, GeneralFields):
        self.helper.form_tag = False
 
 
+class MobilitaetsForm(ProductForm):
+
+    pass
+    
 
 class WohnprojektForm(ProductForm):
 
-    terms = forms.BooleanField(required=True,  label= ('Ich habe die Teilnahmebedingungen gelesen und akzeptiert.'))
+    # terms = forms.BooleanField(required=True,  label= ('Ich habe die Teilnahmebedingungen gelesen und akzeptiert.'))
 
 
     class Meta:

+ 8 - 1
marktplatz/models.py

@@ -149,7 +149,7 @@ class Product(models.Model):
     betriebgenommen = IntegerField( 'in Betrieb genommen im Jahr', default='2020', help_text="Wann wurde das Haus bezogen?", validators=[MinValueValidator(0), MaxValueValidator(9999)], null = True, blank=True )
     status          = CharField   ( 'Status',    max_length = 3,    choices=STATUS, default='ENT', help_text='Wähle aus der Liste aus! ("In Betrieb" bedeutet in diesem Fall "das Haus ist bezogen". "Abgeschlossen" würde bedeuten dass es das Projekt gar nicht mehr gibt.' , null = True, blank=True )
     adresse         = CharField   ( 'Adresse',   max_length = 256,  help_text="Beispiel: Gisela-Legath-Gasse 5", null = True, blank=True )
-    plz             = CharField   ( 'Adresse',   max_length = 64,  help_text="PLZ des Projektes", null = True, blank=True )
+    plz             = CharField   ( 'Postleitzahl',   max_length = 64,  help_text="PLZ des Projektes", null = True, blank=True )
     adresse_zusatz  = CharField   ( 'Adresse Zusatz',   max_length = 128,  help_text="Adresse Zusatz", null = True, blank=True )
     ort             = CharField   ( 'Ort',        max_length = 4, choices=ORT, default='WELT', help_text="Beispiel: Wien, 22", null = True, blank=True )
     website         = URLField    ( 'Website',   max_length = 2048, help_text="Beispiel: https://seestern-aspern.at/", null = True, blank=True )
@@ -214,6 +214,13 @@ class SearchAgent(models.Model):
     hash            = CharField          ( max_length=255, default=hash_gen )
 
 
+class Mobilityprojekt(Product):
+    pass
+
+    @property
+    def kind_of_product(self):
+            return "Mobilitätsprojekt"
+
 
 class Wohnprojekt(Product):
 

+ 8 - 5
marktplatz/templates/marktplatz/product_detail.html

@@ -195,7 +195,7 @@
 					<h5 class=" mediumkur">Kontakt</h5>
 					<br />
 
-					<p>{{ product.wohnprojekt.adresse }}, {{ product.wohnprojekt.get_ort_display }}</p>
+					<p>{{ product.wohnprojekt.adresse }}{% if product.wohnprojekt.adresse_zusatz  %},	{{ product.wohnprojekt.adresse_zusatz }}{% endif %}{% if product.wohnprojekt.plz  %}, {{ product.wohnprojekt.plz }}{% endif %}{% if product.wohnprojekt.ort %}, {{ product.wohnprojekt.get_ort_display }}{% endif %}</p>
 
 					<div class="row">
 							<div class="col-sm-4">
@@ -233,11 +233,9 @@
 					<p>{% if product.wohnprojekt.orga  %}<strong>{% field_name product.wohnprojekt 'orga' %}</strong>: {{ product.wohnprojekt.orga }}{% endif %}</p>
 					<p>{% if product.wohnprojekt.eigentum  %}<strong>{% field_name product.wohnprojekt 'eigentum' %}</strong>: {{ product.wohnprojekt.get_eigentum_display }}{% endif %}</p>
 					<p>{% if product.wohnprojekt.gprojekte  %}<strong>Gemeinschaftliche Projekte</strong>: {{ product.wohnprojekt.gprojekte }}{% endif %}</p>
-					<p><strong>Gemeinschaftsräume</strong>:
-						{{ product.wohnprojekt.gemeinschaftr }}{% if product.wohnprojekt.kgemeinschaftr  %}, {{ product.wohnprojekt.kgemeinschaftr }}{% endif %}
-					</p>
 
-					<p>{% if product.wohnprojekt.sonderwohnformen  %}<strong>{% field_name product.wohnprojekt 'sonderwohnformen' %}</strong>: {{ product.wohnprojekt.sonderwohnformen }}{% endif %}</p>
+
+
 					<p>{% if product.wohnprojekt.zielgruppen  %}<strong>Besondere Zielgruppen</strong>: {{ product.wohnprojekt.zielgruppen }}{% endif %}</p>
 					<p>{% if product.wohnprojekt.freiraumangebote  %}<strong>Freiraumangebote</strong>: {{ product.wohnprojekt.freiraumangebote }}{% endif %}</p>
 					<p>{% if product.wohnprojekt.oekologie  %}<strong>{% field_name product.wohnprojekt 'oekologie' %}</strong>: {{ product.wohnprojekt.oekologie }}{% endif %}</p>
@@ -252,15 +250,20 @@
 					<p><strong>Bautr&auml;ger</strong>: {{ product.wohnprojekt.bautraeger }}</p>
 					<p>{% if product.wohnprojekt.architektur  %}<strong>{% field_name product.wohnprojekt 'architektur' %}:</strong>  {{  product.wohnprojekt.architektur  }}{% endif %}</p>
 					<p>{% if product.wohnprojekt.wohnbaufoerderung  %}<strong>{% field_name product.wohnprojekt 'wohnbaufoerderung' %}:</strong>  {{ product.wohnprojekt.wohnbaufoerderung }}{% endif %}</p>
+
 					<p>im Haus Wohnen ca {{ product.wohnprojekt.aerwachsene }} Erwachsene und {{  product.wohnprojekt.akinder }} Kinder.
 						Anzahl der Mitglieder: {{ product.wohnprojekt.amitglieder }}
 					</p>
 					<p>{% if product.wohnprojekt.awohnungen  %}<strong>{% field_name product.wohnprojekt 'awohnungen' %}:</strong>  {{  product.wohnprojekt.awohnungen  }} Wohnungen{% endif %}</p>
 					<p>{% if product.wohnprojekt.gaestwohnungen  %}<strong>{% field_name product.wohnprojekt 'gaestwohnungen' %}:</strong>  {{ product.wohnprojekt.gaestwohnungen }}{% endif %}</p>
 					<p>{% if product.wohnprojekt.wohnflaeche  %}<strong>{% field_name product.wohnprojekt 'wohnflaeche' %}:</strong>  {{ product.wohnprojekt.wohnflaeche }} m<sup>2</sup>{% endif %}</p>
+					<p>{% if product.wohnprojekt.sonderwohnformen  %}<strong>{% field_name product.wohnprojekt 'sonderwohnformen' %}</strong>: {{ product.wohnprojekt.sonderwohnformen }}{% endif %}</p>
 			    <p>{% if product.wohnprojekt.gewerbeflaechen  %}<strong>{% field_name product.wohnprojekt 'gewerbeflaechen' %}:</strong>  {{ product.wohnprojekt.gewerbeflaechen }} m<sup>2</sup>{% endif %}</p>
 			    <p>{% if product.wohnprojekt.gewerbe %}<strong>{% field_name product.wohnprojekt 'gewerbe' %}:</strong>  {{ product.wohnprojekt.gewerbe }}{% endif %}</p>
 			    <p>{% if product.wohnprojekt.gemeinschaftsflaeche  %}<strong>{% field_name product.wohnprojekt 'gemeinschaftsflaeche' %}:</strong>  {{ product.wohnprojekt.gemeinschaftsflaeche }} m<sup>2</sup>{% endif %}</p>
+					<p><strong>Gemeinschaftsräume</strong>:
+						{{ product.wohnprojekt.gemeinschaftr }}{% if product.wohnprojekt.kgemeinschaftr  %}, {{ product.wohnprojekt.kgemeinschaftr }}{% endif %}
+					</p>
 			    <p>{% if product.wohnprojekt.sonstige_flaechen  %}<strong>{% field_name product.wohnprojekt 'sonstige_flaechen' %}:</strong>  {{ product.wohnprojekt.sonstige_flaechen }} m<sup>2</sup>{% endif %}</p>
 			    <p>{% if product.wohnprojekt.flaeche  %}<strong>{% field_name product.wohnprojekt 'flaeche' %}:</strong>  {{ product.wohnprojekt.flaeche }} m<sup>2</sup>{% endif %}</p>
 					<p>{% if product.wohnprojekt.kflaechen  %}<strong>{% field_name product.wohnprojekt 'kflaechen' %}:</strong>  {{ product.wohnprojekt.kflaechen }} m<sup>2</sup>{% endif %}</p>

+ 3 - 2
marktplatz/urls.py

@@ -29,8 +29,9 @@ urlpatterns = [
     path('admin_panel/', views.AdminView.as_view(), name='admin-panel'),
     # path('light-box/', lightboximg.as_view(template_name="mab18/importold.html"),name='lightbox'),
     path('register/', views.registerView.as_view(), name='register-view'),
-    path('addProduct/', views.NewWohnprojektView.as_view(), name='new-submit-view'),
-    path('myProducts/', views.UsersProducts.as_view(), name='my-products'),
+    path('neues-wohnprojekt/', views.NewWohnprojektView.as_view(), name='new-submit-view'),
+    path('neues-mobilitaetsprojekt/', views.NewWohnprojektView.as_view(), name='new-submit-view'),
+    path('meine-projekte/', views.UsersProducts.as_view(), name='my-products'),
     path('editProduct/<int:pk>', views.EditView.as_view(), name='edit-product'),
     path('addImage/<int:pk>', views.uploadView.as_view(), name='add-Image'),
     # path('generic-test/', views.genericView.as_view(), name='generic-test'),

+ 3 - 3
marktplatz/views.py

@@ -699,7 +699,7 @@ class NewProductView(LoginRequiredMixin, FormView):
     model = Product
 
 class NewWohnprojektView(LoginRequiredMixin, FormView):
-    use_ajax = True
+    # use_ajax = True
     template_name = 'marktplatz/add.html'
 
     model = Product
@@ -710,7 +710,7 @@ class NewWohnprojektView(LoginRequiredMixin, FormView):
 
         context = request.GET.dict()
         context['product'] =        WohnprojektForm
-        context['use_ajax'] = True
+        # context['use_ajax'] = True
         context['info_txt'] = Template(config.INFO_TXT).render(Context(context))
 
 
@@ -744,7 +744,7 @@ class NewWohnprojektView(LoginRequiredMixin, FormView):
             context = request.POST.dict()
             context['product'] =        product_f
             context['product_errors']  = product_f.errors
-            context['use_ajax'] = True
+            # context['use_ajax'] = True
             return render(request, self.template_name, context)