From f1e712b8d78bcc9787d47f6e3451d10facdec844 Mon Sep 17 00:00:00 2001 From: sanj Date: Fri, 14 May 2010 04:08:22 +0530 Subject: [PATCH] added registration templates --- edgware/editor/models.py | 8 +++++++ edgware/editor/views.py | 20 ++++++++++++++++- edgware/settings.py | 2 +- edgware/templates/registration/login.html | 26 +++++++++++++++++++++++ requirements.txt | 2 +- 5 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 edgware/templates/registration/login.html diff --git a/edgware/editor/models.py b/edgware/editor/models.py index 6794b2f..157fa85 100644 --- a/edgware/editor/models.py +++ b/edgware/editor/models.py @@ -281,6 +281,14 @@ class Page(models.Model): b.save() return self + def deleteme(self): + pages_after = Page.objects.filter(article=self.article, page_no__gt=self.page_no) + for p in pages_after: + p.page_no = p.page_no - 1 + p.save() + self.delete() + return + def get_dict(self, m): """ This function iterates through all boxes on the page and returns a Dict representation which the view converts to json to send to front-end. diff --git a/edgware/editor/views.py b/edgware/editor/views.py index d0b7f9f..bda6193 100644 --- a/edgware/editor/views.py +++ b/edgware/editor/views.py @@ -137,7 +137,7 @@ def imagebox_crop(request): } return HttpResponse(json.dumps(r), mimetype="application/json") - + def test_thumb(request): f = File.objects.filter(type__mime__exact='jpg')[0] r = {'path': 'media/images/original/facade.jpg'} @@ -590,6 +590,22 @@ def new_page(request): } return HttpResponse(json.dumps(r), mimetype="application/json") +@login_required_json +def delete_page(request): + page = get_object_or_404_json(Page, id=request.GET['id']) + rev_id = saveRevision({ + 'box_id': 0, + 'box_type': 'page', + 'prop': 'delete_page', + 'old_val': page.get_dict(1), + 'new_val': '', + 'uuid': request.GET['uuid'] + }) + r = { + 'rev_id': rev_id + } + return HttpResponse(json.dumps(r), mimetype="application/json") + def issue_list(request): issues = Issue.objects.all().order_by('issue_no') return render_to_response("issue_list.html", {'issues': issues}) @@ -605,6 +621,8 @@ def new_issue(request): def edit_issue(request, id): i = Issue.objects.get(pk=id) return render_to_response + + """ These are some views that I could think of that need to be created. Please add more. diff --git a/edgware/settings.py b/edgware/settings.py index 8a52ff3..03df3dd 100644 --- a/edgware/settings.py +++ b/edgware/settings.py @@ -101,7 +101,7 @@ INSTALLED_APPS = ( # 'south', 'django.contrib.comments', 'sorl.thumbnail', - 'django_firefogg', +# 'django_firefogg', ) #overwrite default settings with local settings diff --git a/edgware/templates/registration/login.html b/edgware/templates/registration/login.html new file mode 100644 index 0000000..f99e9a2 --- /dev/null +++ b/edgware/templates/registration/login.html @@ -0,0 +1,26 @@ +{% extends "base.html" %} + +{% block content %} + +{% if form.errors %} +

Your username and password didn't match. Please try again.

+{% endif %} + +
{% csrf_token %} + + + + + + + + + +
{{ form.username.label_tag }}{{ form.username }}
{{ form.password.label_tag }}{{ form.password }}
+ + + +
+ +{% endblock %} + diff --git a/requirements.txt b/requirements.txt index 66cbe9e..28439d8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ --e svn+http://code.djangoproject.com/svn/django/branches/releases/1.1.X/#egg=django +-e svn+http://code.djangoproject.com/svn/django/trunk/#egg=django -e bzr+http://code.0xdb.org/python-oxdjango/#egg=python-oxdjango -e svn+http://django-tagging.googlecode.com/svn/trunk/#egg=tagging -e bzr+http://firefogg.org/dev/python-firefogg/#egg=python-firefogg