Hey, i had issues with this before but i fixed the login problem i
believe. I cant seem to get my view to work it is supposed to take the
file from the form on the template and save it to my database and
directory. saving a file in the admin works just fine so i need some
help fixing the view and its interface with the template. The form is
created onthe site but it doesnt redirect or save anything to the
database when i hit submit. so here is the view:

@login_required
def bulk_reg(request):
    """Add large numbers of registrations by uploading a file"""
    manipulator = FileManipulator()
    data_domain = get_object_or_404(DataDomain, user=request.user.id)
    new_data = {}
    errors = {}

    if request.POST:
        new_data = request.POST.copy()
        new_data.update(request.FILES)
        errors = manipulator.get_validation_errors(new_data)

        if not errors:
            manipulator.do_html2python(new_data)

            fi = BulkDataRegFile(user = request.user.id,
                                 domain = data_domain,
                                 bulk = new_data['bulk'],)
            fi.save()

            return HttpResponseRedirect('/provider/')

    form = forms.FormWrapper(manipulator, new_data, errors)
    return render_to_response('provider/dataset/bulkreg.dht',
                              {'form': form},
 
context_instance=RequestContext(request))


and the following is the part of the template that concerns the form:

{% if form.has_errors %}
<h3 class="error_text">Please correct the form</h3>
{% endif %}

<form enctype="multipart/form-data" method="post"
      action="/provider/dataset/bulkreg/">

<fieldset>
    <label for="id_bulk">
        Select File:
    </label>
    {{ form.bulk }}{{ form.bulk_file }}
</fieldset>
<input type="submit" value="Register DataSets"/>
</form>

So if anyone can help me out that owuld be great.


--~--~---------~--~----~------------~-------~--~----~
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