#99 fixed problem with agenda-items and mptt

This commit is contained in:
Oskar Hahn 2012-04-18 14:36:03 +02:00
parent be6a63e48c
commit fbaa88c23a
2 changed files with 10 additions and 5 deletions

View File

@ -11,6 +11,7 @@
""" """
from reportlab.platypus import Paragraph from reportlab.platypus import Paragraph
from django.db.models import Model
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.contrib import messages from django.contrib import messages
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
@ -50,12 +51,14 @@ class Overview(TemplateView):
form = ItemOrderForm(request.POST, prefix="i%d" % item.id) form = ItemOrderForm(request.POST, prefix="i%d" % item.id)
if form.is_valid(): if form.is_valid():
try: try:
item.parent = Item.objects.get( parent = Item.objects.get(id=form.cleaned_data['parent'])
id=form.cleaned_data['parent'])
except Item.DoesNotExist: except Item.DoesNotExist:
item.parent = None parent = None
item.weight = form.cleaned_data['weight'] item.weight = form.cleaned_data['weight']
item.save() item.parent = parent
Model.save(item)
Item.objects.rebuild()
return self.render_to_response(context) return self.render_to_response(context)

View File

@ -11,13 +11,15 @@
""" """
from django.conf.urls.defaults import patterns, url, include from django.conf.urls.defaults import patterns, url, include
#todo: use this in evry file
from django.conf import settings from django.conf import settings
from django.utils.importlib import import_module from django.utils.importlib import import_module
import settings import settings
from utils.views import FrontPage from utils.views import FrontPage
handler500 = 'openslides.utils.views.server_error' handler500 = 'openslides.utils.views.server_error'