2008-8-5
| 22:56 | timboy | my app is named listing and my urls.py catches /listings/ |
| 22:56 | rozwell | |
| 22:57 | rozwell | timboy: your urls should not catch /listings/ |
| 22:57 | rozwell | timboy: and did you restart apache? |
| 22:57 | timboy | rozwell, yes |
| 22:58 | timboy | rozwell, so should I modify my urls.py to catch /listing instead of /listings? |
| 22:58 | rozwell | timboy: no |
| 22:59 | rozwell | timboy: your urls shouldn't be aware of the root from which the project is served |
| 22:59 | p-- | ilogik, if self.id exists before calling super().save() then it's an update |
| 23:00 | timboy | rozwell, ok so currently I have my settings.py and manage.py in /var/www/pescape and my application listing in /usr/local-django-apps/listings is this the right way? |
| 23:01 | rozwell | timboy: not with your apache set up |
| 23:02 | rozwell | timboy: you should keep all django-related code out of your document root altogether, i usually create a user for each project and keep the associated stuff for each project in that user's home dir |
| 23:02 | rozwell | timboy: you can keep reusable apps anywhere you'd like as long as they're readable/executable |
| 23:03 | davidcramer | anyone ever done address standardization? |
| 23:03 | davidcramer | I just need to handle location queries for state, city, zip |
| 23:03 | ourcach | when i overwrite a custom method is it possible to raise an error that is displayed in nfa? |
| 23:04 | rozwell | timboy: if you ran django-admin.py startproject pescape to create this folder "pescape" with __init__.py and settings.py in it, you need to add the folder that contains 'pescape' to PythonPath |
| 23:04 | rozwell | timboy: and then reference the settings therein as "pescape.settings" |
| 23:04 | alperkanat | hey there.. i have a urls.py like this: http://pastie.textmate.org/private/cwf5qdnu1yyb... - the problem is that {% url admin_page %} is being rendered into some other url in tr end en urls... should i add the admin line inside them which is a little bit weird ? |
| 23:04 | rozwell | timboy: i mean that's what you'd put for DJANGO_SETTINGS_MODULE |
| 23:05 | rozwell | davidcramer: as far as i'm aware there's no really good ways to handle addresses |
| 23:06 | davidcramer | ya i was just hoping someone had done some of the work for me |
| 23:06 | davidcramer | im just going to accept city, state, zip; city, state; city; state; and zip queries |
| 23:06 | alperkanat | hmm i see that i've to diagnose the problem by myself since nobody cares.. :( |
| 23:06 | rozwell | alperkanat: nobody can understand you |
| 23:07 | alperkanat | rozwell: this is my urls.py: http://pastie.textmate.org/private/cwf5qdnu1yyb... |
| 23:07 | davidcramer | hrm are zip_codes (the base) always 5 integers throughout the world? |
| 23:07 | alperkanat | rozwell: i'm using url naming to render to urls in templates |
| 23:07 | katamari | Does anyone know if there's an incompatibility between using djano.root in mod_python and APPEND_SLASH in CommonMiddleWare? |
| 23:08 | rozwell | katamari: why would there be? |
| 23:08 | rozwell | davidcramer: nope |
| 23:08 | alperkanat | rozwell: if i do {% url admin_page %} in some url that starts with something like /en/blog/....... django renders the admin url like this: http://localhost:8000/tr/blog/ |
| 23:08 | davidcramer | k so ill just make it a 16bit charfield |
| 23:09 | alperkanat | sorry it's http://localhost:8000/en/blog/ |
| 23:09 | katamari | rozwell: Well, the append_slash works (and has always worked for me). I just recently tried django.root in one of my installations and now it doesn't seem to work. |
| 23:09 | rozwell | alperkanat: two urls can't have the same name |
| 23:09 | katamari | rozwell: but the flag is still observed in test server. |
| 23:09 | alperkanat | rozwell: there's no url that have the same name ? |
| 23:11 | rozwell | katamari: well i don't see what the one has to do with the other |
| 23:12 | ourcach | when i overwrite a custom method is it possible to raise an error that is displayed in nfa? |
| 23:12 | psytek | how do i change a value for a field in a queryset? |
| 23:12 | rozwell | ourcach: ? |
| 23:12 | rozwell | psytek: querysets don't have fields |
| 23:14 | katamari | |
| 23:14 | ourcach | rozwell: i want to overwrite the save method of one of my models. And i want to return an error when some conditions fail. how do i do that |
| 23:14 | rozwell | psytek: perhaps you want http://www.djangoproject.com/documentation/db-a... |
| 23:14 | timboy | rozwell, ok and my static_media folder stays in my pescape project? if that's the case should I change PythonPath "['/usr/local/django-apps/', '/var/www/'] + sys.path" to PythonPath "['/usr/local/django-apps/' + sys.path" |
| 23:14 | katamari | rozwell: then try https://scripps.55minutes.com/survey/admin/ |
| 23:15 | rozwell | timboy: your pythonpath needs to be set to contain the path to any collection of 3rd party apps you want to use, as well as the path that contains your project package folder |
| 23:15 | psytek | rozwell: yes i looked that that, I have to update individual objects one by one with seperate values |
| 23:16 | rozwell | ourcach: if you want to validate form input, do it in the form |
| 23:17 | psytek | rozwell: that is similar to what I am looking for |
| 23:18 | ourcach | rozwell: i want to control the number of instances of a model in the db. it allows insertion until a max_number defined, and beyond that number i want it to raise an error. i'm doing this by overwriting the save method of the model. don't know if it's the best way |
| 23:19 | rozwell | ourcach: if you want this to be reflected to a user you should do it in the form |
| 23:20 | timboy | ok rozwell I understand now. i might have had it right a little bit ago but I was typing /listings and not /listings/ |
| 23:20 | ourcach | this is in the admin. |
| 23:20 | timboy | rozwell, now I get ImportError: Could not import settings 'peaceful.settings' (Is it on sys.path? Does it have syntax errors?): No module named peaceful.settings |
| 23:20 | rozwell | timboy: so modify your pythonpath accordingly |
| 23:21 | psytek | http://pastie.org/248139 I want to do something like this |
| 23:21 | rozwell | psytek: so do it, but you'll have to save each instance individually |
| 23:22 | psytek | rozwell: ahh, i didn't want to overwrite the data |
| 23:22 | rozwell | psytek: then don't |
| 23:23 | psytek | how do i save without overwriting the data? |
| 23:23 | rozwell | psytek: that's nonsensical |
| 23:24 | psytek | then my question remains unanswered |
| 23:25 | psytek | should i create a new queryset and copy the modified queryset over? |
| 23:26 | psytek | can someone who knows what i want to do answer me without being sarcastic or condescending? http://pastie.org/248139 |
| 23:27 | guille_ | hi |
| 23:27 | wmealing__ | psytek: i'll try |
| 23:28 | wmealing__ | psytek: so you've built a query set |
| 23:28 | wmealing__ | you're going to iterate through ti |
| 23:28 | wmealing__ | and set a field to a random number |
| 23:28 | psytek | yes |
| 23:28 | wmealing__ | thats.. what you want ? |
| 23:28 | psytek | exactly |
| 23:28 | wmealing__ | ok. so after you do the set |
| 23:28 | wmealing__ | just call save() |
| 23:28 | wmealing__ | done |
| 23:28 | psytek | and that won't modify the database? |
| 23:28 | wmealing__ | isn't that the plan ? |
| 23:28 | wmealing__ | or not |
| 23:28 | guille_ | how can I render an inclusion tag in a view? by now it only returns me the dictionary (so it doesn't behave like a decorated function) |
| 23:28 | psytek | no, i want it just for the instance |
| 23:29 | psytek | sorry if i wasn't clear |
| 23:29 | wmealing__ | you mean, for when you use it in the template ? |
| 23:29 | psytek | yes |
| 23:29 | wmealing__ thinks | |
| 23:29 | wmealing__ | give me a min |
| 23:29 | psytek | ok thank you |
| 23:29 | wmealing__ | while im setting up.. what exactly do you want to do/use it for ? |
| 23:30 | wmealing__ | iv'e never needed to use random data in templates |
| 23:30 | wmealing__ | thats all. |
| 23:30 | psytek | i have a bunch of records that i want to modify a value on each row and return it back to the view |
| 23:30 | wmealing__ | psytek: why not give each row a uuid in the model ? |
| 23:31 | wmealing__ | then you can reference it later.. rather than random |
| 23:31 | rozwell | psytek: if you iterate through the queryset and set the fields, then pass the list to the template you should see the values you set earlier, provided it's still in the same request/response cycle |
| 23:31 | rozwell | psytek: if you don't call save, the next request/response cycle where you bring up those records they should be as they were before you modified the field |
| 23:32 | psytek | ahh, thank you |
| 23:32 | rozwell | psytek: this is what i said to you earlier, to which you responded "but i want to save it" |
| 23:33 | alperkanat | despite the following urls.py file: http://pastie.textmate.org/private/sdgmrgwrw5sy... - it says NoReverseMatch |