|
@@ -328,6 +328,8 @@ class ProductsView(generic.ListView):
|
|
|
context['status_list'] = Product.STATUS
|
|
context['status_list'] = Product.STATUS
|
|
|
context['sponsor_cards'] = Template( config.SPONSOR_CARDS ).render( Context(context) )
|
|
context['sponsor_cards'] = Template( config.SPONSOR_CARDS ).render( Context(context) )
|
|
|
context['main_card'] = Template( config.MAIN_CARD ).render( Context(context) )
|
|
context['main_card'] = Template( config.MAIN_CARD ).render( Context(context) )
|
|
|
|
|
+ context['type'] = 'BASE'
|
|
|
|
|
+
|
|
|
context['textSearchForm'] = textSearchForm()
|
|
context['textSearchForm'] = textSearchForm()
|
|
|
|
|
|
|
|
return context
|
|
return context
|
|
@@ -338,37 +340,53 @@ class WohnprojekteView(ProductsView):
|
|
|
context_object_name = 'object_list'
|
|
context_object_name = 'object_list'
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs):
|
|
def get_context_data(self, **kwargs):
|
|
|
- context = super().get_context_data(**kwargs)
|
|
|
|
|
|
|
+ context = super().get_context_data(**kwargs)
|
|
|
|
|
|
|
|
- raum_agebote = {}
|
|
|
|
|
|
|
+ raum_agebote = {}
|
|
|
|
|
|
|
|
- for product in context['object_list']:
|
|
|
|
|
- for raum in product.raumangebot:
|
|
|
|
|
- if not (raum in raum_agebote):
|
|
|
|
|
- raum_agebote[raum] = product.raumangebot.choices[raum]
|
|
|
|
|
|
|
+ for product in context['object_list']:
|
|
|
|
|
+ for raum in product.raumangebot:
|
|
|
|
|
+ if not (raum in raum_agebote):
|
|
|
|
|
+ raum_agebote[raum] = product.raumangebot.choices[raum]
|
|
|
|
|
|
|
|
- context['raum_agebote_dict'] = raum_agebote
|
|
|
|
|
- context['frei_list'][0] = ('JAJA', 'Platz frei')
|
|
|
|
|
- context['altneu_list'] = Wohnprojekt.ALTNEU
|
|
|
|
|
|
|
+ context['raum_agebote_dict'] = raum_agebote
|
|
|
|
|
+ context['frei_list'][0] = ('JAJA', 'Platz frei')
|
|
|
|
|
+ context['altneu_list'] = Wohnprojekt.ALTNEU
|
|
|
|
|
+ context['type'] = 'WOHN'
|
|
|
|
|
|
|
|
- return context
|
|
|
|
|
|
|
+ return context
|
|
|
|
|
|
|
|
class MobilitaetsProjekteView(ProductsView):
|
|
class MobilitaetsProjekteView(ProductsView):
|
|
|
model = MobilitaetsProjekt
|
|
model = MobilitaetsProjekt
|
|
|
template_name = 'marktplatz/product_overview.html'
|
|
template_name = 'marktplatz/product_overview.html'
|
|
|
context_object_name = 'object_list'
|
|
context_object_name = 'object_list'
|
|
|
|
|
|
|
|
|
|
+ def get_context_data(self, **kwargs):
|
|
|
|
|
+ context = super().get_context_data(**kwargs)
|
|
|
|
|
+ context['type'] = 'MOBI'
|
|
|
|
|
+ return context
|
|
|
|
|
+
|
|
|
|
|
|
|
|
class ErnaerungsProjekteView(ProductsView):
|
|
class ErnaerungsProjekteView(ProductsView):
|
|
|
model = ErnaehrungsProjekt
|
|
model = ErnaehrungsProjekt
|
|
|
template_name = 'marktplatz/product_overview.html'
|
|
template_name = 'marktplatz/product_overview.html'
|
|
|
context_object_name = 'object_list'
|
|
context_object_name = 'object_list'
|
|
|
|
|
|
|
|
|
|
+ def get_context_data(self, **kwargs):
|
|
|
|
|
+ context = super().get_context_data(**kwargs)
|
|
|
|
|
+ context['type'] = 'ERNA'
|
|
|
|
|
+ return context
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
class EnergyProjekteView(ProductsView):
|
|
class EnergyProjekteView(ProductsView):
|
|
|
model = EnergyProjekt
|
|
model = EnergyProjekt
|
|
|
template_name = 'marktplatz/product_overview.html'
|
|
template_name = 'marktplatz/product_overview.html'
|
|
|
context_object_name = 'object_list'
|
|
context_object_name = 'object_list'
|
|
|
|
|
|
|
|
|
|
+ def get_context_data(self, **kwargs):
|
|
|
|
|
+ context = super().get_context_data(**kwargs)
|
|
|
|
|
+ context['type'] = 'ENER'
|
|
|
|
|
+ return context
|
|
|
|
|
|
|
|
|
|
|
|
|
class FilterProductsView(ProductsView):
|
|
class FilterProductsView(ProductsView):
|
|
@@ -422,6 +440,7 @@ class SearchProductsView(ProductsView):
|
|
|
if qform.is_valid():
|
|
if qform.is_valid():
|
|
|
self.object_list = self.get_queryset(qfilter= qform.cleaned_data["searchText"] )
|
|
self.object_list = self.get_queryset(qfilter= qform.cleaned_data["searchText"] )
|
|
|
|
|
|
|
|
|
|
+
|
|
|
allow_empty = self.get_allow_empty()
|
|
allow_empty = self.get_allow_empty()
|
|
|
|
|
|
|
|
if not allow_empty:
|
|
if not allow_empty:
|
|
@@ -437,12 +456,47 @@ class SearchProductsView(ProductsView):
|
|
|
'class_name': self.__class__.__name__,
|
|
'class_name': self.__class__.__name__,
|
|
|
})
|
|
})
|
|
|
context = self.get_context_data()
|
|
context = self.get_context_data()
|
|
|
- print(context)
|
|
|
|
|
|
|
+ context['type']= kwargs['type']
|
|
|
return self.render_to_response(context)
|
|
return self.render_to_response(context)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+class GenericSearchView(SearchProductsView):
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ def dispatch(self, request, *args, **kwargs):
|
|
|
|
|
+
|
|
|
|
|
+ print( kwargs['type'] )
|
|
|
|
|
+ if self.kwargs['type'] == 'BASE':
|
|
|
|
|
+ return super().dispatch(request, *args, **kwargs)
|
|
|
|
|
+ elif self.kwargs['type'] == 'WOHN':
|
|
|
|
|
+ self.model = Wohnprojekt
|
|
|
|
|
+ self.form_class = WohnprojektForm
|
|
|
|
|
+ return super().dispatch(request, *args, **kwargs)
|
|
|
|
|
+ elif self.kwargs['type'] == 'MOBI':
|
|
|
|
|
+ self.model = MobilitaetsProjekt
|
|
|
|
|
+ self.form_class = MobilitaetsForm
|
|
|
|
|
+ return super().dispatch(request, *args, **kwargs)
|
|
|
|
|
+ elif self.kwargs['type'] == 'ERNA':
|
|
|
|
|
+ self.model = ErnaehrungsProjekt
|
|
|
|
|
+ self.form_class = ErnaehrungsForm
|
|
|
|
|
+ return super().dispatch(request, *args, **kwargs)
|
|
|
|
|
+ elif self.kwargs['type'] == 'ENER':
|
|
|
|
|
+ self.model = EnergyProjekt
|
|
|
|
|
+ self.form_class = EnergyForm
|
|
|
|
|
+ return super().dispatch(request, *args, **kwargs)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
class ProductsListView(generic.ListView):
|
|
class ProductsListView(generic.ListView):
|
|
|
model = Product
|
|
model = Product
|
|
|
template_name='marktplatz/object_list.html'
|
|
template_name='marktplatz/object_list.html'
|