Пример #1
0
def edit_diagram(request, id=0):
	diagram = get_object_or_404(Diagram, id = id)
	
	# authorization
	if diagram.creator != request.user: return unauthorized(message = 'you\'re not authorized to edit data of that diagram')

	return update_object(request, form_class = EditDiagramForm, object_id = diagram.id, post_save_redirect = '/project/%i/' % diagram.project.id)
Пример #2
0
def	im_edit(request, object_id):
	return	update_object (
		request,
		form_class = IMForm,
		object_id = object_id,
		template_name = 'core/im_form.html',	# FIXME: 
	)
Пример #3
0
def exercise_list_add_or_update(request, list_id=None):
    if list_id:
        return update_object(request, model=ExerciseList, object_id=list_id, 
                template_name='exercise_list_form.html', post_save_redirect='/')
    else:
        return create_object(request, model=ExerciseList, 
                template_name='exercise_list_form.html', post_save_redirect='/')
Пример #4
0
def configuration(request):
    """
        This view is used to create, display or edit configuration
        of our tool. Currently this view is used for setting path
        to local meta sploit framework, or setting the IP address and destination
        port of the remote meta sploit framework.
        This view is based on Django generic views. If configuration object
        does not exist in the database we create it. If exist, just display
        and update it.
    """
    # if Configuration object exists in the model, we use
    # Django's generic view (django.views.generic.create_update.update_object)
    try:
        p = Configuration.objects.get()
        return update_object(request,
                         model=Configuration,
                         object_id="1",
                         template_name="configuration.html",
                         post_save_redirect="/",
                         extra_context={ 'menuitems' : createMenu("config")}
                         )
    # else if Configuration object does not exist
    # it is probably first run, the database is  empty and
    # we should initialize the configuration by creating
    # object using django[...] generic view for creating objects.
    except Configuration.DoesNotExist:
        return create_object(request,
                         model=Configuration,
                         template_name="configuration.html",
                         post_save_redirect="/",
                         extra_context={ 'menuitems' : createMenu("config")}
                         )
Пример #5
0
def item_metadata(request, item_id):
    return update_object(request,
        form_class = ItemMetadataForm,
        object_id = item_id,
        template_name = "spindle/item_metadata.html",
        template_object_name = "item",
        post_save_redirect = reverse(item_metadata, kwargs={'item_id': item_id}))
Пример #6
0
def editar_mascota(request, id):
    return create_update.update_object(
        request,
        object_id = id,
        form_class = MascotaForm,
        post_save_redirect = '/ver_mis_mascotas/'
    )
Пример #7
0
def tag_edit(request, slug, **kwargs):
    """Edits a tag.
    """
    return create_update.update_object(request,
                                       slug=slug,
                                       form_class=TagForm,
                                       template_name='taxonomy/tag_edit.html')
Пример #8
0
def	www_edit(request, object_id):
	return	update_object (
		request,
		form_class = WWWForm,
		object_id = object_id,
		template_name = 'core/www_form.html',	# FIXME: 
	)
Пример #9
0
def	person_edit(request, object_id):
	return	update_object (
		request,
		form_class = PersonForm,
		object_id = object_id,
		template_name = 'contact/person_form.html',	# FIXME: 
	)
Пример #10
0
def edit_page(request, page_slug=WIKI_DEFAULT_PAGE, design_slug=WIKI_DEFAULT_DESIGN):
    try:
        page = Page.objects.get(slug__iexact=page_slug)
    except Page.DoesNotExist:
        page = Page(slug=page_slug, title=page_slug, content="Click edit to change the page")
        page.save()
    try:
        design = Design.objects.get(slug__iexact=design_slug)
    except Design.DoesNotExist:
        raise Http404

    template = os.path.join(design.path, "edit.html")
    if design_slug != WIKI_DEFAULT_DESIGN:
        view_page = WIKI_PREFIX_URL + "%s/%s" % (design_slug, page_slug)
    else:
        view_page = WIKI_PREFIX_URL + "%s" % (page_slug)

    if not page.editable:
        return HttpResponseRedirect(view_page)

    return create_update.update_object(
        request,
        form_class=PageForm,
        object_id=page.id,
        post_save_redirect=view_page,
        template_name=template,
        template_object_name="page",
        extra_context={
            "design": design,
            "media_url": WIKI_PREFIX_URL + "site_media/" + design_slug,
            "wiki_url": WIKI_PREFIX_URL,
        },
    )
