浏览代码

publish, translations, search agent

Juan Carlos 5 年之前
父节点
当前提交
26645f7ad9

+ 123 - 24
marktplatz/forms.py

@@ -6,7 +6,7 @@ from django.contrib.auth.forms import UserCreationForm
 from django_file_form.forms import UploadedFileField, FileFormMixin, CharField, MultipleUploadedFileField
 from django.contrib.auth.models import User
 from django.urls import reverse, reverse_lazy
-from django.forms import formset_factory
+from django.forms import *
 from django.forms.widgets import HiddenInput
 from django.forms.models import inlineformset_factory
 # from django.views.generic.edit.FormMixin
@@ -68,34 +68,132 @@ class textSearchForm(forms.Form):
 
 class searchAgentForm(forms.ModelForm):
 
+    agent_layout = Layout()
+
     class Meta:
         model = SearchAgent
         fields = ('ort', 'email')
 
-    agent_layout = Layout(
-        Fieldset(
-            ('Suchagent einrichten'),
-            # 'ort',
-           Div(
-               Div('ort',  css_class='col-sm-6 col-6 checkbox-ort'),
+    def __init__(self,*args, **kwargs):
+        super().__init__(*args, **kwargs)
+        # self.fields['ort'].widget        = CheckboxSelectMultiple( attrs= { 'style' : "min-height: 250px;"} )
+        self.agent_layout = Layout(
+            Fieldset(
+                ('Suchagent einrichten'),
+                # 'ort',
                Div(
-               HTML("""
-               <button onclick=" ganz_wien()" class="btn btn-primary border-thin border-dark mybtn">Ganz Wien</button>
-               <script>
-                function ganz_wien(){
-                  $(".checkbox-ort .custom-control-label:contains('Wien')").each(function() {
-                   $this = $(this);
-                   var selector = "#" + $this.attr('for')  ;
-                   $( selector ).prop('checked', true);
-                });
-                }
-               </script>
-               """),
-               css_class='col-sm-6 col-6'),
-               css_class='form-row  row'),
+                   Div('ort',  css_class='col-sm-6 col-6 checkbox-ort'),
+                   Div(
+                   HTML("""
+                   <button onclick=" ganz_wien()" class="btn btn-primary border-thin border-dark mybtn">Ganz Wien</button>
+                   <script>
+                    function ganz_wien(){
+                      $(".checkbox-ort .custom-control-label:contains('Wien')").each(function() {
+                       $this = $(this);
+                       var selector = "#" + $this.attr('for')  ;
+                       $( selector ).prop('checked', true);
+                    });
+                    }
+                   </script>
+                   <br>
+                   """),
+                   # HTML("""
+                   # <div id="div_id_ort" class="form-group">
+                   # <label for="" class=" requiredField">Ort<span class="asteriskField">*</span> </label>
+                   # <div class="">
+                   # <div class="row">
+                   #     <div class="col-sm-6 col-6 checkbox-ort">
+                   #
+                   #             <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_1" value="1010" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_1">
+                   #                 Wien 1
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_2" value="1020" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_2">
+                   #                 Wien 2
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_3" value="1030" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_3">
+                   #                 Wien 3
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_4" value="1040" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_4">
+                   #                 Wien 4
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_5" value="1050" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_5">
+                   #                 Wien 5
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_6" value="1060" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_6">
+                   #                 Wien 6
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_7" value="1070" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_7">
+                   #                 Wien 7
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_8" value="1080" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_8">
+                   #                 Wien 8
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_9" value="1090" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_9">
+                   #                 Wien 9
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_10" value="1100" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_10">
+                   #                 Wien 10
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_11" value="1110" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_11">
+                   #                 Wien 11
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_12" value="1120" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_12">
+                   #                 Wien 12
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_13" value="1130" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_13">
+                   #                 Wien 13
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_14" value="1140" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_14">
+                   #                 Wien 14
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_15" value="1150" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_15">
+                   #                 Wien 15
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_16" value="1160" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_16">
+                   #                 Wien 16
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_17" value="1170" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_17">
+                   #                 Wien 17
+                   #             </label> </div>
+                   #         </div>
+                   #         <div class="col-sm-6 col-6 checkbox-ort">
+                   #
+                   #
+                   #             <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_18" value="1180" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_18">
+                   #                 Wien 18
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_19" value="1190" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_19">
+                   #                 Wien 19
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_20" value="1200" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_20">
+                   #                 Wien 20
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_21" value="1210" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_21">
+                   #                 Wien 21
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_22" value="1220" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_22">
+                   #                 Wien 22
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_23" value="1230" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_23">
+                   #                 Wien 23
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_24" value="GERM" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_24">
+                   #                 Deutschland
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_25" value="SCHW" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_25">
+                   #                 Schweiz
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_26" value="VORA" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_26">
+                   #                 Vorarlberg
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_27" value="TIRO" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_27">
+                   #                 Tirol
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_28" value="SALZ" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_28">
+                   #                 Salzburg
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_29" value="KAER" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_29">
+                   #                 Kärnten
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_30" value="STEI" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_30">
+                   #                 Steiermark
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_31" value="OBER" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_31">
+                   #                 Oberösterreich
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_32" value="NIER" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_32">
+                   #                 Niederösterreich
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_33" value="BURG" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_33">
+                   #                 Burgenland
+                   #             </label> </div> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="ort" id="id_ort_34" value="WELT" style="min-height: 250px;"> <label class="custom-control-label" for="id_ort_34">
+                   #                 Welt
+                   #             </label> </div>
+                   #         </div>
+                   #         </div>
+                   #         <small id="hint_id_ort" class="form-text text-muted">Ort des Projektes</small>
+                   #     </div>
+                   # </div>
+                   #
+                   # """),
+                   css_class='col-sm-6 col-6'),
+                   css_class='form-row  row'),
+
+            ),
+        )
+
+
+
 
-        ),
-    )
 
 class AgentNewslwtterForm( searchAgentForm, GeneralFields):
 
