--- a/src/hdabo/settings.py Thu Jul 17 15:39:28 2014 +0200
+++ b/src/hdabo/settings.py Thu Jul 17 16:47:29 2014 +0200
@@ -163,8 +163,6 @@
ACCOUNT_ACTIVATION_DAYS = 7
-THUMBNAIL_DEBUG = True
-
from hdabo.config import * #@UnusedWildImport
if 'LOGIN_REDIRECT_URL' not in locals():
--- a/src/hdalab/static/hdalab/css/profile.css Thu Jul 17 15:39:28 2014 +0200
+++ b/src/hdalab/static/hdalab/css/profile.css Thu Jul 17 16:47:29 2014 +0200
@@ -10,6 +10,7 @@
}
tr.border_bottom th, tr.border_bottom td {
border-bottom:1pt solid #555;
+ padding: 5px;
}
.renkan-basic-action{
float: left;
--- a/src/hdalab/templates/profile_home.html Thu Jul 17 15:39:28 2014 +0200
+++ b/src/hdalab/templates/profile_home.html Thu Jul 17 16:47:29 2014 +0200
@@ -25,7 +25,7 @@
<td>
<a title="Edit renkan" href="#" class="renkan-basic-action"><span class="ui-icon ui-icon-pencil"></span></a>
<a title="View renkan" href="#" class="renkan-basic-action"><span class="ui-icon ui-icon-eye"></span></a>
- <a title="Copy renkan" href="#" class="renkan-basic-action"><span class="ui-icon ui-icon-copy"></span></a>
+ <a title="Copy renkan" href="{% url 'renkan_copy' rk_id=r.rk_id %}" class="renkan-basic-action"><span class="ui-icon ui-icon-copy"></span></a>
<a title="Remove renkan" href="#" class="renkan-basic-action"><span class="ui-icon ui-icon-trash"></span></a>
</td>
</tr>
--- a/src/hdalab/urls.py Thu Jul 17 15:39:28 2014 +0200
+++ b/src/hdalab/urls.py Thu Jul 17 16:47:29 2014 +0200
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
-from hdalab.views.renkan import RenkanGetPut
+from hdalab.views.renkan import RenkanGetPut, RenkanCopy
from hdalab.views.profile import ProfileHome
# Uncomment the next two lines to enable the admin:
@@ -32,6 +32,7 @@
url(r'^renkan/edit/$', TemplateView.as_view(template_name="renkan_edit.html"), name='renkan_edit'),
url(r'^renkan/getput/$', RenkanGetPut.as_view(), name='renkan_get_put'),
+ url(r'^renkan/copy/(?P<rk_id>.*)$', RenkanCopy.as_view(), name='renkan_copy'),
url(r'^profile/$', ProfileHome.as_view(), name='profile_home'),
)
--- a/src/hdalab/views/profile.py Thu Jul 17 15:39:28 2014 +0200
+++ b/src/hdalab/views/profile.py Thu Jul 17 16:47:29 2014 +0200
@@ -23,13 +23,13 @@
# now = datetime.utcnow().isoformat()
#
# rk = Renkan()
-# rk.rk_id = now
+# rk.rk_id = unicode(uuid.uuid1())
# rk.owner = self.request.user
# rk.content = '{"parrot":"dead"}'
# rk.title = now
# rk.save()
- context['renkan_list'] = Renkan.objects.all()
+ context['renkan_list'] = Renkan.objects.all().order_by("-modification_date")
#now = datetime.utcnow()
#context['renkan_list'] = [
@@ -38,5 +38,6 @@
#]
return context
+
\ No newline at end of file
--- a/src/hdalab/views/renkan.py Thu Jul 17 15:39:28 2014 +0200
+++ b/src/hdalab/views/renkan.py Thu Jul 17 16:47:29 2014 +0200
@@ -5,11 +5,14 @@
@author: tc
'''
from datetime import datetime
+from django.core.urlresolvers import reverse
from django.db.models import Q
from django.http.response import HttpResponse
-from django.views.generic import View
+from django.shortcuts import get_object_or_404, redirect
from django.views.decorators.csrf import csrf_exempt
+from django.views.generic import View, RedirectView
from hdabo.models import Tag
+from hdalab.models.renkan import Renkan
from hdalab.utils import LineNodePlacer
from hdalab.views.ajax import filter_generic
import json
@@ -146,5 +149,20 @@
def put(self, request):
return HttpResponse("OK")
-
+
+
+
+
+
+class RenkanCopy(View):
+
+ def get(self, request, rk_id):
+ old_rk = get_object_or_404(Renkan, rk_id=rk_id)
+ rk = Renkan()
+ rk.rk_id = unicode(uuid.uuid1())
+ rk.owner = request.user
+ rk.content = old_rk.content
+ rk.title = old_rk.title + " (copy)"
+ rk.save()
+ return redirect(reverse('profile_home'))
\ No newline at end of file