Пример #11
0
def password(request):
    return update_object(request,
                         form_class=AccountEditForm,
                         object_id=request.user.id,
                         template_name='account/password.html',
                         post_save_redirect="?",
                         extra_context={'profile': request.user.get_profile()})
Пример #12
0
def vocal_contest_guest(request):
    contest = VocalContest.objects.get_current()
    if contest\
    and contest.status() == 'open'\
    and contest.is_real:
        rvc = RealVocalContestGuest.objects.filter(user=request.user)
        if rvc:
            return update_object(
                request,
                form_class=RealVocalContestGuestForm,
                object_id=rvc[0].id,  #should be
                login_required=True,
                template_name='vocal_contest/guest.html',
                post_save_redirect=reverse('vocal_contest_index'),
                extra_context={
                    'contest': contest,
                    'edit': True
                })

        else:
            return create_object(
                request,
                form_class=RealVocalContestGuestForm,
                login_required=True,
                template_name='vocal_contest/guest.html',
                post_save_redirect=reverse('vocal_contest_index'),
                extra_context={
                    'contest': contest,
                })
    else:
        return redirect(vocal_contest_index)
Пример #13
0
def settingsPage(request, *args, **kwargs):
	profile, created = Profile.objects.get_or_create(user=request.user)

	return update_object(request,
                        form_class=ProfileForm,
                        object_id=profile.id,
                        template_name='pages/settings.html')
Пример #14
0
def update_recipe(request, recipe_id):
    file_form = Recipe_File_Form()
    _verify_permission(request, 'aboyeur.change_recipe')
    recipe = Recipe.objects.get(pk=recipe_id)
    if recipe.author != request.user:
        return redirect('/')
    form = RecipeForm(request.POST)
    if request.FILES:
        recipe_file = request.FILES['file']
        recipe_file_container = Recipe_file()
        recipe_file_container.recipe = recipe
        recipe_file_container.file = recipe_file
        try:
            recipe_file_container.clean()
        except:
            return render_to_response(
                'aboyeur/recipe_form.html', {
                    'form': form,
                    'file_form': file_form,
                    'recipe': recipe,
                    'file_error': 'Attachment does not comply with limits'
                },
                context_instance=RequestContext(request))

        recipe.recipe_file_set.all().delete()
        recipe_file_container.save()

    return update_object(request,
                         form_class=RecipeForm,
                         object_id=recipe_id,
                         post_save_redirect='/accounts/profile/',
                         template_object_name='recipe',
                         extra_context={'file_form': file_form})
Пример #15
0
def edit_singleton_model(request,
                         templatename,
                         redirect_to,
                         formclass=None,
                         model=None,
                         extra_context=None,
                         reload_bacula=True):

    if not '/' in redirect_to:
        redirect_to = reverse(redirect_to)

    if not formclass and model:
        formclass = forms.form(model)
    try:
        r = update_object(request,
                          object_id=1,
                          form_class=formclass,
                          model=model,
                          template_name=templatename,
                          post_save_redirect=redirect_to,
                          extra_context=extra_context)
    except Http404, error:
        r = create_object(request,
                          form_class=formclass,
                          model=model,
                          template_name=templatename,
                          post_save_redirect=redirect_to,
                          extra_context=extra_context)