@@ -104,7 +202,8 @@ class AgentNewslwtterForm( searchAgentForm, GeneralFields):
     captcha = CaptchaField( label = 'Bitte lösen Sie die Gleichung', generator='captcha.helpers.math_challenge' )
 
     def __init__(self, *args, **kwargs):
-        super(searchAgentForm, self).__init__(*args, **kwargs)
+        # super(searchAgentForm, self).__init__(*args, **kwargs)
+        super(AgentNewslwtterForm, self).__init__(*args, **kwargs)
         self.helper = FormHelper(self)
         self.helper.attrs = {  'enctype' : "multipart/form-data" }
         self.helper.form_action = reverse('agent-newsletter-create', kwargs={'newsletter_slug': "gemeinschaffen-newsletter"}    )

+ 14 - 12
marktplatz/models.py

@@ -144,19 +144,19 @@ class Product(models.Model):
     name            = CharField   ( 'Name', max_length = 128, help_text="Name des Projekts. Beispiel: Seestern", null = True, blank=True )
     claim           = CharField   ( 'Claim / Untertitel', max_length = 256, help_text="Beispiel: Wohnprojekt Seestern Aspern", null = True, blank=True )
     beschreibung    = TextField   ( 'Projektbeschreibung', max_length = 2048, help_text="Beispiel: Das Wohnprojekt Seestern Aspern wurde als eines von fünf Baugruppenprojekten in der Seestadt aspern auf dem Baufeld D13 realisiert. Der Seestern ist ein Projekt für Menschen jeden Alters, die Initiative übernehmen und mit anderen einen gemeinsamen Mehrwert in einem eigenen Wohnhaus schaffen wollen. Gut erreichbar mit der U2 und in der Nähe der Lobau. Ein Wohnprojekt, das von Anfang an von den zukünftigen BewohnerInnen mitgestaltet wurde und mit den Menschen wächst. In der gemeinsam formulierten Vision steht die lebendige Architektur, die Gemeinschaft und Privatsphäre im Vordergrund.", null = True, blank=True )
-    learning        = CharField   ( 'Learning', max_length = 256, help_text="Was können andere von euch lernen? Beispiel: Nach dem Bezug des Gebäudes haben wir uns von einer Baugruppe in eine Wohngruppe verwandelt.", null = True, blank=True )
+    learning        = TextField   ( 'Learning', max_length = 2048, help_text="Was können andere von euch lernen? Beispiel: Nach dem Bezug des Gebäudes haben wir uns von einer Baugruppe in eine Wohngruppe verwandelt.", null = True, blank=True )
     gruendungsjahr  = IntegerField( 'Gründungsjahr', help_text="Wann wurde das Projekt gegründet?", default='2020', validators=[MinValueValidator(0), MaxValueValidator(9999)], null = True, blank=True )
     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 = 256,  help_text="PLZ des Projektes", null = True, blank=True )
