"when i connect to the pages that should handle the upload, the person
is no longer logged in"

If that's true, then the problem isn't with this bulk_reg() function -
presumably it isn't running if you aren't logged in, right? Are you
using the suggested methods for loggin a user in (
http://www.djangoproject.com/documentation/authentication/#how-to-log-a-user-in
) ?

On Oct 3, 11:46 am, jacoberg2 <[EMAIL PROTECTED]> wrote:
> Hey,
>
>   I've posted a few times about saving files through the admin and all
> the problems its caused, but i figured out that the save method i
> tried to write was screwing it all up by not completing due to the
> error in opening the file. But since this is occuring it still is
> screwing up what i went out to do. So i am curious if this can be done
> in the view instead of the save method.
>
> I can get the file to save to the system through the admin interface,
> but what i cant seem to do is create a view that will save the file.
> the model has user and file fields and i want the view to be
> @login_required. What i have tried doesnt seem to follow with the
> login, meaning in the templates, which extends a base template that
> controls the login, when i connect to the pages that should handle the
> upload, the person is no longer logged in. and when i try the upload i
> dont get any errors, but the file is not saved to the file system or
> registered in the admin, so if anyone has any pointers or code it
> would be a great help. this is the view i have:
>
> @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},)
>
> the file manipulator is a custom manipulator that only includes the
> fileuploadfield and is_required is true.
> So i am hoping to get this to work and maybe open the file from the
> view and then parse it for more information if that would work. Any
> suggestions or code would be greatly appreciated.
>
> Jaco


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