Пример #16
0
def update(request, post_save_redirect, acl_handler=DEFAULT_ACL_HANDLER, 
    *args, **kwargs):
    """thin wrapper around django generic view to support reverse  urls
    """
    return update_object(request=request, 
        post_save_redirect=reverse(post_save_redirect), 
        extra_context=_process_rights(request, acl_handler), *args, **kwargs)
Пример #17
0
def entry_edit(request, blog, e_id):
	entry = get_object_or_404(Entry, pk=e_id, blog__slug__exact=blog)
	if not request.user.is_authenticated():
		return HttpResponseRedirect('/staff/login/?return=%s' % request.get_full_path())
	elif has_blog_access(request.user, blog) and request.user.has_perm('blog.change_entry') or (request.user.has_perm('blog.change_own_entry') and entry.author.user == request.user):
		c = {'edit_entry': True,
			 'moderate_entry': request.user.has_perm('blog.moderate_entry'),
			 'blog': Blog.objects.get(slug__exact=blog)}
		if request.POST:
			url = request.POST.get('url', '/staff/blogs/%s/list/' % blog)
			# intercept a draft delete request
			if request.POST.get('draft-delete') == '1' and not entry.is_published and (request.user.has_perm('blog.delete_entry') or (request.user.has_perm('blog.delete_own_draft') and entry.author.user == request.user)):
				entry.delete()
				request.session['flash_msg'] = 'Draft successfully deleted.'
				request.session['flash_params'] = {'type': 'success',
												   'action': 'delete'}
				return HttpResponseRedirect(url)
			else:
				request.session['flash_msg'] = 'Entry successfully edited.'
				request.session['flash_params'] = {'type': 'success',
												   'action': 'edit'}
		else:
			url = '/staff/blogs/%s/list/' % blog
		return update_object(request,
							 model=Entry,
							 extra_context=c,
							 object_id=e_id,
							 template_name='staff/blog/entry_form.html',
							 post_save_redirect=url)
	else:
		return render_to_response('staff/access_denied.html',
								  {'missing': 'edit',
								   'staffapp': 'this entry'},
								  context_instance=RequestContext(request))		   
Пример #18
0
def update_recipe(request, recipe_id):
    file_form = Recipe_File_Form()
    _verify_permission(request, 'aboyeur.change_recipe')
    recipe = Recipe.objects.get(pk=recipe_id)
    if recipe.author != request.user:
        return redirect('/')
    form = RecipeForm(request.POST)
    if request.FILES:
        recipe_file = request.FILES['file']
        recipe_file_container = Recipe_file()
        recipe_file_container.recipe = recipe
        recipe_file_container.file = recipe_file
        try:
            recipe_file_container.clean()
        except:
            return render_to_response('aboyeur/recipe_form.html', {
                'form': form, 'file_form':file_form, 'recipe':recipe, 'file_error': 'Attachment does not comply with limits'
            }, context_instance=RequestContext(request))
            
        recipe.recipe_file_set.all().delete()
        recipe_file_container.save()

    return update_object(request,
        form_class=RecipeForm,
        object_id=recipe_id,
        post_save_redirect='/accounts/profile/',
        template_object_name='recipe',
        extra_context={'file_form':file_form}
    )
Пример #19
0
def course_add_or_update(request, course_id=None):
    if course_id:
        return update_object(request, model=Course, object_id=course_id, 
                template_name='course_form.html', post_save_redirect='/')
    else:
        return create_object(request, model=Course, 
                template_name='course_form.html', post_save_redirect='/')
Пример #20
0
def update_entry(request, entry_id, account_id=None):
    if not request.user.is_superuser:
        entry = get_object_or_404(Entry, owner=request.user, pk=entry_id)
    else:
        entry = get_object_or_404(Entry, pk=entry_id)

    if account_id:
        account = get_object_or_404(Account, pk=account_id)
        if entry.account != account:
            raise Http404

        reverse_url = reverse('view_entry', kwargs={
            'entry_id': entry_id,
            'account_id': account_id,
        })
        extra_context = {
            'account': account,
        }
    else:
        reverse_url = reverse('view_entry', kwargs={'entry_id': entry_id})
        extra_context = {}

    return update_object(
        request,
        form_class = get_entry_form(request, account_id),
        post_save_redirect = reverse_url,
        object_id = entry_id,
        template_name = 'entry_form.html',
        extra_context = extra_context,
    )
