def system_edit(request, system_name): try: system = System.objects.get(name=system_name) except System.DoesNotExist: raise Http404 no_changes = False try: NameField.existing_ok_name = system.name if request.method == 'POST': form = SystemForm(request.POST) if form.is_valid(): if (form.cleaned_data['name'] == system.name and form.cleaned_data['owner_email'] == system.owner_email and form.cleaned_data['operating_system'] == system.operating_system and form.cleaned_data['graphics'] == system.graphics and form.cleaned_data['processor'] == system.processor and form.cleaned_data['notes'] == system.notes): no_changes = True else: edit = _do_edit(system, form) return render_to_response( 'pages/system_edit_submitted.html', { 'page': 'edit_ok', 'page_title': "Edit Submitted", 'settings': settings, 'system': system }) else: form = SystemForm({ 'name': system.name, 'owner_email': system.owner_email, 'operating_system': system.operating_system, 'graphics': system.graphics, 'processor': system.processor, 'notes': system.notes }) return render_to_response( 'pages/system_edit.html', { 'page': 'edit', 'page_title': "Edit System", 'settings': settings, 'no_changes': no_changes, 'form': form, 'form_action': 'system/%d/edit' % system.id, 'form_submit': "Submit", 'system': system }) finally: NameField.existing_ok_name = None
def system_edit(request, system_name): try: system = System.objects.get(name=system_name) except System.DoesNotExist: raise Http404 no_changes = False try: NameField.existing_ok_name = system.name if request.method == 'POST': form = SystemForm(request.POST) if form.is_valid(): if (form.cleaned_data['name'] == system.name and form.cleaned_data['owner_email'] == system.owner_email and form.cleaned_data['operating_system'] == system.operating_system and form.cleaned_data['graphics'] == system.graphics and form.cleaned_data['processor'] == system.processor and form.cleaned_data['notes'] == system.notes): no_changes = True else: edit =_do_edit(system, form) return render_to_response('pages/system_edit_submitted.html', { 'page': 'edit_ok', 'page_title': "Edit Submitted", 'settings': settings, 'system': system }) else: form = SystemForm({ 'name': system.name, 'owner_email': system.owner_email, 'operating_system': system.operating_system, 'graphics': system.graphics, 'processor': system.processor, 'notes': system.notes }) return render_to_response('pages/system_edit.html', { 'page': 'edit', 'page_title': "Edit System", 'settings': settings, 'no_changes': no_changes, 'form': form, 'form_action': 'system/%d/edit' % system.id, 'form_submit': "Submit", 'system': system }) finally: NameField.existing_ok_name = None
def register(request): if request.method == 'POST': form = SystemForm(request.POST) if form.is_valid(): edit =_do_register(form) return render_to_response('pages/system_registered.html', { 'page': 'system_registered', 'page_title': "System Registered", 'settings': settings, 'edit': edit }) else: form = SystemForm() return render_to_response('pages/register.html', { 'page': 'register', 'page_title': "Register", 'settings': settings, 'form': form, 'form_action': 'register', 'form_submit': "Register" })
def register(request): if request.method == 'POST': form = SystemForm(request.POST) if form.is_valid(): edit = _do_register(form) return render_to_response( 'pages/system_registered.html', { 'page': 'system_registered', 'page_title': "System Registered", 'settings': settings, 'edit': edit }) else: form = SystemForm() return render_to_response( 'pages/register.html', { 'page': 'register', 'page_title': "Register", 'settings': settings, 'form': form, 'form_action': 'register', 'form_submit': "Register" })