-    adresse_zusatz  = CharField   ( 'Adresse Zusatz',   max_length = 256,  help_text="Adresse Zusatz", null = True, blank=True )
+    plz             = CharField   ( 'Adresse',   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 )
     email           = EmailField  ( 'Email',   max_length = 2048, help_text="Email des Projektes", null = True, blank=True )
     frei            = CharField   ( 'Platz frei', max_length = 4,    choices=FREI, default='NEIN', help_text="Gibt es freie Wohnungen? Wähle aus der Liste aus!", null = True, blank=False )
     kfrei           = CharField   ( 'Inseratstext - Platzfrei',   max_length = 2048,  help_text="Beschreibung des Angebots an Wohnungen bzw. freien Plätzen . Beispiel: Ab 1.5. wird eine schöne, südseitige 2 Zimmerwohnung mit 59 qm frei. Perfekt für Alleinerziehende! Melde Dich bei uns wenn du interessiert bist, dann schicken wir dir Detailinformationen zu!", null = True, blank=True )
-    rechtsform      = CharField   ( 'Rechtsform', max_length = 32, help_text="Rechtsform des Projektes. Beispiel: Verein oder Gmbh oder Genossenchaft", null = True, blank=True )
+    rechtsform      = CharField   ( 'Rechtsform', max_length = 256, help_text="Rechtsform des Projektes. Beispiel: Verein oder Gmbh oder Genossenchaft", null = True, blank=True )
     orga            = CharField   ( 'Organisationsform',  max_length = 256, help_text="Wie ist die Bewohnergemeinschaft organisiert? Beispiel: Soziokratie", null = True, blank=True )
     mitmachen       = BooleanField( 'Begleitet von RealityLab', default=False, help_text="Wurde/ Wird das Projekt von realitylab begleitet?", blank=False )
     terms           = BooleanField(help_text="", null=True)
@@ -219,6 +219,8 @@ class SearchAgent(models.Model):
     ort             = MultiSelectField   ( 'Ort', max_length = 4096 ,    choices=Product.ORT, default='', help_text="Ort des Projektes", null = True, blank=False )
     hash            = CharField          ( max_length=255, default=hash_gen )
 