Пример #21
0
def edit_doc(request, *args, **kwargs):
    """View to edit documentation."""

    project_name = kwargs['project_name']
    project = get_object_or_404(CollabProject, slug=project_name)
    project_id = project.id

    if not is_allowed(request, project_id, 'documentation', 'Editable'):
        return handle_privilege(
            request,
            "You do not have privileges to edit the documentation section!",
            project.get_absolute_url())

    view_dict = {
        'form_class':
        DocumentationForm,
        'object_id':
        project_id,
        'post_save_redirect':
        reverse('documentation', kwargs={'project_name': project_name}),
        'login_required':
        True,
        'template_name':
        'project/doc_edit.html',
        'extra_context': {
            'project': project
        },
    }

    return create_update.update_object(request, **view_dict)
Пример #22
0
def	org_edit(request, object_id):
	return	update_object (
		request,
		form_class = OrgForm,
		object_id = object_id,
		template_name = 'contact/org_form.html',	# FIXME: 
	)
Пример #23
0
def edit_announcement(request, *args, **kwargs):
    """View for editing announcements"""

    project_name = kwargs['project_name']
    project = get_object_or_404(CollabProject, slug=project_name)
    project_id = project.id

    if not is_allowed(request, project_id, 'announcements', 'Editable'):
        return handle_privilege(
            request, "You do not have privileges to edit announcements!",
            project.get_absolute_url())

    anonymous = Role.objects.get(project=project, name="AnonymousRole")
    if not anonymous.privileges.filter(permission_type='Viewable',
                                       related_model='announcements'.lower()):
        announce_warning = True
    else:
        announce_warning = False

    print announce_warning
    view_dict = {
        'form_class': AnnouncementForm,
        'object_id': project_id,
        'post_save_redirect': project.get_absolute_url(),
        'login_required': True,
        'template_name': 'project/edit_announce.html',
        'extra_context': {
            'project': project,
            'announce_warning': announce_warning
        },
    }

    return create_update.update_object(request, **view_dict)
Пример #24
0
def admin_settings(request):
    the_exam = Exam.objects.all()[0]
    return create_update.update_object(request, form_class=ExamForm,
                                                object_id=the_exam.id,
                                                post_save_redirect="/admin/settings/", 
                                                template_name="admin_settings.html",
                                                extra_context={'tab_number': 3})                                    
Пример #25
0
def edit_proposal(request, space_name, prop_id):

    """
    The proposal can be edited by space and global admins, but also by their
    creator.

    :rtype: HTML Form
    :context: get_place
    """
    current_space = get_object_or_404(Space, url=space_name)
    current_proposal = get_object_or_404(Proposal, id=prop_id)
    current_user = request.user.username

    can_edit = request.user.has_perm('Proposal.edit_proposal')

    allow_edit = 0

    if can_edit or current_user == current_proposal.author:
        return update_object(request,
                             model = Proposal,
                             object_id = prop_id,
                             login_required = True,
                             template_name = 'proposals/proposal_edit.html',
                             post_save_redirect = '../',
                             extra_context = {'get_place': current_space})
Пример #26
0
def	phone_edit(request, object_id):
	return	update_object (
		request,
		form_class = PhoneForm,
		object_id = object_id,
		template_name = 'core/phone_form.html',	# FIXME: 
	)
