Hi There, So, I am trying " http://docs.djangoproject.com/en/dev/topics/http/file-uploads/", but can't see the results.
I mean, I am confused because I don't know where to place the template (which I believe has to be "contact.html"). I have a folder "/mysite/templates/" and the tutorial "mysite/polls" works fine. Thus I have "/mysite/templates/polls" and "/mysite/templates/admin". So I am trying to place "/mysite/templates/contact.html" and when trying " http://localhost:8000/contact/" I got: Exception Type: TypeError at /contact/ Exception Value: 'str' object is not callable I still have no idea about how to follow this debugging message. Should I have to have "/mysite/templates/contact/contact.html"? Besides, what to put in urls.py ("/mysite/urls.py")? I am trying: from django.conf.urls.defaults import patterns, include # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/(.*)', admin.site.root), (r'^contact/', 'contact'), (r'^jobs/', include('mysite.jobs.urls')), ) "http://localhost:8000/jobs/" and "http://localhost:8000/admin/" work fines. Needless to say I am a naive novice to Django. If someone can point out what I am missing in " http://docs.djangoproject.com/en/dev/topics/http/file-uploads/" I would deeply grateful. Many thanks in advance. Alan On Mon, Dec 8, 2008 at 09:37, Alan <[EMAIL PROTECTED]> wrote: > Thank you very much Karen. > Indeed, reading Django docs I was getting something very close to what you > sent to me, but I am still failing to render (still have difficult to debug, > but getting there). With your example I believe can solve the issues I have. > > I will describe what I want to do. > > We have a python application that does heavy calculation (NMR structure > determination related). So, our (draft) portal should be a page where one > can upload a file (zip, containing the project to be calculated). Once > uploaded, I would like to keep in a DB (at first), project name, date & > time, path location. Once uploaded, the file should be unzipped in a > specific folder (path location, so I don't want to keep the zip file neither > in filesystem nor in DB) and call our python application to run it. I hope I > can enable this draft portal to send an e-mail when job is done with status > (failed or done, for example). > > Eventually, I intend to put a log in (user has to be identified) and a > parsed page (where user can tweak some parameters before clicking "Run" > bottom). > > Once again, thanks for your help. > > Alan > > On Fri, Dec 5, 2008 at 16:32, Karen Tracey <[EMAIL PROTECTED]> wrote: > >> On Thu, Dec 4, 2008 at 6:12 PM, Alan <[EMAIL PROTECTED]> wrote: >> >>> Hi there! >>> Although I have some experience in Python and Plone and have done Django >>> tutorial, I am still not getting how to do a simple task I proposed myself: >>> build a submitting page for a zip file. >>> >>> So I am looking at >>> http://docs.djangoproject.com/en/dev/topics/http/file-uploads/ >>> >>> It seems to have all I need, but I still don't know well how to connect >>> the dots. So, it would be really great if I could put my hands in a example >>> or, better, tutorial, of how to build such a page for submitting a file. >>> >>> The difficult I find is that when I was building webpages I used to think >>> first the html code and then the rest, but with Django, I feel I have to >>> think first models, but then I still lack how to link with view. >>> >> >> I think it makes sense to think first in terms of what you want to present >> to the user for your task, which in Django would be a combination of a form >> and template. From there start thinking about what your view code needs to >> do to manipulate the submitted form data to be saved in one or more model >> instances. What models you want to create rather depends on more than the >> one simple task of submitting a zip file -- what sorts of things do you want >> to do with the submitted zip files after they've been been submitted? >> >> If the form for your task maps nicely to a single model then perhaps it >> makes sense to use a ModelForm, but maybe not. In some cases what should >> logically be presented to the user doesn't map so nicely to what it makes >> logical sense to keep in your database, and then it's best to give up on the >> very easy ModelForm approach and write some custom forms and code that deals >> with mapping from what is best for the user to deal with to what is best to >> store in the DB. >> >> To give a concrete example, I have a crossword puzzle database to which I >> upload new published puzzles daily. Models in the DB include Publishers, >> Authors, Puzzles, Entries, and Clues. There is no PuzzleFile model -- >> uploading a new puzzle file will involve creating a new Puzzle instance, may >> involve creating a new Author instance, many new Entries instances, many new >> Clues, etc. Uploading and adding a puzzle is a two step process, the basic >> upload form is very simple and doesn't involve any models. The file is >> stashed in a staging area where it can be found and processed during the add >> step, which is where actual DB models are created/updated. In case it's of >> any illustrative use, here's the basics of the upload code: >> http://dpaste.com/96432/ -- form, view, and template. >> >> Karen >> >> >> >> > > > -- > Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate > Department of Biochemistry, University of Cambridge. > 80 Tennis Court Road, Cambridge CB2 1GA, UK. > >>http://www.bio.cam.ac.uk/~awd28<< > -- Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate Department of Biochemistry, University of Cambridge. 80 Tennis Court Road, Cambridge CB2 1GA, UK. >>http://www.bio.cam.ac.uk/~awd28<< --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---