something like this?
(don't now if you want the form from an instance or not, but assumed so, as
you are trying to change data, not?)

def comp(request, obj_id):
   instance = get_object_or_404(Model, obj_id)
   form = ItemForm(instance=instance)
   if request.method=="POST":
     form = ItemForm(request.POST, request.FILES, instance=instance)
     if form.is_valid():
         if form.price >= instance.price and form.pub_date <=
instance.pub_date:
           item = form.save(commit=False)
           item.seller = request.user
           item.save()
           form = ItemForm()
     else:
               pass
   return render_to_response(
         "add_item.html",
         {"form": form},context_instance=RequestContext(request))




On Wed, Oct 22, 2008 at 2:23 PM, Net_Boy <[EMAIL PROTECTED]> wrote:

>
> Hi,
>   I am trying to make a view function to get the posted values and
> make some comparison (if x.value >= y.value)..
> where x is the model that I got it's values from the post
> and   y is the other model .
>
> example:
>
> def comp(request):
>    form = ItemForm()
>    if request.method=="POST":
>      form = ItemForm(request.POST, request.FILES)
>      if form.is_valid():
>          if item.price >= old.price and item.pub_date <=
> old.pub_date
>            item = form.save(commit=False)
>            item.seller = request.user
>            item.save()
>            form = ItemForm()
>      else:
>                pass
>    return render_to_response(
>          "add_item.html",
>          {"form": form},context_instance=RequestContext(request))
>
> so if anyone know how to do that I would be grateful :)
>
>
> regards..
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to