Пример #27
0
def profile(request, next=SNAP_PREFIX):
    '''
    Allow user to edit his/her profile.  Requires login.

    There are several newforms bugs that affect this.  See
        http://code.google.com/p/snapboard/issues/detail?id=7

    We'll use generic views to get around this for now.
    '''
    if COOKIE_SNAP_PROFILE_KEY in request.session:
        # reset any cookie variables
        request.session[COOKIE_SNAP_PROFILE_KEY] = {}
    
    try:
        userdata = SnapboardProfile.objects.get(user=request.user)
    except:
        userdata = SnapboardProfile(user=request.user)
        userdata.save()
    print dir(RequestContext(request).dicts)
    from django.views.generic.create_update import update_object
    return update_object(request,
            model=SnapboardProfile, object_id=userdata.id,
            template_name='snapboard/profile.html',
            post_save_redirect=next
            )
Пример #28
0
def	email_edit(request, object_id):
	return	update_object (
		request,
		form_class = EmailForm,
		object_id = object_id,
		template_name = 'core/email_form.html',	# FIXME: 
	)
Пример #29
0
def manage(request, package, **kwargs):
    kwargs['object_id'] = package
    kwargs.setdefault('form_class', PackageForm)
    kwargs.setdefault('template_name', 'djangopypi/package_manage.html')
    kwargs.setdefault('template_object_name', 'package')

    return create_update.update_object(request, **kwargs)
Пример #30
0
def update(request, id):
	return update_object(request,
        form_class=ReparacionForm,
        object_id=id,
        template_name='common/detail.html',
        post_save_redirect="/taller"
    )      
Пример #31
0
def manage(request, package, **kwargs):
    kwargs['object_id'] = package
    kwargs.setdefault('form_class', PackageForm)
    kwargs.setdefault('template_name', 'djangopypi/package_manage.html')
    kwargs.setdefault('template_object_name', 'package')

    return create_update.update_object(request, **kwargs)
Пример #32
0
def document_page_transformation_edit(request, document_page_transformation_id):
    check_permissions(request.user, "documents", [PERMISSION_DOCUMENT_TRANSFORM])

    document_page_transformation = get_object_or_404(DocumentPageTransformation, pk=document_page_transformation_id)
    return update_object(
        request,
        template_name="generic_form.html",
        form_class=DocumentPageTransformationForm,
        object_id=document_page_transformation_id,
        post_save_redirect=reverse("document_page_view", args=[document_page_transformation.document_page.id]),
        extra_context={"object_name": _(u"transformation")},
    )

    return render_to_response(
        "generic_form.html",
        {
            "form": form,
            "object": document_page_transformation.document_page,
            "title": _(u'Edit transformation "%(transformation)s" for page: %(page)s of document: %(document)s')
            % {
                "transformation": document_page_transformation.get_transformation_display(),
                "page": document_page_transformation.document_page.page_number,
                "document": document_page_transformation.document_page.document,
            },
        },
        context_instance=RequestContext(request),
    )
Пример #33
0
def edit_profile(request):
    return update_object(
        request,
        form_class=forms.UserProfileForm,
        object_id=request.user.get_profile().pk,
        extra_context={"user": request.user},
    )
Пример #34
0
def edita_cliente(request, object_id):
    user = request.user
    if user.cliente_set.all():
        cliente = user.cliente_set.all()[0]
        if not user.has_perm('modulo_funcionarios.pode_editar_qualquer_cliente') and cliente.id != int(object_id):
            return HttpResponseRedirect('/pizzer/usuario/login/')
    return update_object(request, object_id=object_id, template_name='edicao_cliente.html', form_class=ClienteForm)
Пример #35
0
def	jobrole_edit(request, object_id):
	return	update_object (
		request,
		form_class = JobRoleForm,
		object_id = object_id,
		template_name = 'contact/jobrole_form.html',	# FIXME: 
	)
Пример #36
0
def role_edit(request, role_id):
    check_permissions(request.user, [PERMISSION_ROLE_EDIT])

    return update_object(request, template_name='generic_form.html',
        form_class=RoleForm, object_id=role_id, extra_context={
        'template_id': u'role_edit',
        'object_name': _(u'role')})
