Juan Carlos před 5 roky
rodič
revize
b588945bb3

+ 8 - 1
marktplatz/forms.py

@@ -13,6 +13,7 @@ from django.forms import formset_factory
 from django import forms
 from captcha.fields import CaptchaField
 from django.core.files import File
+from marktplatz.widgets import *
 
 
 class VoteForm(forms.Form):
@@ -63,7 +64,13 @@ class SubmissionForm(forms.ModelForm):
     def __init__(self,*args, **kwargs):
        super(SubmissionForm, self).__init__(*args, **kwargs)
 
-
+       #
+       #
+       #
+       self.fields['orga'].widget = ListTextWidget(data_list=Product.ORGANIZATION,  name='orga_list')
+       #
+       #
+       #
 
        self.fields['title'].help_text = ('<i>e.g. Sirius Tower</i>')
        self.fields['header'].help_text = ('<i>e.g. Skyscraper with heavenly forms </i>')

+ 8 - 6
marktplatz/models.py

@@ -22,6 +22,8 @@ from django.conf import settings
 import datetime
 import shutil
 
+from marktplatz.widgets import *
+
 class Credit(models.Model):
     owner = models.CharField(verbose_name='Building or Product owner',blank=True,max_length = 300)
     architecture = models.CharField(verbose_name='Architecture',blank=True,max_length = 300)
@@ -43,7 +45,7 @@ class Credit(models.Model):
 
     def __iter__(self):
         for field in self._meta.fields:
-            if field.value_to_string(self) is not '-' and field.value_to_string(self) is not 'N/A':
+            if field.value_to_string(self) != '-' and field.value_to_string(self) != 'N/A':
                 yield (field.verbose_name, field.value_to_string(self))
 
 
@@ -59,7 +61,7 @@ class Description(models.Model):
 
     def __iter__(self):
         for field in self._meta.fields:
-            if (field.value_to_string(self) is not '-') and (field.value_to_string(self) is not 'N/A'):
+            if (field.value_to_string(self) != '-') and (field.value_to_string(self) != 'N/A'):
                  yield (field.verbose_name, field.value_to_string(self))
 
 
@@ -75,7 +77,7 @@ class Interaction(models.Model):
 
     def __iter__(self):
         for field in self._meta.fields:
-            if (field.value_to_string(self) is not '-') and (field.value_to_string(self) is not 'N/A'):
+            if (field.value_to_string(self) != '-') and (field.value_to_string(self) != 'N/A'):
                  yield (field.verbose_name, field.value_to_string(self))
 
 
@@ -175,8 +177,8 @@ class Product(models.Model):
     ]
 
     ORGANIZATION = [
-        ('SOZ', 'Soziokratie'),
-        ('SON', 'Sonstiges'),
+        ('Soziokratie', 'Soziokratie'),
+        ('Sonstiges', 'Sonstiges'),
     ]
 
     name         = models.CharField( 'Name', max_length = 128, help_text="Name des Projekts", null = True, blank=True )
@@ -192,7 +194,7 @@ class Product(models.Model):
     mitmachen  = models.BooleanField( 'Mitmachen möglich', default=False, help_text="Kann jemand mitmachen?", null = True, blank=True )
     rechtsform = models.CharField( 'Rechtsform', max_length = 4, choices=RECHTSFORM, default='ANDE', help_text="Rechtsform des Projektes", null = True, blank=True )
     ort        = models.CharField( 'Ort',        max_length = 4, choices=ORT, default='WELT', help_text="Ort des Projektes", null = True, blank=True )
-    orga       = models.CharField( 'Organisationsform',        max_length = 3, choices=ORGANIZATION, default='SON', help_text="Organisationsform des Projektes", null = True, blank=True )
+    orga       = models.CharField( 'Organisationsform',  max_length = 128,  choices=ORGANIZATION, default='Sonstiges', help_text="Organisationsform des Projektes", null = True, blank=True )
 
     title = models.CharField('Product Title',max_length = 100)
     country = CountryField(blank=True,multiple=True, help_text="")

+ 1 - 1
marktplatz/templates/marktplatz/admin_panel.html

@@ -24,7 +24,7 @@
     {% for Product in Product_list %}
     <tr class=""   >
         <td  scope="col"><img src="{{Product.media_set.first.image_small.url}}"  width="50" height="50" alt="{{ Product.pk }}"> </td>
-        <td  scope="col"> <a href="{% url 'Product-detail' Product.pk %}">   {{Product.title|upper }} </a></td>
+        <td  scope="col"> <a href="{% url 'Product-detail' Product.pk %}">   {{Product.name|upper }} </a></td>
          <td scope="col">
         {% for category in Product.category.all %}
         {{category.short_name}}{% if not forloop.last %} | {% endif %}

