Commits

Anonymous committed 80a39fe

Un agenda fonctionel avant d'y ajouter css et javacript

Comments (0)

Files changed (13)

personal_calendar/forms.py

File contents unchanged.

personal_calendar/migrations/0002_auto__add_unique_evenement_nom.py

File contents unchanged.

personal_calendar/migrations/0003_auto__add_unique_evenement_participant_participant_evenement.py

File contents unchanged.

personal_calendar/models.py

     def get_absolute_url(self):
         return "/agenda/%s/details" % self.id
 
+    def delete_url(self):
+        return "/agenda/%s/delete/" % self.id
+
 class Evenement_Participant(models.Model):
     #notre table de relation
     evenement = models.ForeignKey(Evenement)
                       )
     status = models.IntegerField(choices=status_choices)
 
+    def delete_url(self):
+        return "/agenda/%i/participant/%i/delete/" % (self.evenement.id,
+                                                      self.participant.id)
     class Meta:
         unique_together = ("evenement","participant")

personal_calendar/urls.py

File contents unchanged.

templates/base.html

+<html>
+  <head>
+    <title>Agenda partagé
+{% block titre %}{% endblock titre %}
+    </title>
+  </head>
+  <body>
+    <div id="header">
+    </div>
+    <div id="menu">
+    </div>
+    <div id="content">
+    {% block content %}
+    {% endblock content%}
+    </div>
+    <div id="footer">
+    </div>
+  </body>
+</html> 

templates/personal_calendar/blocks/delete_form.html

+<form action="{{ delete_url }}"
+      method="POST">
+  {% csrf_token %}
+  <input type="submit" value="Supprimer" />
+</form>

templates/personal_calendar/event/create.html

File contents unchanged.

templates/personal_calendar/event/details.html

 <p>à {{event.lieu}}</p> 
 {% for participant in event.evenement_participant_set.all %}
 {{participant.participant}} {{participant.get_status_display}}
-<form action="/agenda/{{event.id}}/participant/{{participant.id}}/delete/" method="POST">
-  {% csrf_token %}
-  <input type="submit" value="Supprimer" />
-</form>
+{{participant.delete_url}}
+{% with delete_url=participant.delete_url %}
+{% include "personal_calendar/blocks/delete_form.html" %}
+{% endwith %}
 </p>
 {% endfor %}
 <form action="" method="POST">
 <input type="submit" value="Créer" />
 </form>
 
-<form action="/agenda/{{event.id}}/delete/"
-      method="POST">
-  {% csrf_token %}
-  <input type="submit" value="Supprimer" />
-</form>
+{% with delete_url=event.delete_url %}
+{% include "personal_calendar/blocks/delete_form.html" %}
+{% endwith %}
 <a href="/agenda/{{event.id}}/update/">Modifier</a>

templates/personal_calendar/event/liste.html

+{% extends "base.html" %}
+
+{% block titre %}
+    | Liste des évenements
+{% endblock titre %} 
+
+{% block content %}
 <ul>
 {% for event in events %}
 <li>
 <p>
 <a href="/agenda/create/">Créer un nouvel évenement</a>
 </p>
+{% endblock content %}

templates/user/create.html

File contents unchanged.

templates/user/succes.html

File contents unchanged.

usermanagement/urls.py

File contents unchanged.