Пример #37
0
def modificar_nota(request, id):

    return update_object(request,
                         model=Nota,
                         object_id=id,
                         template_name='modificar.html',
                         post_save_redirect=reverse("lista_de_notas"))
Пример #38
0
def edit(request, band_slug):
    """
    edit a band
    """
    band = get_object_or_404(Band, slug=band_slug)

    # Check if we're allowed to edit this band
    if not request.user.has_perm('band.can_manage', band):
        return HttpResponseForbidden('You are not allowed to manage this band')


    if request.method == 'POST':
        band_form = BandUpdateForm(request.POST, request.FILES,
                                   instance=band)

        if band_form.is_valid():
            band = band_form.save(commit=False)
            band.genres = ", ".join(request.POST.getlist('genres') or [])

            # Lookup Geo
            g = geocoders.Google(settings.GOOGLE_MAPS_API_KEY)

            # Ugly hack to get a place from geocoders -_-
            where = u'%s %s, %s' % (band.zipcode,
                                    band.city,
                                    band.country.name)

            geoplace = _("Unable to lookup address")
            lat = lng = 0
            for match in g.geocode(where.encode('utf-8'),
                                   exactly_one=False):
                geoplace, (lat, lng) = match
                # Get the first result
                break

            # Edit
            point = Point(lng, lat)
            if band.place:
                place = band.place
                place.address = geoplace
                place.geom = point
                place.save()
            else:
                place = Place.objects.create(address=geoplace, geom=point)

            band.place = place
            band.save()

            messages.success(request, _(u"%s was successfully updated" % band.name))

            return redirect('presskit:mypresskit', band.slug)


    return update_object(request,
                         form_class=BandUpdateForm,
                         slug=band_slug,
                         template_name='bands/band_update.html',
                         extra_context={'band': band},
                         )
Пример #39
0
def test_view_update(request, obj_id=None):
    return create_update.update_object(
        request,
        PermissionTestClass,
        object_id=obj_id,
        template_name="permissions/empty.html",
        post_save_redirect=reverse("test_view_update", kwargs=dict(obj_id=obj_id)),
    )
Пример #40
0
def entry_update(request, object_id):
    return create_update.update_object(
        request,
        object_id = object_id,
        model = Entry,
        # post_save_redirect = request.POST['referrer'],
        template_object_name = 'entry',
    )
Пример #41
0
def contact_edit(request, id, **kwargs):
    """Edits a contact.
    """
    return create_update.update_object(
        request,
        object_id=id,
        form_class=ContactForm,
        template_name='partners/contact_edit.html')
Пример #42
0
def item_metadata(request, item_id):
    return update_object(request,
                         form_class=ItemMetadataForm,
                         object_id=item_id,
                         template_name="spindle/item_metadata.html",
                         template_object_name="item",
                         post_save_redirect=reverse(
                             item_metadata, kwargs={'item_id': item_id}))
Пример #43
0
def product_edit(request, id, **kwargs):
    """Edits a product.
    """
    return create_update.update_object(
        request,
        object_id=id,
        form_class=ProductForm,
        template_name='products/product_edit.html')
Пример #44
0
def role_edit(request, role_id):
    Permission.objects.check_permissions(request.user, [PERMISSION_ROLE_EDIT])

    return update_object(request,
                         template_name='generic_form.html',
                         form_class=RoleForm,
                         object_id=role_id,
                         extra_context={'object_name': _(u'role')})
Пример #45
0
def edit_view(request, issue_num, object_id):
    common_declarations(issue_num_arg=issue_num, cat_name_arg='')
    redirect_dir = '/sites/specs/koputuksia/' + issue_num + '/' + object_id + '/'
    return update_object(request,
                         model=Juttu,
                         object_id=object_id,
                         post_save_redirect=redirect_dir,
                         extra_context=context)