+ 1 - 1
marktplatz/templates/marktplatz/file_upload.html

@@ -10,7 +10,7 @@
 
 <div class="container-fluid">
 
-    <h3 style="margin-top: 10px">{{Product.title}} Media </h3>
+    <h3 style="margin-top: 10px">{{Product.name}} Media </h3>
 
  <table class="table table-sm table-hover">
 

+ 1 - 1
marktplatz/templates/marktplatz/media_overview.html

@@ -8,7 +8,7 @@
 
 <div class="container-fluid">
 
-    <h3 style="margin-top: 10px">{{Product.title}} Media </h3>
+    <h3 style="margin-top: 10px">{{Product.name}} Media </h3>
 
  <table class="table table-sm table-hover">
 

+ 1 - 1
marktplatz/templates/marktplatz/myProducts.html

@@ -39,7 +39,7 @@ $('form').submit(function () {
     {% for Product in Product_list %}
     <tr class="{% get_sucsess Product %}"   >
         <td  scope="col"><img src="{{Product.media_set.first.image_small.url}}"  width="50" height="50" alt="{{ Product.pk }}"> </td>
-        <td  scope="col"> <a href="{% url 'Product-detail' Product.pk %}">   {{Product.title|upper }} </a></td>
+        <td  scope="col"> <a href="{% url 'Product-detail' Product.pk %}">   {{Product.name|upper }} </a></td>
           <td scope="col">
         {% for category in Product.category.all %}
         {{category.short_name}}{% if not forloop.last %} | {% endif %}

+ 1 - 1
marktplatz/templates/marktplatz/product_overview.html

@@ -208,7 +208,7 @@ $(document).ready(function(){
     <a href="{% url 'Product-detail' Product.pk %}">
       <div style="position: relative;text-align: center;">
         <img class="{% if user.is_authenticated %}{% get_vote_class Product user %} {% endif %} {% for category in Product.category.all %} {{category.short_name}} {% endfor %} card-img-top rounded-0" src="{{Product.media_set.first.image_norm.url}}" alt="image">
-        <div class="mab-Product-title" style="">{{Product.title|upper }}</div>
+        <div class="mab-Product-title" style="">{{Product.name|upper }}</div>
         {% if user.is_authenticated %}
         <div class="mab-Product-vote" style="">{% get_vote Product user %}</div>
         {% endif %}

+ 9 - 9
marktplatz/templates/marktplatz/project_detail.html

@@ -31,7 +31,7 @@ $('.gallery').featherlightGallery({
 <div clas="container">
 
 
-<h2 class="titlepro" style="margin-top: 7px;color: black; font-weight: bold">{{ Product.title }}
+<h2 class="titlepro" style="margin-top: 7px;color: black; font-weight: bold">{{ Product.name }}
       <small class="text-muted">{% if Product.year %} {{ Product.year }}, {% endif %}  {% for country in Product.country %} {{ country.name }}, {% endfor %} {% if Product.city %} {{ Product.city }} {% endif %}</small>
 </h2>
 <p class="lead kur"> {{ Product.header }}</p>
@@ -53,9 +53,9 @@ $('.gallery').featherlightGallery({
 
 
     <div class="row" style="margin-top: 10px">
-     
+
      <div class="col-sm-6">
-         <p ><h5 class="black"></h5></p>
+         <p><h5 class="black"></h5></p>
           {% for video in Product.video_set.all %}
 
           <video autoplay style="width: 100%;height: auto;vertical-align: middle; padding-bottom: 10px" controls>
@@ -63,7 +63,7 @@ $('.gallery').featherlightGallery({
           </video>
 
       {% endfor %}
-         <p>{{Product.teaser_txt}}</p>
+         <p>{{Product.claim}}</p>
          <p>{{Product.description_txt}}</p>
 
          {% for link in Product.link_set.all %}
@@ -76,7 +76,7 @@ $('.gallery').featherlightGallery({
      </div>
      <div class="col-sm-4">
          {% if request.user|has_group:"jury" %}
-         <p ><h5 class="black mediumkur" style="margin: 0px">Please vote here:</h5></p>
+         <p><h5 class="black mediumkur" style="margin: 0px">Please vote here:</h5></p>
             <form class="form-inline needs-validation" method="POST"> {% csrf_token %}
                 <p><textarea style="margin-top: 0px;padding-top: 0px" type="text" rows="5" cols="25" class="form-control border-dark rounded-0" id="comment" name="comment" placeholder='{% get_comment Product user %}'>{% get_comment Product user %}</textarea></br>
                 <br> <input style='width: 50px;' type="number" class="form-control border-dark rounded-0" id="vote" name="vote" placeholder='{% get_int_vote Product user %}' required> <button  class="btn border-dark rounded-0 mybtn" type="submit">Submit </button> </br>
@@ -94,7 +94,7 @@ $('.gallery').featherlightGallery({
             <p style="margin-top: 4px"><strong>Award Categories:</strong> {% for cat in Product.category.all %} {{cat.name}}{% if not forloop.last %}, {% endif %}{% endfor %}</p>
          {% endif %}
 
-         <p ><h5 class="black mediumkur">Details</h5></p>
+         <p><h5 class="black mediumkur">Details</h5></p>
 
          {% for field, value in credits %}
          {% if value and not field == "ID" %}
@@ -102,7 +102,7 @@ $('.gallery').featherlightGallery({
          {% endif %}
          {% endfor %}
 
-          <p ><h5 class="mediumkur">Descriptions</h5></p>
+          <p><h5 class="mediumkur">Descriptions</h5></p>
 
          {% for field, value in descriptions %}
          {% if value and not field == "ID"%}
@@ -112,7 +112,7 @@ $('.gallery').featherlightGallery({
 
 
 
-         <p ><h5 class="mediumkur">Participatory architecture & urban interaction</h5></p>
+         <p><h5 class="mediumkur">Participatory architecture & urban interaction</h5></p>
 
          {% for field, value in interactions %}
          {% if value and not field == "ID"%}
@@ -123,7 +123,7 @@ $('.gallery').featherlightGallery({
 
 
 
-         <p ><h5 class="mediumkur">Mediacredits</h5></p>
+         <p><h5 class="mediumkur">Mediacredits</h5></p>
 
          {% for media in Product.media_set.all %}
          {% if media.copyright %}

+ 1 - 1
marktplatz/templates/marktplatz/voteDetail.html

@@ -27,7 +27,7 @@
     {% for Product in Product_list %}
     <tr class="{% get_sucsess Product %}"   >
         <td  scope="col"><img src="{{Product.media_set.first.image_small.url}}"  width="50" height="50" alt="image"> </td>
-        <td  scope="col"> <a href="{% url 'Product-detail' Product.pk %}">   {{Product.title|upper }} </a></td>
+        <td  scope="col"> <a href="{% url 'Product-detail' Product.pk %}">   {{Product.name|upper }} </a></td>
          <td scope="col">
         {% for category in Product.category.all %}
         {{category.short_name}}{% if not forloop.last %} | {% endif %}

+ 1 - 1
marktplatz/templates/marktplatz/votes_cid.html

@@ -44,7 +44,7 @@ $('form').submit(function () {
     {% for Product in Product_list %}
     <tr class="{% get_sucsess Product %}"   >
         <td  scope="col"><img src="{{Product.media_set.first.image_small.url}}"  width="50" height="50" alt="{{ Product.pk }}"> </td>
-        <td  scope="col"> <a href="{% url 'Product-detail' Product.pk %}">   {{Product.title|upper }} </a></td>
+        <td  scope="col"> <a href="{% url 'Product-detail' Product.pk %}">   {{Product.name|upper }} </a></td>
          <td scope="col">
         {% for category in Product.category.all %}
         {{category.short_name}}{% if not forloop.last %} | {% endif %}

+ 1 - 1
marktplatz/views.py

@@ -329,7 +329,7 @@ class importOldProducts(LoginRequiredMixin, TemplateView):
                 description.save()
 
 
-                Product.title=row['Product title']
+                Product.name=row['Product title']
                 Product.country = row['Country']
                 Product.city = row['City']
                 Product.year = row['Year of completion']

+ 17 - 0
marktplatz/widgets.py

@@ -0,0 +1,17 @@
+from django import forms
+
+class ListTextWidget(forms.TextInput):
+    def __init__(self, data_list, name, *args, **kwargs):
+        super(ListTextWidget, self).__init__(*args, **kwargs)
+        self._name = name
+        self._list = data_list
+        self.attrs.update({'list': 'list__{}'.format(self._name)})
+
+    def render(self, name, value, attrs=None, renderer=None):
+        text_html = super(ListTextWidget, self).render(name, value, attrs=attrs)
+        data_list = '<datalist id="list__{}">'.format(self._name)
+        for item in self._list:
+            data_list += '<option value="{}">{}</option>'.format(item[0], item[1])
+        data_list += '</datalist>'
+
+        return text_html + data_list