--- a/src/egonomy/templates/egonomy_create_fragment.html Wed Jan 30 17:13:19 2013 +0100
+++ b/src/egonomy/templates/egonomy_create_fragment.html Wed Jan 30 18:02:15 2013 +0100
@@ -14,7 +14,7 @@
{% block content %}
<div class="fullwidth">
- <form action="#">
+ <form action="{% url 'save_fragment' %}" method="POST">
<div class="column column-half">
<a href="#" class="head-button clear-fragment" title="{% trans 'Erase the drawing' %}">×</a>
<a href="#" class="head-button reset-fragment" title="{% trans 'Back to the original drawing' %}">↺</a>
@@ -27,7 +27,8 @@
{% endthumbnail %}
<div class="cutout-canvas"></div>
</div>
- <input id="fragment-path" type="text" class="fragment-path column-half" value="M 0 .5 L .5 0 L 1 .5 L .5 1 Z" />
+ <input name="fragment_path" id="fragment_path" type="text" class="fragment-path column-half" value="M 0 .5 L .5 0 L 1 .5 L .5 1 Z" />
+ {% csrf_token %}
</div>
<div class="column column-half">
<table class="image-metadata">
@@ -37,15 +38,15 @@
</tr>
<tr>
<th>{% trans "Fragment's title" %} :</th>
- <td><input type="text" class="fragment-title" placeholder="{% trans "Fragment's title" %}" /></td>
+ <td><input type="text" class="fragment-title" placeholder="{% trans "Fragment's title" %}" name="fragment_title" id="fragment_title"/></td>
</tr>
<tr>
<th>{% trans "Fragment's description" %} :</th>
- <td><textarea class="fragment-description"></textarea></td>
+ <td><textarea class="fragment-description" name="fragment_description" id="fragment_description"></textarea></td>
</tr>
<tr>
<th>{% trans 'Users keywords' %} :</th>
- <td><textarea class="user-keywords"></textarea></td>
+ <td><textarea class="user-keywords" name="users_keywords" id="users_keywords"></textarea></td>
</tr>
<tr>
<th> </th>
--- a/src/egonomy/urls.py Wed Jan 30 17:13:19 2013 +0100
+++ b/src/egonomy/urls.py Wed Jan 30 18:02:15 2013 +0100
@@ -12,6 +12,7 @@
url(r'^annotate/$', 'egonomy.views.annotate_picture', name='annotate_picture'),
url(r'^viewfragment/$', 'egonomy.views.view_fragment', name='view_fragment'),
url(r'^createfragment/$', 'egonomy.views.create_fragment', name='create_fragment'),
+ url(r'^savefragment/$', 'egonomy.views.save_fragment', name='save_fragment'),
# Uncomment the admin/doc line below to enable admin documentation:
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
--- a/src/egonomy/views.py Wed Jan 30 17:13:19 2013 +0100
+++ b/src/egonomy/views.py Wed Jan 30 18:02:15 2013 +0100
@@ -1,10 +1,11 @@
from django.conf import settings
+from django.contrib.auth.decorators import login_required
#from django.contrib.auth.models import Group, User
+from django.core.files.storage import FileSystemStorage
#from django.core.paginator import Paginator, InvalidPage, EmptyPage
-from django.shortcuts import render_to_response
+from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
from sorl.thumbnail.images import ImageFile
-from django.core.files.storage import FileSystemStorage
@@ -83,7 +84,7 @@
{'fragment': frg, 'fragment_list': frg_list},
context_instance=RequestContext(request))
-
+#@login_required
def create_fragment(request):
im1 = {"image": ImageFile(open(settings.RMN_PICT_ROOT+"0/08-551797.jpg", 'r'),FileSystemStorage(location=settings.RMN_PICT_ROOT)), "title":"title im 1", "author":"juju"}
@@ -112,5 +113,15 @@
{'image': im, 'fragment_list': frg_list},
context_instance=RequestContext(request))
+#@login_required
+def save_fragment(request):
+
+ frg_title = request.POST["fragment_title"]
+ frg_desc = request.POST["fragment_description"]
+ frg_kw = request.POST["users_keywords"]
+ frg_path = request.POST["fragment_path"]
+
+ return redirect("view_fragment")
+