Re: How to view/run first app?
> > Russell Keith-Magee writes: > I will gladly try and give feedback about the docs.. just wanted to know > what is the best place to send the feedback to. This list or the > developers > list? there is a space for comments on the docs at the foot of each doc - that is the recommended place kg --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Strings and % sign fails - Help Please
On 3/24/06, Siah <[EMAIL PROTECTED]> wrote: > > heh.. It works except I am using psycopg.Binary(somebinarystructure), > and I am not really doing it by hand to just add the extra %, and > psycopg.Binary doesn't do it. I'd imagine it's a bug with psycopg > package. Any quick way to project a string from freak '%' problems? > > Thanks, > Sia > say a = "select '%' " you can do: a = a.replace('%', '%%') -- I like python! My Blog: http://www.donews.net/limodou NewEdit Maillist: http://groups.google.com/group/NewEdit --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Strings and % sign fails - Help Please
heh.. It works except I am using psycopg.Binary(somebinarystructure), and I am not really doing it by hand to just add the extra %, and psycopg.Binary doesn't do it. I'd imagine it's a bug with psycopg package. Any quick way to project a string from freak '%' problems? Thanks, Sia --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Strings and % sign fails - Help Please
On 3/24/06, Siah <[EMAIL PROTECTED]> wrote: > > It seems like a freak problem to me. I spent a long hour to track the > problem down and here it is: > > The following statement fails because it has the '%' sign in it. > cursor.execute("select '%'") > > The error is: IndexError: list index out of range > > How do I address this problem? > > Please note that the following work just fine: > cursor.execute("select 'x'") > > and the following also fails with the same error: > cursor.execute("""select '%'""") > cursor.execute("select '\%'") > > astr = "select '\%'" > cursor.execute(astr) > > I greatly appreciate all helps, > Regards, > Sia > I didn't test, but you can try '%%' instead of '%'. -- I like python! My Blog: http://www.donews.net/limodou NewEdit Maillist: http://groups.google.com/group/NewEdit --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Strings and % sign fails - Help Please
It seems like a freak problem to me. I spent a long hour to track the problem down and here it is: The following statement fails because it has the '%' sign in it. cursor.execute("select '%'") The error is: IndexError: list index out of range How do I address this problem? Please note that the following work just fine: cursor.execute("select 'x'") and the following also fails with the same error: cursor.execute("""select '%'""") cursor.execute("select '\%'") astr = "select '\%'" cursor.execute(astr) I greatly appreciate all helps, Regards, Sia --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Advice on using model to bulk/batch load database
My motivation for using the Django ORM layer was simply to reuse the logic that parses text values to native values (html2python) and any column name mapping that goes on, both of which are managed by the *Field members. I know that's not a huge win, but since I'm at an early point in the project where I'm tweaking the schema quite a bit, its nice to know if I change an int field to a float, or add another field that was previously being skipped from the file, or rename a column, it just works. But I see your point - it remains to be seen if I'm getting enough benefit to justify this approach. Speed really isn't an issue right now. Each file takes a few seconds to load (up to a minute for the really large ones) and they run as scheduled jobs over night. And this is all running on a VMWare virtual machine on my lowly Dell desktop - I could copy the VM to a server and get a huge boost. If I _really_ cared about speed, since I'm using MySQL, I'd consider mapping a table directly to the file via the CSV storage engine and then just copy it from the CSV table to a "real" table. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Pagination - displaying page numbers
On 3/24/06, Stephen <[EMAIL PROTECTED]> wrote: > > Hello, > > I've just started looking at Django, it's certainly looking like a very > good choice for the sort of projects I'll be doing in the near future. > > > Just now I've been looking at pagination and have a question: > > I'm using the generic view "list_detail" to view a list of results. I > want to use pagination to restrict the number of items on a page. To > do this I've added a "paginate_by" value to the info_dict dictionary in > my urls.py file. This results in my results being paginated correctly, > and the additional context parameters are available in my template. I > can use these to show how many hits there were and how many pages of > results etc there are. My problem comes with trying to show a numbered > link to each page of results (like google does at the bottom of its > results page). I thought this would be straightforward - just do a > loop - but as far as I can see the {% for %} tag can only iterate over > an array, and the "pages" context property is a number. What is the > right way to go about looping from N to N+M in a template ? My feeling > is that looping over a list is the nicest way, but then I can't get the > pagination to work like I want! Apologies if I'm missing something > really obvious! > > In the course of trying to figure this out I tinkered around with the > list_detail.py file and tried adding extra context parameters (e.g. > 'page_list':range(1, pages+1, 1) ). These never showed up in my > templates though - are there specific steps to take in order to make > changes to the django source files be noticed by the server (I'm using > the test server that comes with Django)? > > Thanks in advance for any help, > > Stephen. > > One way I think is just like what you do: create a extra_context. The other way is create a custom tag to create a list. Someone has submit this patch before. http://code.djangoproject.com/ticket/1162 Or you can use a custom tag written by me to calculate the list in template: expr tag http://groups.google.com/group/django-users/browse_thread/thread/6c1c162e7dd5d0d8/ce3aa7e2e3d48ae1?lnk=st&q=an+expression+tag&rnum=3#ce3aa7e2e3d48ae1 {% expr range(pages) as page_number %} {% for i in page_number %} ... {% endfor %} -- I like python! My Blog: http://www.donews.net/limodou NewEdit Maillist: http://groups.google.com/group/NewEdit --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Django API doc
Adrian Holovaty wrote: > Nicely done! I think for the final product we'd want Wilson's loving > design touches. Also, this does a good job of pointing out the areas > in which we need to add docstrings. this will not be fun for wilson ;) the html code really sucks at some parts. i had some more django style in it, turned out the html just doesn't fit :( and cleanup of the css is required, too. some styles i haven't seen used, but maybe generated... maybe he can make the current one better :) by the way, bug is http://code.djangoproject.com/ticket/1248 kindly regards daniel --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: apache threading - 'QueryDict' object has no attribute '_mutable'
Alex Brown wrote: > > Let me know if there is anything I can do to help. In e-mail. Thanks, Eugene --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Django API doc
Adrian Holovaty wrote: > > Nicely done! I think for the final product we'd want Wilson's loving > design touches. Also, this does a good job of pointing out the areas > in which we need to add docstrings. +1 on Wilson --- the man can make everything look better. +1 on adding it to main Django site as soon as it is ready. Thanks, Eugene --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Advice on using model to bulk/batch load database
On 3/23/06, DavidA <[EMAIL PROTECTED]> wrote: > Occasionally I will modify my schema, drop the old tables and reload > all the data from the "cached" files. Over time that could easily be > millions of rows and some optimization of my technique will be in > order. But for now, the simple approach (parse a row, create a django > model object, stuff it and save it) works fine. For bulk-loading stuff into a database, I would definitely recommend bypassing the Django layer entirely. There's no need to use an ORM for that; use whatever bulk-loading capability your database provides. Or, if you absolutely want to do it in Python, use the cursor.executemany() functionality of the Python DB-API layer. Adrian -- Adrian Holovaty holovaty.com | djangoproject.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Django API doc
On 3/22/06, Daniel Poelzleithner <[EMAIL PROTECTED]> wrote: > i created a css to build a django styled API doc with epydoc. > > http://djangoapi.quamquam.org/ Beta Version :) > > I hope we can integrate it as http://api.djangoproject.com someday. Nicely done! I think for the final product we'd want Wilson's loving design touches. Also, this does a good job of pointing out the areas in which we need to add docstrings. Adrian -- Adrian Holovaty holovaty.com | djangoproject.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Django API doc
Very useful. Thanks. On Mar 23, 2006, at 4:28 AM, Daniel Poelzleithner wrote: > > Hi, > > i created a css to build a django styled API doc with epydoc. > > http://djangoapi.quamquam.org/ Beta Version :) > > I hope we can integrate it as http://api.djangoproject.com someday. > > kindly regards > daniel --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Advice on using model to bulk/batch load database
Eric, The typical mode of operation will be to incrementally load new data each night - about 10 files each containing dozens to hundreds of rows. Maybe only a couple will be in the thousands category. But I've also created my scripts to work in two steps: 1) download the data from various sources (FTP, HTTP, web scrape, custom API) and save the files on a server, 2) parse any new files and load into the database. Occasionally I will modify my schema, drop the old tables and reload all the data from the "cached" files. Over time that could easily be millions of rows and some optimization of my technique will be in order. But for now, the simple approach (parse a row, create a django model object, stuff it and save it) works fine. -Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: apache threading - 'QueryDict' object has no attribute '_mutable'
Eugene Lazutkin wrote: > Alex Brown wrote: > > Eugene Lazutkin wrote: > > > >> Alex Brown wrote: > >>> I am running django on a Windows server (apache 2.0.54/mod_python > >>> 3.1.3/postgres 8.0.3) > >>> > >>> Django would crash apache when running multiple automated scripts > >>> POSTing data at a high rate through a generic create_object view. > >>> > >>> After scanning the net I found various threading fix patches, and I > >>> ended up finding that the thread-local-storage patch seemed to stop the > >>> server from crashing. The problem I have now is that occasionally (1 in > >> Could you give a link to the patch? > >> > >> Thanks, > >> > >> Eugene > > > > Sure.. the patch I used was > > http://code.djangoproject.com/attachment/ticket/1442/magic.threading.2.patch > > > > Which is really very simple (VERY simple for postgres) > > OMG! Adrian: when is it going to be merged to the trunk and to the > magic-removal branch? Is there something wrong with it? Any second > thoughts? Hidden problems? Negative experience with the patch? It is > amazing that such important defect was patched 7 month ago (#463 for > MySQL) but is not accepted even now!!! Why??? > > Alex: I'll look into this problem. Most probably there is a racing > condition in multithreaded Django. It doesn't look like it is related to > database backends. The chances are there are more static objects, which > are (improperly) shared across threads. > > Thanks, > > Eugene Eugene, Let me know if there is anything I can do to help. Thanks, Alex --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Advice on developing with django for a team of 10+
tonemcd wrote: > I don't want my .pyc files being put into the repository, and I thought > a recursive svn property ignore would do the trick. I used the info > from http://www.nedbatchelder.com/text/quicksvn.html, specifically; See http://code.djangoproject.com/ticket/1378 for one solution Kieran --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: apache threading - 'QueryDict' object has no attribute '_mutable'
Alex Brown wrote: > Eugene Lazutkin wrote: > >> Alex Brown wrote: >>> I am running django on a Windows server (apache 2.0.54/mod_python >>> 3.1.3/postgres 8.0.3) >>> >>> Django would crash apache when running multiple automated scripts >>> POSTing data at a high rate through a generic create_object view. >>> >>> After scanning the net I found various threading fix patches, and I >>> ended up finding that the thread-local-storage patch seemed to stop the >>> server from crashing. The problem I have now is that occasionally (1 in >> Could you give a link to the patch? >> >> Thanks, >> >> Eugene > > Sure.. the patch I used was > http://code.djangoproject.com/attachment/ticket/1442/magic.threading.2.patch > > Which is really very simple (VERY simple for postgres) OMG! Adrian: when is it going to be merged to the trunk and to the magic-removal branch? Is there something wrong with it? Any second thoughts? Hidden problems? Negative experience with the patch? It is amazing that such important defect was patched 7 month ago (#463 for MySQL) but is not accepted even now!!! Why??? Alex: I'll look into this problem. Most probably there is a racing condition in multithreaded Django. It doesn't look like it is related to database backends. The chances are there are more static objects, which are (improperly) shared across threads. Thanks, Eugene --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: SQL Debugging and limit_choices_to in MR Branch
Way-Hay!, this works pa = models.ForeignKey("self", blank=True, null=True, limit_choices_to = {'groups__groupName__exact' : 'Administration'}) # PA for this person Now the only people who are in the popup are those who are in the group 'Administration'. Very neat ;) Cheers, Tone --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Advice on developing with django for a team of 10+
I'm still finding my feet with svn Eric ;) I don't want my .pyc files being put into the repository, and I thought a recursive svn property ignore would do the trick. I used the info from http://www.nedbatchelder.com/text/quicksvn.html, specifically; $ svn propset -R svn:ignore . -F ignore.txt where ignore.txt consists of *.pyc I must have done something wrong though ;) Your svnstatus looks quite handy, so I'll use something like that. Cheers, Tone --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Django API doc
Daniel, this is terrific work!, I definitely agree with John that you should file this into trac. I can see it saving people a mountain of time! Cheers, Tone --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Advice on developing with django for a team of 10+
On Thursday 23 March 2006 09:23, tonemcd wrote: > Oooh, now that's neat. My own tinkering with svn to ignore .pyc files > hasn't worked out so well... > > % svn proplist > Properties on '.': > svn:ignore > % svn st > M magic/site1/modeltest/models.pyc > > hmmm... > I just make sure I don't add the pyc files to the repository (or is that what you are trying to automate?). It's not so hard doing it manually as adding files happens infrequently compared to committing changes to existing files. I'm assuming you don't want to see tons of lines of '? /path/to/some.pyc' when doing and 'svn status'. My 'svn status' alias filters out files with the pyc extension so that I don't have to look those lines: alias svnstatus='svn status | grep -v .pyc | grep -v .sql' That way pyc files aren't in the repository and I don't have status output cluttered with lines I don't care about. Hope that helps, Eric. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: SQL Debugging and limit_choices_to in MR Branch
Thanks for the patch ChaosKCW, I still can't get this to work though, pa = models.ForeignKey("self", blank=True, null=True, limit_choices_to = {'groups__exact' : 'Administration'}) # PA for this person I'm now getting mesages about an m2m table not existing. What I'd like to do is something like limit_choices_to = {'WorkGroups.groupName__exact' : 'Administrator'} but that returns "Cannot resolve keyword 'WorkGroup.groupName' into field". thanks for any help, Cheers, Tone --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Advice on using model to bulk/batch load database
DavidA wrote: > I am prepopulating my database with data from a number of flat files. > I've written a small script to do this using my model class. While this > works, there are a couple of kludges I made to get it to work and I was > hoping someone could advise my on a better way to do this. Hey Dave, You didn't mention how many records you are importing nor how often you will be re-importing your flat files. I regularly have to import files with ~2.5M records and I've found that using an ORM framework is too slow for my requirements. My first script to do the import used Django's ORM. That script looped over the lines of the file, slurping in the data, creating a new django object out of the data and .save()ing the object. It worked well and the code was easy to read, but I needed more speed as this script was going to need to run at least weekly and had to run at night, completing before my users started hammering on the web app in the morning. The second script I wrote would drop existing indexes, then iterating over the lines of the file, it worked directly with Django's db object to INSERT the data into the (postgresql) database. The indexes were recreated at the end of the script. If I recall correctly, that script took around 5-6 hours to complete the import. The script I'm using now iterates over the lines of the file, formating the data into a new sql file that is psql (the postgresql command line tool) friendly. The script takes four minutes to create the sql file. It then uses python's os.popen4 to load the python-generated sql file into psql: cmd = "psql -U my_user my_db -f %s" % path_to_sql_file s_in, s_out = os.popen4(cmd) This approach cut the import time down to just under 2 hours (the sql file also drops indexes before importing the data, then recreates the indexes afterwords). So, If you are importing lots of data and have to do it frequently or many times and time is of the essence, my recommendation is to give the read-file/write-file/db-command-line three-step a try. Good luck and best regards, Eric. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Help getting admin and non-admin app running in Apache
I've found that it's better to have __repr__ return a string whether our not the field is a string or not; def __repr__(self): return "%s" % self.modelField hth Cheers, Tone --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Advice on developing with django for a team of 10+
Oooh, now that's neat. My own tinkering with svn to ignore .pyc files hasn't worked out so well... % svn proplist Properties on '.': svn:ignore % svn st M magic/site1/modeltest/models.pyc hmmm... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Pagination - displaying page numbers
The answer to the second part of my question *was* very obvious... I was editing the wrong copy of the source file. I needed to change the copy installed under my Python directory, not the one in the Django directory. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
off topic, web creator apps
Okay, This might be pretty off topic and if you all think so just ignore this email. I was looking at RapidWeaver and iWeb and the development models on those applications use themes or templates for different web pages. I looked at the Django generated pages and Django do have a very nice and consistent pages. Now the question, is there a way of merging Django into these web development applications? Basically having the front-end of these templates/themes with Django as the back-end engine. Yes, people that use these applications might not know Pythons but Django can almost eliminate Python also. Just curious... Yong --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Pagination - displaying page numbers
Hello, I've just started looking at Django, it's certainly looking like a very good choice for the sort of projects I'll be doing in the near future. Just now I've been looking at pagination and have a question: I'm using the generic view "list_detail" to view a list of results. I want to use pagination to restrict the number of items on a page. To do this I've added a "paginate_by" value to the info_dict dictionary in my urls.py file. This results in my results being paginated correctly, and the additional context parameters are available in my template. I can use these to show how many hits there were and how many pages of results etc there are. My problem comes with trying to show a numbered link to each page of results (like google does at the bottom of its results page). I thought this would be straightforward - just do a loop - but as far as I can see the {% for %} tag can only iterate over an array, and the "pages" context property is a number. What is the right way to go about looping from N to N+M in a template ? My feeling is that looping over a list is the nicest way, but then I can't get the pagination to work like I want! Apologies if I'm missing something really obvious! In the course of trying to figure this out I tinkered around with the list_detail.py file and tried adding extra context parameters (e.g. 'page_list':range(1, pages+1, 1) ). These never showed up in my templates though - are there specific steps to take in order to make changes to the django source files be noticed by the server (I'm using the test server that comes with Django)? Thanks in advance for any help, Stephen. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Help getting admin and non-admin app running in Apache
DavidA wrote: >TemplateSyntaxError: Caught an exception while rendering. > > Ah! Most of the time it means that it's an exception raised in some of your object's __repr__. Django fails here trying to reproduce error page which also uses __repr__ to print objects. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: maxlength in the Admin site
Hi If the form element is set correctly I have to question why it saved more than 3 characters to the DB and then retrieved those same characters back again. I would have to dig deeper to see exactly what is going on which is why I posted the question first, under the idea that other people have want the same restrictions. When i have time I will investigate further. Thanks, C --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: OneToOneField
That is definatly not the problem. OneToOne just doesnt work with User. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Djangoproject site and documentation
[EMAIL PROTECTED] wrote: > Right now I cant get access to djangoproject.com. > > And, as I know, its global problem. > > Is there any other place, where i get django documentation right now? http://www.nekomancer.net/djangodoc/index.html they're the text-version docs, and it's only there for a day or two.. (should be enough until djangoprojec comes back) gabor --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Help getting admin and non-admin app running in Apache
That still leaves my Django apps running in the same space (PythonInterpreter) as the admin app which I think is the root of the problem. I've tried using a separate for "/" and "/admin/" but that didn't work. I don't see how its possible to separate my non-admin apps from the admin app since they are both defined in the same settings and urls files. Should I just create a new project that uses a copy of the settings file but only install the admin app? But then I'd have to install new apps in both places. I must be doing something wrong because it can't be that hard to do what I'm trying to do. Isn't the typical setup for most people to have both thier custom apps and the admin app all installed in the same project and all working together? No matter what I try I always get the same results: my apps work fine, the main page of the admin app works, but whenever I click on one of my models to look at the data, I get the dreaded TemplateSyntaxError: Mod_python error: "PythonHandler django.core.handlers.modpython" Traceback (most recent call last): File "C:\Python24\Lib\site-packages\mod_python\apache.py", line 299, in HandlerDispatch result = object(req) File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\handlers\modpython.py", line 165, in handler return ModPythonHandler()(req) File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\handlers\modpython.py", line 139, in __call__ response = self.get_response(req.uri, request) File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\handlers\base.py", line 109, in get_response return self.get_technical_error_response(request) File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\handlers\base.py", line 139, in get_technical_error_response return debug.technical_500_response(request, *sys.exc_info()) File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\views\debug.py", line 126, in technical_500_response return HttpResponseServerError(t.render(c), mimetype='text/html') File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\template\__init__.py", line 146, in render return self.nodelist.render(context) File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\template\__init__.py", line 707, in render bits.append(self.render_node(node, context)) File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\template\__init__.py", line 725, in render_node result = node.render(context) File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\template\defaulttags.py", line 112, in render nodelist.append(node.render(context)) File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\template\defaulttags.py", line 179, in render return self.nodelist_true.render(context) File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\template\__init__.py", line 707, in render bits.append(self.render_node(node, context)) File "c:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\template\__init__.py", line 735, in render_node raise wrapped TemplateSyntaxError: Caught an exception while rendering. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Djangoproject site and documentation
[EMAIL PROTECTED] wrote: > Right now I cant get access to djangoproject.com. > > And, as I know, its global problem. > > Is there any other place, where i get django documentation right now? > Basic docs are in /docs/ -- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://studioquattro.biz/ http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ | http://djangoutils.python-hosting.com/ Registered Linux User 282159 [http://counter.li.org] --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Djangoproject site and documentation
Right now I cant get access to djangoproject.com. And, as I know, its global problem. Is there any other place, where i get django documentation right now? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Django API doc
On 3/22/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > This is excellent. Concur; neat. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Advice on using model to bulk/batch load database
> BTW, if you do this repeatedly and format of those flat files is not a > requirement it is possible to have all initial data in a form of SQL > script. If you place it in /sql/.sql then Django will > include it in 'sqlall' command right after DB creation. While I'm not in control of the file format in this case, your suggestion will help solve a different problem I have: I use full-text searching on some of my tables and I was manually running a little sql script after I did a 'manage.py sqlall | mysql ...': CREATE FULLTEXT INDEX ix_ft_trade_all ON trade (tradeType, investIdType, investId, portfolio, book, strategy, counterparty, custodian, account); ... and then I use the where form of get_list(..., where=["match() against('')"]) to search for them in one of my views. Your suggestion automates that step (which I forget to do quite a bit!) > You can use the very class that is used for POSTs - MultiValueDict. It's > in django.utils.datastructures: > > from django.utils.datastructures import MultiValueDict > d = MultiValueDict(your_dict) I made the change and its working fine. One thing you have to be careful with is to build a MultiValueDict where the values are lists/tuples. I was putting scalars in and it was interpreting strings as sequences which caused problems in do_html2python. -Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to join two variables in a template
On 3/23/06, wuonm <[EMAIL PROTECTED]> wrote: > > I have a similar question. Suppose I receive a hash and a list in my > template. I want to iterate over the list accessing items in the hash. > Like that: > > {% for element in the_list %} > >{{ the_hash[element] }} > > {% endfor %} > > But obviously it doesn't work. How can I do it? > you can use the expr tag to do these things according to the last eamil. {% expr the_hash[element] as item %} {{ item }} -- I like python! My Blog: http://www.donews.net/limodou NewEdit Maillist: http://groups.google.com/group/NewEdit --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Advice on using model to bulk/batch load database
> You can set the environment variable at the top of your scripts by > importing the Python os module, just like you can import sys and set > sys.path. Thanks, I added this and it works fine: os.environ['DJANGO_SETTINGS_MODULE'] = 'data.settings' > The Python datetime and time modules are huge resources. In this case > you want time.strptime() to parse an arbitrary time format into a tuple > and then you can use that tuple to create a datetime.date object which > you can directly assign to the DateField. I had already done that - I was hoping I could tell the DateField what format it should expect the date in when it parses it via html2python. Something like: myDateField.inputFormats = ['%d-%b-%y', '%m/%d/%y'] and then when I call html2python on it (indirectly via the manipulator) it will try each of those until it gets a valid date back. Right now, DateField is hardwired to use '%Y-%m-%d', so I'm pre-converting all date fields before I send the row from the file to the manipulator. Like I said, its a small detail, just the one place where I my parser/loader needs to be aware of the type of columns and I was hoping to eliminate that. Thanks, -Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to join two variables in a template
wuonm wrote: > I have a similar question. Suppose I receive a hash and a list in my > template. I want to iterate over the list accessing items in the hash. > Like that: > > {% for element in the_list %} > >{{ the_hash[element] }} > > {% endfor %} > > But obviously it doesn't work. How can I do it? > Simplest and more obvious solution: handle this in your view, ie: ... # dummy name, find a better one hashed_list = [the_hash[element] for element in the_list] context = DjangoContext(request, dict(hashed_list=hashed_list, ...)) ... More complex solution: write a custom tag for this, ie: # dummy name, find a better one @register.inclusion_tag('path/to/tpl') def show_hashed_list(the_list, the_hash, tag="div"): hashed_list = [the_hash[element] for element in the_list] return dict(hashed_list=hashed_list) # the template {% for element in hashed_list %} <{{ tag }}> {{ element }} -- bruno desthuilliers développeur [EMAIL PROTECTED] http://www.modulix.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: apache threading - 'QueryDict' object has no attribute '_mutable'
Eugene Lazutkin wrote: > Alex Brown wrote: > > I am running django on a Windows server (apache 2.0.54/mod_python > > 3.1.3/postgres 8.0.3) > > > > Django would crash apache when running multiple automated scripts > > POSTing data at a high rate through a generic create_object view. > > > > After scanning the net I found various threading fix patches, and I > > ended up finding that the thread-local-storage patch seemed to stop the > > server from crashing. The problem I have now is that occasionally (1 in > > Could you give a link to the patch? > > Thanks, > > Eugene Sure.. the patch I used was http://code.djangoproject.com/attachment/ticket/1442/magic.threading.2.patch Which is really very simple (VERY simple for postgres) Alex --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to join two variables in a template
I have a similar question. Suppose I receive a hash and a list in my template. I want to iterate over the list accessing items in the hash. Like that: {% for element in the_list %} {{ the_hash[element] }} {% endfor %} But obviously it doesn't work. How can I do it? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: flatpages
Thanks Adrain for your support i am wondering is that means that i have to create another folder for flatpages in /usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/contrib/ and call it in my application NB.all my change is just in this file /usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/contrib/flatpages/views.py Thanks :) Mary On Wed, 2006-03-22 at 10:03 -0600, Adrian Holovaty wrote: > On 3/22/06, Mary Adel <[EMAIL PROTECTED]> wrote: > > I am working with flatpages and they are amazing for me and i customized > > them for my first needs then i am developing another site now that has > > another needs and i need to customize flatpages but in different way so > > how this could be done > > Hi Mary, > > This should be as simple as using your custom code in one place, and > other custom code in another place. If the two usages are different > enough, there's no point in sharing code -- just make them separate > applications. > > Adrian > > -- > Adrian Holovaty > holovaty.com | djangoproject.com > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: apache threading - 'QueryDict' object has no attribute '_mutable'
Alex Brown wrote: > I am running django on a Windows server (apache 2.0.54/mod_python > 3.1.3/postgres 8.0.3) > > Django would crash apache when running multiple automated scripts > POSTing data at a high rate through a generic create_object view. > > After scanning the net I found various threading fix patches, and I > ended up finding that the thread-local-storage patch seemed to stop the > server from crashing. The problem I have now is that occasionally (1 in Could you give a link to the patch? Thanks, Eugene --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---