[geany/www.geany.org] 64bb87: Re-enable snippet deletion by adding new snippets to the user's session

Enrico Tröger git-noreply at xxxxx
Thu May 23 20:06:54 UTC 2013


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Thu, 23 May 2013 20:06:54 UTC
Commit:      64bb87ced49e110c7ce84618137e1bb117e91729
             https://github.com/geany/www.geany.org/commit/64bb87ced49e110c7ce84618137e1bb117e91729

Log Message:
-----------
Re-enable snippet deletion by adding new snippets to the user's session


Modified Paths:
--------------
    pastebin/forms.py
    pastebin/templates/pastebin/snippet_details.html

Modified: pastebin/forms.py
5 files changed, 5 insertions(+), 0 deletions(-)
===================================================================
@@ -89,6 +89,11 @@ def save(self, parent=None, *args, **kwargs):
         # Save snippet in the db
         forms.ModelForm.save(self, *args, **kwargs)
 
+        # Add snippet to the user's session
+        if not self.request.session.get('snippet_list', False):
+            self.request.session['snippet_list'] = []
+        self.request.session['snippet_list'].append(self.instance.pk)
+
         return self.request, self.instance
 
     ########################################################################


Modified: pastebin/templates/pastebin/snippet_details.html
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -19,7 +19,7 @@
     <abbr title="Time to life">TTL:</abbr> {{ snippet.expires|timeuntil  }}
     —
     {% if snippet.pk|in_list:request.session.snippet_list %}
-    <a onclick="return confirm('Really delete this snippet?')" href="{% url 'snippet_delete' snippet.secret_id %}">Delete now!</a>
+    <a onclick="return confirm('Really delete this snippet?')" href="{% url 'snippet_delete' snippet.secret_id %}">Delete</a>
     —
     {% endif %}
     {% if snippet.parent_id %}



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list