Пример #46
0
def warehouse_edit(request, id, **kwargs):
    """Edits a warehouse.
    """
    return create_update.update_object(
        request,
        object_id=id,
        form_class=WarehouseForm,
        template_name='stock/warehouse_edit.html')
Пример #47
0
def modificar_nota(request, id):
    
    return update_object(request,
        model=Nota,
        object_id=id,
        template_name='modificar.html',
        post_save_redirect=reverse("lista_de_notas")
    )         
Пример #48
0
def notes_update(request, id):
    """Update sebuah note"""

    return update_object(request,
                         model=Notes,
                         object_id=id,
                         template_name='notes/update.html',
                         post_save_redirect=reverse("notes_list"))
Пример #49
0
def faq_edit(request, id, **kwargs):
    """Edits the given FAQ.
    """
    return create_update.update_object(request,
                                       form_class=FaqForm,
                                       object_id=id,
                                       template_name='knowledge/faq_edit.html',
                                       **kwargs)
Пример #50
0
def edit(request, model, slug=None):
    modelm = get_model('maap',model)
    return create_update.update_object(
        request, 
        model=model, 
        slug=slug, 
        template_name='maap/object_form.html',
        extra_context={'model':model.__name__})  
Пример #51
0
def edit(request, agg_id=None):
    return create_update.update_object(
        request,
        form_class=DummyAggForm,
        object_id=agg_id,
        post_save_redirect="/",
        template_name="aggregate_tests/form.html",
    )
Пример #52
0
def category_edit(request, slug, **kwargs):
    """Edits a category.
    """
    return create_update.update_object(
        request,
        slug=slug,
        form_class=CategoryForm,
        template_name='taxonomy/category_edit.html')
Пример #53
0
def job_edit(request, job_id, auth):
    ''' A view for editing published or unpublished job posts.
    '''
    job = get_object_or_404(Job, pk=job_id, auth=auth)
    if job.status not in (Job.ACTIVE, Job.TEMPORARY):
        raise Http404
    return update_object(request, form_class=JobForm, object_id=job_id,
           post_save_redirect='../../../'+
           djobberbase_settings.DJOBBERBASE_VERIFY_URL+'/%(id)d/%(auth)s/')
Пример #54
0
def bankaccount_edit(request, id, **kwargs):
    """Edits a bank account.
    """
    return create_update.update_object(
        request,
        object_id=id,
        form_class=BankAccountForm,
        template_name='sales/bankaccount_edit.html'
    )
Пример #55
0
def edit(request, object_id):
    extra_context = {'title': u"Editar armazenamento"}
    return create_update.update_object(request,
                                       object_id=object_id,
                                       model=Storage,
                                       form_class=form(Storage),
                                       template_name="storages_edit.html",
                                       extra_context=extra_context,
                                       post_save_redirect="/storages/list")
Пример #56
0
def partner_edit(request, id, **kwargs):
    """Edits a partner.
    """
    return create_update.update_object(
        request,
        object_id=id,
        form_class=PartnerForm,
        template_name='partners/partner_edit.html'
    )
Пример #57
0
def edit_book(request, book_id):
    extra_context = {'action': 'edit'}
    return update_object(
        request,
        form_class=BookForm,
        object_id=book_id,
        template_object_name='book',
        extra_context=extra_context,
    )
Пример #58
0
def edit(request, object_id):
    extra_context = {'title': u"Editar computador"}
    return create_update.update_object(request, 
                                       object_id = object_id,
                                       model = Computer,
                                       form_class = form(Computer),
                                       template_name = "base_computers.html",
                                       extra_context = extra_context,
                                       post_save_redirect = "/computers/")
Пример #59
0
def event_edit(request, id, **kwargs):
    """Edits an event.
    """
    return create_update.update_object(
        request,
        form_class=EventForm,
        object_id=id,
        template_name='calendar/event_edit.html',
        **kwargs)