upload_to not found
Hi, I was trying out a form - with filefield. I used the option upload_to, and django server erred out saying - upload_to not found. I checked django code : >>> import django >>> django.VERSION (1, 0, 2, 'final', 0) class FileField(Field): widget = FileInput default_error_messages = { 'invalid': _(u"No file was submitted. Check the encoding type on the form."), 'missing': _(u"No file was submitted."), 'empty': _(u"The submitted file is empty."), } def __init__(self, *args, **kwargs): super(FileField, self).__init__(*args, **kwargs) --> As we can see there is no upload_to parameter in it. I am sure I am missing something because upload_to seems to be the basic option as per documents. Can somebody help me out? Regards K --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django: creating formset is very slow
I tried with 500 forms instead of 25. Now the time is becoming appaling.--- 117 seconds. Second time it hung. 2009-01-07 01:42:13,812 INFO Start - 4.46984183744e-006 2009-01-07 01:42:13,812 INFO Formset Class created- 0.000422958783868 2009-01-07 01:44:11,703 INFO Created new formset- 117.90750668 2009-01-07 01:44:17,203 INFO All forms done - 123.39991647 2009-01-07 01:44:17,217 INFO Start - 123.416734808 2009-01-07 01:44:17,217 INFO Formset Class created- 123.41704658 Regards K On 1/7/09, Kottiyath Nair wrote: > > Hi all, >My web application sends a medium size data grid (20 elements). I was > using formsets for the same. >The issue I am facing is that the formset instantiation is very very > slow. I timed it and it is taking ~4-7 seconds for it to instantiate. >Is there someway the speed can be increased? > > There are no files sent. I am planning to, later. > The code: > logging.info('Start - %s' %time.clock()) > DataFormSet = formset_factory(DataForm, extra=25) > logging.info('Formset Class created- %s' %time.clock()) > formset = DataFormSet(request.POST, request.FILES) > logging.info('Created new formset- %s'%time.clock()) > > From my logs: > 2009-01-06 22:53:30,671 INFO Start - 0 > 2009-01-06 22:53:30,671 INFO Formset Class created- 0.000403403225829 > 2009-01-06 22:53:34,296 INFO Created new formset- 3.62182316468 > or later > 2009-01-06 22:56:37,500 INFO Start - 186.836136716 > 2009-01-06 22:56:37,500 INFO Formset Class created- 186.836445135 > 2009-01-06 22:56:43,108 INFO Created new formset- 192.440754621 > > >Please note that I am running the whole thing under the django > development server in my laptop itself and not a server. > --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django: creating formset is very slow
Hi all, My web application sends a medium size data grid (20 elements). I was using formsets for the same. The issue I am facing is that the formset instantiation is very very slow. I timed it and it is taking ~4-7 seconds for it to instantiate. Is there someway the speed can be increased? There are no files sent. I am planning to, later. The code: logging.info('Start - %s' %time.clock()) DataFormSet = formset_factory(DataForm, extra=25) logging.info('Formset Class created- %s' %time.clock()) formset = DataFormSet(request.POST, request.FILES) logging.info('Created new formset- %s'%time.clock()) >From my logs: 2009-01-06 22:53:30,671 INFO Start - 0 2009-01-06 22:53:30,671 INFO Formset Class created- 0.000403403225829 2009-01-06 22:53:34,296 INFO Created new formset- 3.62182316468 or later 2009-01-06 22:56:37,500 INFO Start - 186.836136716 2009-01-06 22:56:37,500 INFO Formset Class created- 186.836445135 2009-01-06 22:56:43,108 INFO Created new formset- 192.440754621 Please note that I am running the whole thing under the django development server in my laptop itself and not a server. --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django forms usage with mutliple rows
Hi, Since I am a newbie in HTML and Django, there might be a completely different way to do this. If somebody can point that also, it would be helpful. I want to send multiple rows of data from a datagrid to a django server. Currently, I am doing it in a single form inside a page with the parameters as array. Please note that this value can change from 1 row to 25 rows. The example get statement for 3 rows would look like: ../send_multiple_values_through_one_form.html?foo[secret]=my+hidden+value&foo[product-id]=1&bar[secret]=my+hidden+value&bar[product-id]=2&baz[secret]=my+hidden+value&baz[product-id]=3 Now, I want to use Django forms to validate this data. class UploadQueryForm(forms.Form): secret = forms.IntegerField() product_id = forms.CharField(max_length=50) But this can be used to handle only one row . How can I use this for multiple rows? Is Django Formsets used for this purpose? Please note that I am not averse to other ideas - (say multiple forms etc), but I cannot think of any other way to implement this from HTML perspective itself. Regards K --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Creating a custom sql query
Thank you, Karen. On Fri, Dec 12, 2008 at 7:42 PM, Karen Tracey wrote: > On Fri, Dec 12, 2008 at 4:32 AM, Kottiyath Nair wrote: > >> oops!! Unknowingly send the mail before finishing it. >> >> As I was mentioning in the earlier mail: >> What I want is: >>dbmodel.objects.filter(__first_filter).sum(), should be able to sum >> across the filtered data. >> >> If somebody could help me out on this, I would be very thankful. >> > > I don't know of any way to do what you are looking for here without > aggregate support in the ORM. The good news is that's on the 1.1 must-have > features list. The ticket to watch is > http://code.djangoproject.com/ticket/3566. Russell's got the current code > publicly available in a git clone of Django's svn so it's possible to try it > out (if you already use git or are willing to learn it). > > >> >> P.S-> Also, is it safe to use the backends.quote_name for getting the name >> of the table in the DB? Is there any other mechanism to get the original >> name of the table? >> >> > Don't know the answer to this one. > > Karen > > > > > --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Creating a custom sql query
oops!! Unknowingly send the mail before finishing it. As I was mentioning in the earlier mail: What I want is: dbmodel.objects.filter(__first_filter).sum(), should be able to sum across the filtered data. If somebody could help me out on this, I would be very thankful. P.S-> Also, is it safe to use the backends.quote_name for getting the name of the table in the DB? Is there any other mechanism to get the original name of the table? Regards, K > > --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---