+
+
 class Wohnprojekt(Product):
 
     EIGENTUM = [
@@ -325,9 +327,9 @@ class Wohnprojekt(Product):
     eigentum          = CharField    ( 'Rechtliche Konstruktion', max_length = 6,    choices=EIGENTUM, help_text="Wähle aus der Liste aus!", null = True, blank=True )
     altneu            = CharField    ( 'Altbau/Neubau',  max_length = 4, choices=ALTNEU, help_text="Wähle aus der Liste aus!", null = True, blank=False )
     schwerpunkt       = CharField    ( 'Inhaltlicher Schwerpunkt',   max_length = 1024,  help_text="Beispiel: Wir sind nicht nur eine Baugruppe sondern ein Kulturverein mit über 80 Veranstaltungen im Jahr. Darüberhinaus befindet sich bei uns eine Wohngemeinschaft für unbegleitete, minderjährige Geflüchtete.", null = True, blank=True )
-    wohnbaufoerderung = CharField    ( 'Wohnbauförderung',    max_length = 1024,   choices=WOHNBAUFOERDERUNG, help_text="Wähle aus der Liste aus!", null = True, blank=True )
+    wohnbaufoerderung = CharField    ( 'Wohnbauförderung',    max_length = 256,   choices=WOHNBAUFOERDERUNG, help_text="Wähle aus der Liste aus!", null = True, blank=True )
     artmodell         = TextField    ( 'Art der Modells',    max_length = 2048,   help_text="Klicke ins Feld, wähle aus der Liste aus, was am ehesten zutrifft und bearbeite den Text!", null = True, blank=True )
-    bautraeger        = TextField    ( 'Bauträger',    max_length = 2048, help_text="Klicke ins Feld, wähle aus der Liste aus!", null = True, blank=True )
+    bautraeger        = TextField    ( 'Bauträger',    max_length = 1024, help_text="Klicke ins Feld, wähle aus der Liste aus!", null = True, blank=True )
     aerwachsene       = IntegerField ( 'Anzahl an Erwachsenen', help_text="Wenn du keine genauen Zahlen hast, gib eine Schätzung ab.", validators=[MinValueValidator(0), MaxValueValidator(9999)], default = 0, null = True, blank=False )
     akinder           = IntegerField ( 'Anzahl an Kinder', help_text="Wenn du keine genauen Zahlen hast, gib eine Schätzung ab.", validators=[MinValueValidator(0), MaxValueValidator(9999)], default = 0,  null = True, blank=False )
     @property
@@ -341,19 +343,19 @@ class Wohnprojekt(Product):
     @property
     def flaeche(self):
             return self.wohnflaeche + self.gewerbeflaechen + self.gemeinschaftsflaeche + self.sonstige_flaechen
-    kflaechen          = CharField         ( 'Flächen - Kommentar', max_length = 1024, help_text="Hier kannst du genauere Angaben machen. Beispiel: Unsere Gewerbefläche besteht aus einem Coworking-Raum.", null = True, blank=True )
+    kflaechen          = CharField         ( 'Flächen - Kommentar', max_length = 2048, help_text="Hier kannst du genauere Angaben machen. Beispiel: Unsere Gewerbefläche besteht aus einem Coworking-Raum.", null = True, blank=True )
     gemeinschaftr      = MultiSelectField  ( 'Gemeinschaftsräume',    max_length = 1024,   choices=GEMEINSCHAFTR, help_text="Mehrfachnennungen sind möglich.", null = True, blank=True )
-    kgemeinschaftr     = CharField         ( 'Gemeinschaftsräume - Sonstiges', max_length = 1024, help_text="Gibt es noch andere/weitere Gemeinschaftsräume, die nicht in der Liste stehen?", null = True, blank=True )
+    kgemeinschaftr     = CharField         ( 'Gemeinschaftsräume - Sonstiges', max_length = 2048, help_text="Gibt es noch andere/weitere Gemeinschaftsräume, die nicht in der Liste stehen?", null = True, blank=True )
     raumangebot        = MultiSelectField  ( 'Raumangebot nach Außen',    max_length = 1024,   choices=RAUMANGEBOT, help_text="Mehrfachnennungen sind möglich.", null = True, blank=True )
-    kraumangebot       = CharField         ( 'Raumangebot nach Außen - Sonstiges',    max_length = 1024,  help_text="Welche Raumangebote bietet ihr nach Außen an?", null = True, blank=True )
+    kraumangebot       = CharField         ( 'Raumangebot nach Außen - Sonstiges',    max_length = 512,  help_text="Welche Raumangebote bietet ihr nach Außen an?", null = True, blank=True )
     inseratstext      = TextField          ( 'Inseratstext für Raumangebote',   max_length = 1024,  help_text="Möchtet ihr euer Raumangebot inserieren? Dann habt ihr hier die Möglichkeit einen Inserattext mit dem Angebot zu verfassen. Beispiel: Ihr könnt für Veranstaltungen unseren Multifunktionsraum mieten. Außerdem haben wir laufen Plätze in unserem Coworkingspace frei. Kontaktiert uns per Email!", null = True, blank=True )
-    sonderwohnformen   = CharField         ( 'Sonderwohnformen',   max_length = 1024,  help_text='Welche Sonderwohnformen hat das Projekt? (z.B. Wohncluster, WGs, Sonstiges) Beispiel: Wir bieten sogenannte "Flexwohnungen" an, die auf drei Jahre befristet vermietet werden. Mit Flexwohnungen können wir auf familiäre Veränderungen reagieren. z.b. bei Nachwuchs können wir die Flexwohnungen einer wachsenden Familie zuschlagen.', null = True, blank=True )
+    sonderwohnformen   = CharField         ( 'Sonderwohnformen',   max_length = 512,  help_text='Welche Sonderwohnformen hat das Projekt? (z.B. Wohncluster, WGs, Sonstiges) Beispiel: Wir bieten sogenannte "Flexwohnungen" an, die auf drei Jahre befristet vermietet werden. Mit Flexwohnungen können wir auf familiäre Veränderungen reagieren. z.b. bei Nachwuchs können wir die Flexwohnungen einer wachsenden Familie zuschlagen.', null = True, blank=True )
     parbeiten          = IntegerField      ( 'Wie viele Personen arbeiten im Haus', help_text="Damit sind Personen gemeint die in Gewerbräumen, in einer Praxis, einem Coworking usf. arbeiten.", validators=[MinValueValidator(0), MaxValueValidator(9999)], null = True, blank=True )
     karbeiten          = CharField         ( 'Wie viele Personen arbeiten im Haus - Kommentar',   max_length = 1024,  help_text="Sag uns die Personen so machen! Beispiel: Die meisten arbeiten im Coworking, aber wir haben auch ein Tonstudio und einen Masseur im Haus.", null = True, blank=True )
     bauweise           = CharField         ( 'Bauweise',  max_length = 64, help_text="Klicke ins Feld, wähle aus der Liste aus oder mach einen passenden Eintrag!", null = True, blank=True )
     zielgruppen        = CharField         ( 'Besondere Zielgruppen',  max_length = 64, help_text="Gibt es eine Bewohnergruppe die bewusst gesucht wurde und die überdurchschnittlich vertreten ist? Beispiel: SeniorInnen und StudentInnen", null = True, blank=True )
-    gprojekte          = CharField         ( 'Gemeinschaftliche Projekte',  max_length = 64, help_text="Welche gemeinschaftlichen Projekte sind entstanden/geplant? Beispiel: Foodcoop, Carsharing und Leihladen. Du kannst mehrere nennen.", null = True, blank=True )
-    oekologie          = CharField         ( 'Ökologie',  max_length = 1024, help_text="Hat das Projekt ökologisch nachhaltige Besonderheiten? Beispiel: Wir bewohnen ein Niedrigenergiehaus. Das hilft uns Kosten zu sparen und unseren CO2 Verbrauch zu reduzieren. Auf dem Dach befindet sich eine gemeinschaftliche PV-Anlage.", null = True, blank=True )
+    gprojekte          = CharField         ( 'Gemeinschaftliche Projekte',  max_length = 128, help_text="Welche gemeinschaftlichen Projekte sind entstanden/geplant? Beispiel: Foodcoop, Carsharing und Leihladen. Du kannst mehrere nennen.", null = True, blank=True )
+    oekologie          = CharField         ( 'Ökologie',  max_length = 512, help_text="Hat das Projekt ökologisch nachhaltige Besonderheiten? Beispiel: Wir bewohnen ein Niedrigenergiehaus. Das hilft uns Kosten zu sparen und unseren CO2 Verbrauch zu reduzieren. Auf dem Dach befindet sich eine gemeinschaftliche PV-Anlage.", null = True, blank=True )
     freiraumangebote   = CharField         ( 'Freiraumangebote',  max_length = 64, choices=FREIANGEBOT, help_text="Beispiel: Gemeinschaftsterrasse, Innenhof, Dachterrassen, Hochbeete. Du kannst mehrere nennen.", null = True, blank=True )
     gaestwohnungen     = IntegerField      ( 'Anzahl an Gästewohnungen', help_text="Anzahl an Gästewohnungen", validators=[MinValueValidator(0)], default = 0 )
     urbanem            = BooleanField      ( 'Urbane Mischung', default=False, help_text="Gibt es im Haus neben dem Wohnen auch anderen urbane Funktionen wie Arbeiten, Gewerbe, Kultur, Bildung usf. (Und ist der Anteil dieser Flächen nennenswert?) Wenn ja dann kreuze dieses Feld an!", blank=False )

+ 26 - 26
marktplatz/signals.py

@@ -16,29 +16,29 @@ from .models import *
 @receiver(post_save, sender=Wohnprojekt)
 def search_agent(sender, instance, update_fields=None, **kwargs):
     # print("signal called")
-    if update_fields is not None:
-        if 'frei' in update_fields:
-            if instance.frei == 'JAJA' :
-                for agent in SearchAgent.objects.all():
-                    for agentOrt in agent.ort:
-                        if agentOrt == instance.ort:
-
-                            context = {}
-                            context['product'] = model_to_dict ( instance )
-                            context['agent']   = model_to_dict ( agent )
-
-                            context['product']['status']  =  instance.get_status_display()
-                            context['product']['ort']     =  instance.get_ort_display()
-                            context['agent']['delete_url']= instance.current_uri + reverse(  'search-agent-delete' , kwargs={ 'pk': agent.pk, 'hash': agent.hash }   )
-
-                            context['recipient'] = [ agent.email, ]
-                            context['msg_subject' ] = ('Gemeinschaffen - ' + instance.name )
-
-                            mail.send(
-                                context['recipient'],
-                                config.EMAIL_NOREPLY,
-                                context = context,
-                                template='generic',
-                                headers={  'Reply-To': agent.email },
-                                priority='now',
-                            )
+    # if update_fields is not None:
+    #     if 'frei' in update_fields:
+    if instance.frei == 'JAJA' and instance.public == True :
+        for agent in SearchAgent.objects.all():
+            for agentOrt in agent.ort:
+                if agentOrt == instance.ort:
+
+                    context = {}
+                    context['product'] = model_to_dict ( instance )
+                    context['agent']   = model_to_dict ( agent )
+
+                    context['product']['status']  =  instance.get_status_display()
+                    context['product']['ort']     =  instance.get_ort_display()
+                    context['agent']['delete_url']= instance.current_uri + reverse(  'search-agent-delete' , kwargs={ 'pk': agent.pk, 'hash': agent.hash }   )
+
+                    context['recipient'] = [ agent.email, ]
+                    context['msg_subject' ] = ('Gemeinschaffen - ' + instance.name )
+
+                    mail.send(
+                        context['recipient'],
+                        config.EMAIL_NOREPLY,
+                        context = context,
+                        template='generic',
+                        headers={  'Reply-To': agent.email },
+                        priority='now',
+                    )

+ 1 - 1
marktplatz/static/css/styles.css

@@ -295,7 +295,7 @@ button{
 
 .mark {
     color: white;
-    background-color: black;
+    background-color: #469CA8;
 }
 
 .red:hover {

+ 28 - 13
marktplatz/templates/marktplatz/modal-share.html

@@ -54,25 +54,25 @@
         <div class=""> &nbsp; </div>
         <i class="fas fa-share"></i>
         <h3>Teilen</h3>
+        <p>Informiere andere über dieses Projekt!</p>
         <div class=""> &nbsp; </div>
         <div class=""> &nbsp; </div>
 
         <div class="row">
           <div class="col-sm-4">
-            <div class="cursor-pointer" onclick="myFunction()">
 
-            <i class="fas fa-code"></i> <br>
-            <span>Text Kopieren</span>
-          </div>
-          </div>
-            <div class="col-sm-4">
-              <div class="cursor-pointer" onclick="">
+            <div class="cursor-pointer" onclick="">
 
               <a href="mailto:{{ product.wohnprojekt.email |obfuscate }}?subject={{  product.wohnprojekt  }}&body=Guten%20Tag!%0D%0A%0D%0AIch%20finde%20das%20folgende%20Projekt%20sehr%20interesant!%0D%0A%0D%0A{% fullurl 'product-detail-embed' pk=product.wohnprojekt.pk %}"><i class="fas fa-envelope"></i> <br>Send mail</a>
 
             </div>
-            </div>
-            <div class="col-sm-4"></div>
+
+          </div>
+          <div class="col-sm-4">
+
+          </div>
+          <div class="col-sm-4">
+          </div>
         </div>
         <div class=""> &nbsp; </div>
         <div class=""> &nbsp; </div>
@@ -80,13 +80,21 @@
 
 
 
-        <input type="text" value="&lt;iframe src=&quot;{% fullurl 'product-detail-embed' pk=product.wohnprojekt.pk %}&quot; style=&quot;border:0px #ffffff none;&quot; name=&quot;myiFrame&quot; scrolling=&quot;yes&quot; frameborder=&quot;0&quot; marginheight=&quot;0px&quot; marginwidth=&quot;0px&quot; height=&quot;400px&quot; width=&quot;600px&quot; allowfullscreen&gt;&lt;/iframe&gt;" id="myInput">
+        <input type="text" value="&lt;iframe src=&quot;{% fullurl 'product-detail-embed' pk=product.wohnprojekt.pk %}&quot; style=&quot;border:0px #ffffff none;&quot; name=&quot;myiFrame&quot; scrolling=&quot;yes&quot; frameborder=&quot;0&quot; marginheight=&quot;0px&quot; marginwidth=&quot;0px&quot; height=&quot;400px&quot; width=&quot;600px&quot; allowfullscreen&gt;&lt;/iframe&gt;" id="iframecode">
+        <div class="cursor-pointer" onclick="copyiframecode()">
 
+          <i class="fas fa-code"></i>
+          <span>Code Kopieren</span>
+        </div>
         <div class=""> &nbsp; </div>
         <div class=""> <span>Link</span> </div>
 
-        <input type="text" value="{% fullurl 'product-detail-embed' pk=product.wohnprojekt.pk %}" id="myLink">
+        <input type="text" value="{% fullurl 'product-detail-embed' pk=product.wohnprojekt.pk %}" id="embedlink">
+        <div class="cursor-pointer" onclick="copyembedlinkcode()">
 
+          <i class="fas fa-code"></i>
+          <span>Code Kopieren</span>
+        </div>
         <div class=""> &nbsp; </div><div class=""> &nbsp; </div>
 
       </div>
@@ -103,12 +111,19 @@
     ShareSpan.onclick = function() {
       ShareModal.style.display = "none";
     }
-    function myFunction() {
-      var copyText = document.getElementById("myInput");
+    function copyiframecode() {
+      var copyText = document.getElementById("iframecode");
       copyText.select();
       copyText.setSelectionRange(0, 99999)
       document.execCommand("copy");
       alert("Der Text wurde in der Zwischenablage kopiert: " + copyText.value);
     }
 
+    function copyembedlinkcode() {
+      var copyText = document.getElementById("embedlink");
+      copyText.select();
+      copyText.setSelectionRange(0, 99999)
+      document.execCommand("copy");
+      alert("Der Text wurde in der Zwischenablage kopiert: " + copyText.value);
+    }
     </script>

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

@@ -33,6 +33,7 @@ $('form').submit(function () {
         <th scope="col"> </th>
         <th scope="col"> Bearbeiten</th>
         <th scope="col"> Löschen</th>
+        <th scope="col"> Freischaltung beantragen</th>
 
     </tr>
     {% for product in product_list %}
@@ -46,6 +47,7 @@ $('form').submit(function () {
         </td>
         <td scope="col"> {% if product.edit %} <a href="{% url 'edit-product' product.pk %}"> Projekt bearbeiten</a> ; <a href="{% url 'add-Image' product.pk %}"> Media bearbeiten </a> {% else %} Es kann nicht bearbeitet werden {% endif %} </td>
         <td scope="col"> <a href="{% url 'product-delete' pk=product.pk %}" target="" rel="">Löschen</a>   </td>
+        <td scope="col"> <a href="{% url 'product-publish' pk=product.pk %}" target="" rel="">Freischaltung</a>   </td>
 
     </tr>
     {% endfor %}
@@ -58,7 +60,7 @@ $('form').submit(function () {
  {% else %}
 <div class="container-fluid">
 
-    <h6>Seems like you haven't uploaded anything yet :(<br> Start Sumbitting now :  <a href="{% url 'new-submit-view' %}"><button class="btn border-dark rounded-0 mybtn" type="submit">Add products </button> </a></h6>
+    <h6>Scheint, als hättest du noch nichts eingetragen :( <br> Gib jetzt ein Projekt ein:<a href="{% url 'new-submit-view' %}"><button class="btn border-dark rounded-0 mybtn" type="submit">Projekt eintragen </button> </a></h6>
 </div>
 
 {% endif %}

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

@@ -48,7 +48,8 @@ $(document).ready(function(){
        $("button").removeClass("mark");
 
        $(".card").not("." + toggler).hide();
-       $("button ." + toggler).addClass("mark");
+       $("button").filter( "." + toggler ).addClass("mark");
+       // $("button ." + toggler ).addClass("mark");
 
        if($(".card").filter(":visible").length < 1){
          $("#how").fadeIn(200)
@@ -58,7 +59,6 @@ $(document).ready(function(){
 
     });
 
-
 });
 
 </script>

+ 2 - 1
marktplatz/urls.py

@@ -21,8 +21,9 @@ urlpatterns = [
     # path('suchagent/embed', views.SearchAgentCreate.as_view( embed=True, ), name='search-agent-create-embed'),
     path('suchagent/<int:pk>/<slug:hash>/', views.SearchAgentDelete.as_view(), name='search-agent-delete'),
     path('projekt/<int:pk>/', views.DetailView.as_view(), name='product-detail'),
-    path('projekt/delete/<int:pk>/', views.ProductDelete.as_view(), name='product-delete'),
+    path('projekt/<int:pk>/delete', views.ProductDelete.as_view(), name='product-delete'),
     path('projekt/<int:pk>/embed', views.DetailView.as_view( embed=True, ), name='product-detail-embed'),
+    path('projekt/<int:pk>/freigeben', views.ProductPublish.as_view(  ), name='product-publish'),
     path('product-card/<int:pk>', views.CardDetailView.as_view(), name='product-detail-card'),
     path('product-card/<int:pk>/embed', views.CardDetailView.as_view( embed=True, ), name='product-detail-card-embed'),
     path('admin_panel/', views.AdminView.as_view(), name='admin-panel'),

+ 39 - 1
marktplatz/views.py

@@ -24,6 +24,7 @@ from django.views import generic
 from django.views.generic import TemplateView
 from django.views.generic import FormView
 from django.views.generic.edit import *
+from django.views.generic.detail import *
 from django.shortcuts import render, get_object_or_404, redirect, get_list_or_404, get_object_or_404
 from django.forms import formset_factory
 from django.forms import BaseModelFormSet
@@ -38,6 +39,7 @@ from constance import config
 from django.db.models import Q
 from newsletter.forms import *
 from newsletter.views import *
+from post_office import mail
 
 from marktplatz.models import *
 from .forms import *
@@ -246,6 +248,42 @@ class ProductDelete(LoginRequiredMixin, DeleteView):
         return render(request, self.template_name, context )
 
 
+class ProductPublish(LoginRequiredMixin, DetailView):
+    model = Product
+    template_name =  'marktplatz/generic.html'
+    # success_url = reverse_lazy('products')
+
+    #
+    def get(self, request, *args, **kwargs):
+
+        contact = get_object_or_404(Contact, user= self.request.user ) # Contact.objects.get(user=self.request.user)
+        product = get_object_or_404(Product, pk= kwargs.get('pk') )
+
+
+        if (contact.id == product.contact.id) :
+
+            product_url = reverse( 'product-detail', kwargs=  { 'pk': product.pk } )
+            publishmessage = "Ein Benutzer möchte folgendes Projekt freigeben: {}, {}".format( product.name, request.get_host() + product_url )
+
+            userList =User.objects.filter( is_superuser = 1  )
+            for superuser in userList:
+                mail.send(
+                    superuser.email, # List of email addresses also accepted
+                    config.EMAIL_NOREPLY,
+                    subject='Projekt Freschaltung',
+                    headers={  'Reply-To': superuser.email },
+                    message= publishmessage,
+                    # html_message='Hi <strong>there</strong>!',
+                )
+            context = {}
+            context["content_a"] = '<br><br><br>Die Freigabe wurde beantragt.<br><br><br>'
+            return render(request, self.template_name, context )
+
+        else:
+            raise Http404
+
+
+
 class ProductsView(generic.ListView):
     model = Wohnprojekt
     #context_object_name = 'Products'
@@ -707,7 +745,7 @@ class NewWohnprojektView(LoginRequiredMixin, FormView):
             product.public = False
             product.sumbitted = config.CURRENT_EVENT
 
-            product.save()
+            product.save(  )
             # product_f.save_m2m()
 
             if 'addImage' in request.POST:

+ 1 - 0
project_base/settings.py

@@ -198,6 +198,7 @@ CONSTANCE_CONFIG = {
     'IMPRESSUM': ('Impressum text.', 'Impressum'),
     'TEILNAHME': ('Teilnahmebedingungen text.', 'Teilnahmebedingungen'),
     'DATENSCHUTZRICHTLINIE': ('Datenschutzrichtlinie text.', 'Datenschutzrichtlinie'),
+    'WEITERFUEHRENDES': ('-', 'Weiterführendes.'),
     'ADMIN_EMAIL': ('juan@mediaarchitecture.org', 'Admin email'),
     'WEBSITE_TITEL': ('Markplatz', 'Name von der Webseite'),
     'WEBSEITE_URI': ('gemeinschaffen.com', 'Url von der Webseite, zB. gemeinschaffen.com'),

+ 2 - 1
project_base/templates/newsletter/subscription_activate.html

@@ -5,7 +5,8 @@
 {% block title %}{% trans "Newsletter" %} {{ newsletter.title }} {{ action }} {% trans "activate" %}{% endblock title %}
 
 {% block body %}
-    <h1>{% trans "Newsletter" %} {{ newsletter.title }} {{ action }} {% trans "activate" %}</h1>
+    <h1>Suchagent- und Newsletteranmeldung</h1>
+    <p>{{ newsletter.title }}</p>
 
     <form enctype="multipart/form-data" method="post" action=".">
         {% csrf_token %}