Re: multiple database support: oracle backend
Sorry Carlos, those patches are far from complete, and I don't use Oracle myself. For the moment the backends in the patches use the following to get the connection: connection = self.model._default_manager.db.connection Removing the import and putting in that line should do the trick. There is plenty more wrong (certainly with that 6110 patch, the 6453 one is a little better), but I haven't had the time to work on it further. Koen > The problem seems to be in django/db/backends/oracle/base.py on line > 92: > > from django.db import connection > > which is later used to get the cursor. This seems to bypass the use > of the database settings in OTHER_DATABASES. I would expect to use > connections from django.db rather than connection: > > # Create a manager for named connections > connections = LazyConnectionManager() > > # Backwards compatibility: establish the default connection and set > the > # default connection properties at module level, using the lazy > proxy so that > # each thread may have a different default connection, if so > configured > connection_info = LocalizingProxy('connection_info', _local, > lambda: connections[_default]) > connection = LocalizingProxy('connection', _local, >lambda: > connections[_default].connection) > > But I don't see how to get the named connection in oracle/base.py. > > If that is clear, I would appreciate any suggestions. > > Carlos Hanson --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: can't install...
so I installed django from "http://www.instantdjango.com/ chapter1.html" and then did the tutorial, and when I tried to execute it, this is what I got: Page not found (404) Request Method: GET Request URL:http://localhost/crime/arson/ No Crime matches the given query. You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page. do you know what might have went wrong? I crosschecked everything with the tutorial... On Oct 16, 12:29 am, AniNair <[EMAIL PROTECTED]> wrote: > Please check the command prompt window in which you have django > running. It will tell you what errors you have made. Copy the messages > if you can't make sense of them and post it here... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
default fields for model (also default model methods and manager)
hi all I'd like to have certain fields in several models, like alias field in this: class Person(models.Model): name = models.CharField(max_length=255) alias = models.ForeignKey('self', blank=True, null=True) class Place(models.Model): street = models.CharField(max_length=255) alias = models.ForeignKey('self', blank=True, null=True) to repeat alias in every model is not DRY. also I'd like to have Manager returning for example all aliases for all of such models and model methods to manipulate with aliases. so it should be common for several models. I see a way to achieve this is to inherit models.Model, add necessary fields/managers/methods to it and the inherit my models from it, like: class MyModel(models.Model): alias = models.ForeignKey('self', blank=True, null=True) manager = [my alias manager here] def getAlias: [whatever I need] class Person(MyModel): name = models.CharField(max_length=255) class Place(MyModel): street = models.CharField(max_length=255) my questions are: 1. is it the right way to go? 2. are there any pitfalls? thanks Maxim http://zeliboba.by.ru --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Templates
You can also add the same tuple with the help of context processors. http://www.djangoproject.com/documentation/templates_python/#django-core-context-processors-i18n http://www.b-list.org/weblog/2006/jun/14/django-tips-template-context-processors/ On Oct 16, 9:58 pm, AniNair <[EMAIL PROTECTED]> wrote: > I managed to do it by > return render_to_response ('language.html',{'LANGUAGES':LANGUAGES}) > and it is working but I just wonder if this is the right way to do > this please help. Thank you --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
search all text fields
hi all is there a way to search through all TextFields and CharFields in the model without knowing their names? or just search through all fields in the model, in other words I want something like MyModel.objects.filter(*_icontains='search string') thanks Maxim http://zeliboba.by.ru --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Templates
I managed to do it by return render_to_response ('language.html',{'LANGUAGES':LANGUAGES}) and it is working but I just wonder if this is the right way to do this please help. Thank you --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Templates
Hi... I am a beginner using django 0.97 pre with python 2.5.1. I am trying choose language from the settings.py which has LANGUAGES tuple. I have {% for lang in LANGUAGES %} {{ lang.1 }} {% endfor %} Can someone tell me the proper way to do this or suggest a tutorial? should I return LANGUAGES tuple with render_to_response? Thank you. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to convert 92.5698 to 92.57
Michael, Yea I'm already using stringformat in my template. However, in my view code is where I create the order. When the order is added in the view and I then look at it in the admin the price is displayed as 74.0 instead of 74.00. Here is part of my view code: p = float(a['choice']) * int(a['quanity']) pr = pr + p pr = round(pr,2) o = Order() o.b_name = request.session['orderdetails']['b_firstname'] + " " + request.session['orderdetails']['b_lastname'] o.b_address = request.session['orderdetails']['b_address'] o.b_city = request.session['orderdetails']['b_city'] o.b_state = request.session['orderdetails']['b_state'] o.b_zip = request.session['orderdetails']['b_zip'] o.amount = pr o.save() // Thanks On Oct 16, 10:55 pm, Michael <[EMAIL PROTECTED]> wrote: > You can use "stringformat" in template: > > {{ price|stringformat:".2f"}} > > On 10/17/07, Greg <[EMAIL PROTECTED]> wrote: > > > > > > > Loren, > > Yes I got that working However, I'm still having the problem when the > > order amount decimal value is .00. So, if the order amount is 74.00. > > I only see 74.0 in the admin. My admin field is setup this way: > > > amount = models.DecimalField("Order Amount", max_digits=6, > > decimal_places=2) > > > Thanks > > > On Oct 15, 10:19 pm, LorenDavie <[EMAIL PROTECTED]> wrote: > > > Hi Greg, > > > > Within the view you can just use python's built in round function > > > > >>> round(92.5698,2) > > > > 92.57 > > > > The full documentation is here: > > > >http://docs.python.org/lib/built-in-funcs.html > > > > Look for the "round()" function - the second argument is the number of > > > decimal places you wish to retain. > > > > Hope that helps. > > > > On Oct 15, 11:06 pm, Greg <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > > I have a view that gets a number. It's value is 92.5698, I want to > > > > find out how to convert that number to two decimal places 92.57 from > > > > within the view. > > > > > Thanks > > -- > -- > Michael --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to convert 92.5698 to 92.57
You can use "stringformat" in template: {{ price|stringformat:".2f"}} On 10/17/07, Greg <[EMAIL PROTECTED]> wrote: > > Loren, > Yes I got that working However, I'm still having the problem when the > order amount decimal value is .00. So, if the order amount is 74.00. > I only see 74.0 in the admin. My admin field is setup this way: > > amount = models.DecimalField("Order Amount", max_digits=6, > decimal_places=2) > > Thanks > > > > > On Oct 15, 10:19 pm, LorenDavie <[EMAIL PROTECTED]> wrote: > > Hi Greg, > > > > Within the view you can just use python's built in round function > > > > >>> round(92.5698,2) > > > > 92.57 > > > > The full documentation is here: > > > > http://docs.python.org/lib/built-in-funcs.html > > > > Look for the "round()" function - the second argument is the number of > > decimal places you wish to retain. > > > > Hope that helps. > > > > On Oct 15, 11:06 pm, Greg <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > I have a view that gets a number. It's value is 92.5698, I want to > > > find out how to convert that number to two decimal places 92.57 from > > > within the view. > > > > > Thanks > > > > > -- -- Michael --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to convert 92.5698 to 92.57
Loren, Yes I got that working However, I'm still having the problem when the order amount decimal value is .00. So, if the order amount is 74.00. I only see 74.0 in the admin. My admin field is setup this way: amount = models.DecimalField("Order Amount", max_digits=6, decimal_places=2) Thanks On Oct 15, 10:19 pm, LorenDavie <[EMAIL PROTECTED]> wrote: > Hi Greg, > > Within the view you can just use python's built in round function > > >>> round(92.5698,2) > > 92.57 > > The full documentation is here: > > http://docs.python.org/lib/built-in-funcs.html > > Look for the "round()" function - the second argument is the number of > decimal places you wish to retain. > > Hope that helps. > > On Oct 15, 11:06 pm, Greg <[EMAIL PROTECTED]> wrote: > > > Hello, > > I have a view that gets a number. It's value is 92.5698, I want to > > find out how to convert that number to two decimal places 92.57 from > > within the view. > > > Thanks --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: apache2 + mod_python vhosts conflict
Graham, You're right, removing the PythonPath line doesn't make any difference, but the two virtual hosts still have the same problem...so I guess the next thing that I will try is seeing if I can display the environment variables via template debugging as you suggest. Thanks again. Wiley > It simply shouldn't be necessary to be adding 'django' package > explicitly like that. Just comment out the whole PythonPath line and > it should still work. I would be highly surprised if that solved your > problem though, as can't see how it would cause this specific issue. > > Graham --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: apache2 + mod_python vhosts conflict
On Oct 17, 12:18 pm, Wiley <[EMAIL PROTECTED]> wrote: > > 1. Why are you using: > > > PythonPath "['/usr/lib/python2.5/site-packages/django'] + sys.path" > > > It seems awfully odd that you would be adding django package directory > > to sys.path explicitly. > > A friend of mine set it up this way for me, at the time I was only > using a single > virtual host and it Just Worked(tm) Is that Microsoft 'Just Worked' or Apple 'Just Worked'. ;-) > so I didn't mess with it. Is > there something > more standard I should be doing? It simply shouldn't be necessary to be adding 'django' package explicitly like that. Just comment out the whole PythonPath line and it should still work. I would be highly surprised if that solved your problem though, as can't see how it would cause this specific issue. Graham --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: apache2 + mod_python vhosts conflict
> 1. Why are you using: > > PythonPath "['/usr/lib/python2.5/site-packages/django'] + sys.path" > > It seems awfully odd that you would be adding django package directory > to sys.path explicitly. A friend of mine set it up this way for me, at the time I was only using a single virtual host and it Just Worked(tm) so I didn't mess with it. Is there something more standard I should be doing? > 2. Are you own Django site instances installed in site-packages > directory, or have you gone and put them inside of django package > directory for some reason? My django site instances are installed in the site-packages directory (as symlinks). > 3. Do the problems go away if you don't have the ServerAlias directive > in each VirtualHost container? Unforunately no, this is the first thing I tried tho :) > 4. Can you add a page to your Django application which dumps out what > is in os.environ for each site? That seems totally possible, I'll have to dig into the documentation to figure it out, I will post to the thread with the results. Thanks so much for your thorough and thoughtful reply! Wiley --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: apache2 + mod_python vhosts conflict
Thanks for all who repsonded...Graham, I'll go through your steps very carefully. Kenneth and Bob, the PythonInterpreter thing was the first thing I checked (because it was in the official docs) if you notice I have different PythonInterpreters already set in the two virtual hosts in my original post...am I missing something obvious? Wiley On Oct 17, 9:40 am, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 17-Oct-07, at 12:19 AM, Wiley wrote: > > > apache with only one of these hosts enabled, each works fine, its just > > when I run then both at the same time, if i go to mandarinland.com, it > > loads a css-free version of chinabites.comdoes anyone know what's > > going on here? I attach the apache virtual hosts files here for > > reference: > > PythonInterpreter somename > > make sure there is a different name for each host > > -- > > regards > kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: apache2 + mod_python vhosts conflict
On 17-Oct-07, at 12:19 AM, Wiley wrote: > apache with only one of these hosts enabled, each works fine, its just > when I run then both at the same time, if i go to mandarinland.com, it > loads a css-free version of chinabites.comdoes anyone know what's > going on here? I attach the apache virtual hosts files here for > reference: PythonInterpreter somename make sure there is a different name for each host -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
multiple database support: oracle backend
I am having trouble with Django revision 6110 patched with multi- db-6110.patch. Traceback (most recent call last): File "", line 1, in ? File "/usr/local/lib64/python2.4/site-packages/django/db/models/ query.py", line 108, in __repr__ return repr(self._get_data()) File "/usr/local/lib64/python2.4/site-packages/django/db/models/ query.py", line 484, in _get_data self._result_cache = list(self.iterator()) File "/usr/local/lib64/python2.4/site-packages/django/db/backends/ oracle/base.py", line 119, in iterator cursor.execute(full_query, params) File "/usr/local/lib64/python2.4/site-packages/django/db/backends/ util.py", line 19, in execute return self.cursor.execute(sql, params) ProgrammingError: relation "ttsd_schools" does not exist The problem seems to be in django/db/backends/oracle/base.py on line 92: from django.db import connection which is later used to get the cursor. This seems to bypass the use of the database settings in OTHER_DATABASES. I would expect to use connections from django.db rather than connection: # Create a manager for named connections connections = LazyConnectionManager() # Backwards compatibility: establish the default connection and set the # default connection properties at module level, using the lazy proxy so that # each thread may have a different default connection, if so configured connection_info = LocalizingProxy('connection_info', _local, lambda: connections[_default]) connection = LocalizingProxy('connection', _local, lambda: connections[_default].connection) But I don't see how to get the named connection in oracle/base.py. If that is clear, I would appreciate any suggestions. Carlos Hanson --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Multiple Database Support
Hi, I need to support multiple database connections in our Django application. One option being considered is to use the multi-db branch at http://code.djangoproject.com/svn/django/branches/multiple-db-support which is already in alpha release. However by examining the code, it seems the development on this branch has stalled. Does anyone know the state of this branch and the release plan? Is there any other option available? Thanks a lot, mark --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: newform: Why Doesn't This work
The "choice = " is getting evaluated as a class, and the self.q_prime is referring to an instance of the class myForm. At least I think that's what's happening here... -joe On 10/16/07, johnny <[EMAIL PROTECTED]> wrote: > > Below is my form class. Inside myForm, I tried doing this: > > choice = forms.ChoiceField(label="My choice", >choices=myChoice(self.q_prime).choices()) > > I get an error right here "choices=myChoice(self.q_prime).choices()": > name 'self' is not defined > > My Form Class: > > class myChoice: > def __init__(self, q_prime): > _choice = [] > #_choice.append(q_prime) > > def choices(): > _choice.append("yellow") > _choice.append("red") > > return _choice > > class myForm(forms.Form): > def __init__(self, *args, **kwargs): > try: > self.q_prime = kwargs.pop('q') > except: > pass > super(myForm, self).__init__(*args, **kwargs) > > choice = forms.ChoiceField(label="My choice", >choices=myChoice(self.q_prime).choices()) #I > get an error right here: name 'self' is not defined > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: apache2 + mod_python vhosts conflict
Hmmm, I have been trying to track down what is behind this one for a while. I only do this as someone who knows about mod_python and not as a Django user, so dependent on people trying things and giving feedback. Although someone else suggested PythonInterpreter directive, you are already doing that. A few questions for you as a result. 1. Why are you using: PythonPath "['/usr/lib/python2.5/site-packages/django'] + sys.path" It seems awfully odd that you would be adding django package directory to sys.path explicitly. 2. Are you own Django site instances installed in site-packages directory, or have you gone and put them inside of django package directory for some reason? 3. Do the problems go away if you don't have the ServerAlias directive in each VirtualHost container? 4. Can you add a page to your Django application which dumps out what is in os.environ for each site? I want to see whether there has been any significant environment variable leakage between the two Python sub interpreters which is causing them to interfere with each other. Scrub out any sensitive stuff from environment variables before sending. For what is behind this request, see section 'Application Environment Variables' of: http://code.google.com/p/modwsgi/wiki/ApplicationIssues 5. If all else fails and you simply cant find a way of getting this to work under mod_python, then you might consider using daemon mode of mod_wsgi. That way each will run in distinct processes and no chance of them interfering with each other. Also be interested to see if you hit the problem with embedded mode of mod_wsgi, which is similar to mod_python. This latter check would indicate whether this is a subtle mod_python problem or an issue with cross interpreter pollution in Python itself. Graham On Oct 17, 4:49 am, Wiley <[EMAIL PROTECTED]> wrote: > Hi guys, noob question here about setting up apache to serve up 2 > different domains, each with a distinct django project. When I run > apache with only one of these hosts enabled, each works fine, its just > when I run then both at the same time, if i go to mandarinland.com, it > loads a css-free version of chinabites.comdoes anyone know what's > going on here? I attach the apache virtual hosts files here for > reference: > > > ServerName chinabites.com > ServerAliaswww.chinabites.com > > DocumentRoot /home/www/chinabites.com > > CustomLog /var/log/apache2/chinabites.com/access.log combined > ErrorLog /var/log/apache2/chinabites.com/error.log > > PythonInterpreter chinabites > PythonImport /home/django/eggs.py chinabites > > SetHandler python-program > PythonHandler django.core.handlers.modpython > SetEnv DJANGO_SETTINGS_MODULE chinabites.settings > PythonDebug Off > PythonPath "['/usr/lib/python2.5/site-packages/django'] + sys.path" > > > > ServerName mandarinland.com > ServerAliaswww.mandarinland.com > > DocumentRoot /home/www/mandarinland.com > > CustomLog /var/log/apache2/mandarinland.com/access.log combined > ErrorLog /var/log/apache2/mandarinland.com/error.log > > PythonInterpreter mandarinland.com > PythonImport /home/django/eggs.py mandarinland.com > > SetHandler python-program > PythonHandler django.core.handlers.modpython > SetEnv DJANGO_SETTINGS_MODULE mandarinland.settings > PythonDebug Off > PythonPath "['/usr/lib/python2.5/site-packages/django'] + sys.path" > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
newform: Why Doesn't This work
Below is my form class. Inside myForm, I tried doing this: choice = forms.ChoiceField(label="My choice", choices=myChoice(self.q_prime).choices()) I get an error right here "choices=myChoice(self.q_prime).choices()": name 'self' is not defined My Form Class: class myChoice: def __init__(self, q_prime): _choice = [] #_choice.append(q_prime) def choices(): _choice.append("yellow") _choice.append("red") return _choice class myForm(forms.Form): def __init__(self, *args, **kwargs): try: self.q_prime = kwargs.pop('q') except: pass super(myForm, self).__init__(*args, **kwargs) choice = forms.ChoiceField(label="My choice", choices=myChoice(self.q_prime).choices()) #I get an error right here: name 'self' is not defined --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Authenticating static content when not using mod_python
On Oct 16, 11:58 pm, AndyB <[EMAIL PROTECTED]> wrote: > Hi folks, > > Am I right in thinking the only way to do is this under CGI etc. is to > either: > > 1. To use raw HTTP authentication > or > 2. To pipe all content through Python by reading the file in and > serving it from a view Can you explain better what you are wanting to do. In particular: If not using mod_python, how are you running Django, from a CGI script? Are you wanting the HTTP authentication to be using Django user database? Any other relevant information would also help, otherwise mostly guessing in trying to work out what you want. Graham --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Authenticating static content when not using mod_python
check out secdownload plugin using lighttpd server http://trac.lighttpd.net/trac/wiki/Docs%3AModSecDownload -Bedros On Oct 16, 6:58 am, AndyB <[EMAIL PROTECTED]> wrote: > Hi folks, > > Am I right in thinking the only way to do is this under CGI etc. is to > either: > > 1. To use raw HTTP authentication > or > 2. To pipe all content through Python by reading the file in and > serving it from a view --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: apache2 + mod_python vhosts conflict
> from the "Django with mod python" documentation. Should have included the link: http://www.djangoproject.com/documentation/modpython/#multiple-django-installations-on-the-same-apache Bob --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: problem in uploading image
> > if form.is_valid(): > clean_data = form.clean_data > t = Image If Image is a model class, the above should read: t = Image() > > but it is showing an error saying 'module' object has no > attribute 'save_photo_file' --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: apache2 + mod_python vhosts conflict
Wiley, I ran into the same problem. Even though I wasn't running two Django installations in the same VirtualHost caching seemed to be crossing my installations together. Adding the PythonInterpreter directive to the virtual hosts did the trick for me - you won't need the Location directive, just PythonInterpreter. See the following from the "Django with mod python" documentation. Bob "If you need to put two Django installations within the same VirtualHost, you'll need to take a special precaution to ensure mod_python's cache doesn't mess things up. Use the PythonInterpreter directive to give different directives separate interpreters:" ServerName www.example.com # ... SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonInterpreter mysite SetEnv DJANGO_SETTINGS_MODULE mysite.other_settings PythonInterpreter mysite_other --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
apache2 + mod_python vhosts conflict
Hi guys, noob question here about setting up apache to serve up 2 different domains, each with a distinct django project. When I run apache with only one of these hosts enabled, each works fine, its just when I run then both at the same time, if i go to mandarinland.com, it loads a css-free version of chinabites.comdoes anyone know what's going on here? I attach the apache virtual hosts files here for reference: ServerName chinabites.com ServerAlias www.chinabites.com DocumentRoot /home/www/chinabites.com CustomLog /var/log/apache2/chinabites.com/access.log combined ErrorLog /var/log/apache2/chinabites.com/error.log PythonInterpreter chinabites PythonImport /home/django/eggs.py chinabites SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE chinabites.settings PythonDebug Off PythonPath "['/usr/lib/python2.5/site-packages/django'] + sys.path" ServerName mandarinland.com ServerAlias www.mandarinland.com DocumentRoot /home/www/mandarinland.com CustomLog /var/log/apache2/mandarinland.com/access.log combined ErrorLog /var/log/apache2/mandarinland.com/error.log PythonInterpreter mandarinland.com PythonImport /home/django/eggs.py mandarinland.com SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mandarinland.settings PythonDebug Off PythonPath "['/usr/lib/python2.5/site-packages/django'] + sys.path" --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: OT: How did you handle asynchronous tasks?
2007/10/16, Joseph Heck <[EMAIL PROTECTED]>: > > If I'm reading it correctly, the lack of RESTful verbs was your > primary consideration for what the API to the queue service failed to > provide. Is that correct? > Exactly, I try to be as RESTful as I can in my current projects and DQS can be a perfect example of what can be done in this way. Another interesting thing could be a concrete example (like using DQS instead of send_mass_mail or something like that). I can help on the REST part (at least for advices, my todo-list is... well, is.) if you need. Regards, David --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: OT: How did you handle asynchronous tasks?
On 10/16/07, David Larlet <[EMAIL PROTECTED]> wrote: > 2007/10/15, Joseph Heck <[EMAIL PROTECTED]>: > > > > Hi David, > > > > If you'd be willing to indulge me, why doesn't DQS doesn't fit your > > requirements? I'd love to have some explicit feedback on where it > > could be improved to match your needs. And yes, I know there's a LOT > > of places where it could be improved... :-) > > > > Hi Joe, > > Here are a couple of suggestions of what I'd like to do if I need to > use this project: > > * Turns it to a RESTful one which mean at least use HTTP verbs instead > of /delete/ and so one in URLs, I will probably use > django-rest-interface to do that. > * Move doctests to the tests.py file and add more tests before the next point. > * Review some parts of the code, for example use queryset.count() > instead of len(queryset), or change this part: > > q = None > try: > q = Queue.objects.get(name=queue_name) > except Queue.DoesNotExist: > pass > if q is None: > return None > > To this one: > > try: > q = Queue.objects.get(name=queue_name) > except Queue.DoesNotExist: > return None > > I don't know if it works but it seems more natural to me. Thanks for the feedback! We (well Rajesh and Marcus) have been adding a huge number of tests in a development branch, so you'll be seeing that fairly shortly. I appreciate the request for RESTful verbs in the environment, we'll definitely look into that. If I'm reading it correctly, the lack of RESTful verbs was your primary consideration for what the API to the queue service failed to provide. Is that correct? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Relating model to itself.
On 10/16/07, Dmitriy Sodrianov <[EMAIL PROTECTED]> wrote: > As it can be seen from the code above, i want some tasks to have > parent, and a parent must be a task too. The Django documentation covers this. http://www.djangoproject.com/documentation/model-api/#many-to-one-relationships http://www.djangoproject.com/documentation/models/m2o_recursive/ -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Relating model to itself.
Dmitriy Sodrianov wrote: > Hi to all! > > Can anyone help me, why none of the following code works: > > class Task(models.Model): > parent = models.ForeignKey(Task) > > Try: class Task(models.Model): parent = models.ForeignKey('Task') It will do the lookup late enough that it should be able to self-reference. gav --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Relating model to itself.
Hi to all! Can anyone help me, why none of the following code works: class Task(models.Model): parent = models.ForeignKey(Task) class Task(models.Model): parent = models.ForeignKey(self) As it can be seen from the code above, i want some tasks to have parent, and a parent must be a task too. But the only thing validation says is: versatility.tasks: name 'Task' is not defined or versatility.tasks: name 'self' is not defined --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Django - Oracle support
On Oct 15, 5:10 pm, Stefan Bethge <[EMAIL PROTECTED]> wrote: > Just an addition. I would not recommend using oracle with django if > you don't have an enterprise version which contains the oracle > connection manager. Without it you won't have connection pooling > functionality which slows down django quite a bit. > It seems there are no free alternatives for it. (Cross-posting to django-developers) The cx_Oracle driver also includes connection pooling support, which Django does not currently take advantage of. If there's demand for that feature, we could look into enabling it. I don't know off the top of my head how complex that kind of change would be. Ian --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
look at this great site
http://spielwelt6.knightfight.de/?ac=vid&vid=121044096 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
look at this great site
http://spielwelt6.knightfight.de/?ac=vid&vid=121044096 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Nested in statements
Am Dienstag, 16. Oktober 2007 15:48 schrieb Jeremy Dunck: > On 10/16/07, Thomas Guettler <[EMAIL PROTECTED]> wrote: > > Hi, > > > > you can use the extra() method of QuerySet: > > > > Example: Entry.objects.extra(where=['id IN (3, 4, 5, 20)']) > > How is this different from __in, and where did that list of numbers > come from? :) It was just an example (from the link) . Since the original post seems to be understand SQL well, I think it is no problem for him to use this examle to create something like this: Build.objects.extra(where=[''' `iKeyBuildNr` IN ( SELECT `iFKeyBuildNr` FROM `package` WHERE `strPackageName` IN ("denon_AVR4306") )''']) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Better FileField
On 10/16/07, Doug Van Horn <[EMAIL PROTECTED]> wrote: > > On Oct 16, 7:06 am, "Fco. Javier Nievas" <[EMAIL PROTECTED]> wrote: > > Could you give a link to that patch? > > > > Thanks > > One last note, there's a link at the bottom of my post to Marty's > patch. Here it is if you'd rather just head there: > > http://code.djangoproject.com/ticket/5361 Whoops! I thought for sure I had included a link. Thanks for that, Doug. Your approach at solving this problem is quite interesting, actually. You seem to have actually managed to find a reason to keep _save_FIELD_file() around. Unfortunately, that's not a very compelling reason for the long term, since it especially has problems when dealing with a model with multiple FileFields (the same _save_FIELD_file() will be used for both fields). In #5361, we'll be moving that processing away from _save_FIELD_file() and into a custom file object, which you've probably already discovered by looking at the patch. Your patch would still continue for a while, since _save_FIELD_file() isn't going away yet, but it may well disappear at some point, so it's better to have a proper solution in place. -Gul --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Request data is lost between two views
On Oct 16, 5:35 am, Divan Roulant <[EMAIL PROTECTED]> wrote: > Hello, > > I loose request data when I call a view with reverse from a previous > view. Here is what I do: [snip] > Is request data supposed to follow or is it normal to loose it? Is > there another way to preserve request data between consecutive views? To understand your problem you need to understand what HttpResponseRedirect() is doing. When you return that object, your server sends the browser a 302 status code. A 302 tells the browser the desired page can be found under the new (temporary) URL you specify. The browser then requests the new URL as a GET. It does not resend any GET or POST data sent to the original URL. If you want to pass some parameters to that second view, you can put them on the URL you send in your response-redirect. Something like: return HttpResponseRedirect("/mysite/secondview/?foo=%(foo)s&bar=% (bar)s") % request Or you could store the data in the user session. Or you could just do your work in the first view. ;-) doug. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Better FileField
On Oct 16, 7:06 am, "Fco. Javier Nievas" <[EMAIL PROTECTED]> wrote: > Could you give a link to that patch? > > Thanks I wrote a post about how I handled including a model ID in the path of an uploaded file: http://dougblog.com/articles/2007/oct/11/dynamic-upload/ I didn't address any other issues you brought up., though I plan on restricting access to files uploaded to MEDIA_ROOT via Apache. There are some discussions on this list about how to accomplish that (search for "Securing static files"). Also, my static content is located in a different directory from my uploaded content, made available via a custom MEDIA_PREFIX setting (inspired by ADMIN_MEDIA_PREFIX). One last note, there's a link at the bottom of my post to Marty's patch. Here it is if you'd rather just head there: http://code.djangoproject.com/ticket/5361 doug. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: image/file uploads, custom filenames, security
I've done some work on FileField lately that address some of your concerns. On 10/16/07, Mark Green <[EMAIL PROTECTED]> wrote: > * does django properly sanitize the filename or rather, use > safe temp files? i wonder what would happen if i tried to > upload a file called "../../traverse.txt"? I haven't done any testing on that particular situation, so I can't speak to that one. > * how can i enforce a filename on the uploaded file? > i want to completely ignore the remote name of the file > and instead store it as, for example, {{username}}.jpg There's a ticket[1] in Trac to revamp the way file storage is defined, which would allow you to override some of how Django selects a filename. Currently, it won't allow you to use the username, or any other details of the model the image is attached to, but that's becoming a common request, so I'll see about adding it before it hits trunk. > * anyone know if the PIL stuff is hardened against image bombs? > (small images that expand to gigabytes when expanded to bitmap) > would it be feasible to subclass ImageFile and replace the PIL > calls with some paranoid homegrown stuff (i.e. ImageMagick), > anyone know a starting point for this? The ticket I mentioned above also makes it much easier to subclass FileField and ImageField to add or change whatever functionality you like. I don't know whether PIL already does what you need, but if you're paranoid, this patch should help you out. -Gul [1] http://code.djangoproject.com/ticket/5361 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Authenticating static content when not using mod_python
Hi folks, Am I right in thinking the only way to do is this under CGI etc. is to either: 1. To use raw HTTP authentication or 2. To pipe all content through Python by reading the file in and serving it from a view --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
image/file uploads, custom filenames, security
hi all, i've been playing with ImageField and FileField recently and so far they work like a charm. some questions remain, though: * does django properly sanitize the filename or rather, use safe temp files? i wonder what would happen if i tried to upload a file called "../../traverse.txt"? * how can i enforce a filename on the uploaded file? i want to completely ignore the remote name of the file and instead store it as, for example, {{username}}.jpg * anyone know if the PIL stuff is hardened against image bombs? (small images that expand to gigabytes when expanded to bitmap) would it be feasible to subclass ImageFile and replace the PIL calls with some paranoid homegrown stuff (i.e. ImageMagick), anyone know a starting point for this? -mark --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: ***SPAM*** Nested in statements
On 10/16/07, Thomas Guettler <[EMAIL PROTECTED]> wrote: > > Hi, > > you can use the extra() method of QuerySet: > > Example: Entry.objects.extra(where=['id IN (3, 4, 5, 20)']) > How is this different from __in, and where did that list of numbers come from? :) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: select choices
On Oct 15, 3:11 pm, onno <[EMAIL PROTECTED]> wrote: > Arn't stings slower against integers? A datatype of varchar versus integer isn't what's going to slow you down. If you don't have an index on a column and you use that column in your predicate (i.e., where clause) you will end up doing a full table scan, e.g.: select * from foo where type = 1; select * from foo where type = 'FOO'; Both of those queries require a full table scan and perform equally bad. If you index the type column, both will perform equally well. Partial string matches will also use an index if available, at least in Postgres. E.g., select * from foo where type = 'F%'; --Uses 'type' index if available See the following: http://www.postgresql.org/docs/8.2/static/indexes.html Read that chapter if you're a little light on database expertise. It's very useful information. Hope that helps! doug. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: ***SPAM*** Nested in statements
Hi, you can use the extra() method of QuerySet: Example: Entry.objects.extra(where=['id IN (3, 4, 5, 20)']) http://www.djangoproject.com/documentation/db-api/#extra-select-none-where-none-params-none-tables-none Am Dienstag, 16. Oktober 2007 14:29 schrieb Rufman: > in SQL terms this is what i want to do: > SELECT * > FROM `build` > WHERE `iKeyBuildNr` > IN ( > > SELECT `iFKeyBuildNr` > FROM `package` > WHERE `strPackageName` > IN ( > & quot; > > denon_AVR4306 & quot; > > ) > ) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Django - Oracle support
This is great.. Did not know that my first post will lead into a flame war ;) BTW, thanks everyone for clarifying this. I hope that by the time I need to move to Oracle, we will have a release with stable build of Oracle. Thanks everyone once again. On Oct 16, 4:42 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > On 10/15/07, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > > > > > On 10/15/07, Stefan Bethge <[EMAIL PROTECTED]> wrote: > > > Just an addition. I would not recommend using oracle with django if > > > you don't have an enterprise version which contains the oracle > > > connection manager. Without it you won't have connection pooling > > > functionality which slows down django quite a bit. > > > It seems there are no free alternatives for it. > > >http://www.postgresql.org/ > > *snark* --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Nested in statements
On 10/16/07, Rufman <[EMAIL PROTECTED]> wrote: > > in SQL terms this is what i want to do: > SELECT * > FROM `build` > WHERE `iKeyBuildNr` > IN ( > >SELECT `iFKeyBuildNr` >FROM `package` >WHERE `strPackageName` > IN ("denon_AVR4306") >) > > How can i do this with the django db api? I tried it with __in, but it > doesn't seem to take QuerSets. You can't, at least not in one query. The nearest would be something like this: iKeys = [p['iFKeyBuildNr'] for p in Package.objects.filter(strPackageName__in=['denon_AVR4306'] ).values('iFKeyBuildNr')] builds = Build.objects.filter(iKeyBuildNr__in=iKeys) There are several variations on that theme, but I'm pretty sure it'll require 2 queries if you really need the nested in. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: OT: How did you handle asynchronous tasks?
On 10/16/07, David Larlet <[EMAIL PROTECTED]> wrote: > * Review some parts of the code, for example use queryset.count() > instead of len(queryset), or change this part: FWIW, doing qs.count() creates a new queryset, then executes it. Doing len(queryset), then queryset[0], the second access of queryset hits the queryset cache rather than executing a second query. Even so, if queryset returns a lot of records, it does seem like a lot of work. (Code referred to is here, I presume: http://django-queue-service.googlecode.com/svn/trunk/queue/models.py ) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Nested in statements
in SQL terms this is what i want to do: SELECT * FROM `build` WHERE `iKeyBuildNr` IN ( SELECT `iFKeyBuildNr` FROM `package` WHERE `strPackageName` IN ("denon_AVR4306") ) How can i do this with the django db api? I tried it with __in, but it doesn't seem to take QuerSets. thx for the help stephane --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Nested in statements
: in SQL terms this is what i want to do: SELECT * FROM `build` WHERE `iKeyBuildNr` IN ( SELECT `iFKeyBuildNr` FROM `package` WHERE `strPackageName` IN ("denon_AVR4306") ) How can i do this with the Django db API? I tried it with __in, but it doen't seem to take QuerySets thx for the help Stephane --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Nested in statements
in SQL terms this is what i want to do: SELECT * FROM `build` WHERE `iKeyBuildNr` > IN ( > > SELECT `iFKeyBuildNr` > FROM `package` > WHERE `strPackageName` > IN ( > & quot; > > denon_AVR4306 & quot; > > ) > ) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Nested in statements
in SQL terms this is what i want to do: SELECT * FROM `build` WHERE `iKeyBuildNr` IN ( SELECT `iFKeyBuildNr` FROM `package` WHERE `strPackageName` IN ( & quot; denon_AVR4306 & quot; ) ) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Better FileField
Could you give a link to that patch? Thanks On 10/11/07, Marty Alchin <[EMAIL PROTECTED]> wrote: > > > As Malcolm mentioned, I put a lot of time into a patch to solve a > great many problems with FileField, even more than the ones you > mentioned. It's not in trunk yet, and I don't know when it will be, > but I'll answer your questions to give you an overview of how things > will likely work. Keep in mind that it does more than this, but since > these are your concerns, I'll address just those. > > > * I don't want to store the files in MEDIA_ROOT, since > >the access needs to go through django for authentication. > > The new patch allows you to specify any root location you like, > independent of MEDIA_ROOT. You can even specify a root for any or all > of the FileFields in your project. > > > * The containing directory should be given by the model of the > FileField. > > Example: > > > > class MyFriend(models.Model): > > picture=models.NewFileField(...) > > > >if myfriend has id=1234 the file should be in .../myfriends/1234/ > > Given that you would be able to specify a different root directory for > each FileField, the model name would be easy to include, it just > wouldn't be automatic. As for including the ID as part of the path, > that's something a few other people have requested, and I'm still > trying to work out if there's a decent way to go about that. As it > stands, the patch doesn't support it. > > > * Unicode filenames should be encoded in pure ascii in the filesystem. > >The encoding should be reversable, so that you can get the unicode > >string back. This could be done with utils.http.urlquote(). > > > > * The database should contain the unicode filename. > > I'm not a unicode expert, so I won't pretend to know about the > "should" aspect of this, I'll defer to Malcolm on that. The patch > would, as Malcolm mentioned, provide a way for you to override how the > FileField generates the filename for use on the filesystem, as well as > what's stored in the database. So it would be fairly simple to include > this functionality on your own, even if it's not part of the standard > mechanism. > > > Has someone the same problems? > > Yes, and more. :) > > > Has someone solved/coded this? > > Mostly. > > > This patch only uses a better filename normalization: > > http://code.djangoproject.com/ticket/3119 > > The unicode name get's lost. > > The new FileField patch provides a different (better, in my opinion) > approach to this, so I expect that ticket would end up getting closed > with a note on how to use the new system to do the same thing. We'll > see. > > -Gul > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: problem in uploading image
new_data = request.POST.copy() new_data.update(request.FILES) form = ThingForm(new_data) if form.is_valid(): clean_data = form.clean_data t = Image t.name = clean_data['name'] if clean_data['photo']: photo = clean_data['photo'] #html = " hello %s " % (t.name) #return HttpResponse(html) t.save_photo_file(photo['filename'], photo['content']) t.save() but it is showing an error saying 'module' object has no attribute 'save_photo_file' On Oct 15, 12:48 pm, mayank bhargava <[EMAIL PROTECTED]> wrote: > hello .. > i am using this code to insertimageinto DataBase > new_data = request.POST.copy() > new_data.update(request.FILES) > profile_form = Things(None, name, new_data['photo']) > profile_form.save() > > and it is working properly > > now i want to copy the content of thisimageon another folder > > please resolve this issue > > thanks... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: select choices
Am Montag, 15. Oktober 2007 22:11 schrieb onno: > Arn't stings slower against integers? Optimize later. You never know the bottleneck in advance. Thomas --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Request data is lost between two views
Am Dienstag, 16. Oktober 2007 12:35 schrieb Divan Roulant: > Hello, > > I loose request data when I call a view with reverse from a previous > view. Here is what I do: >... return HttpResponseRedirect(reverse('my_second_view, > args=(request,))) > Is request data supposed to follow or is it normal to loose it? Is > there another way to preserve request data between consecutive views? Hi, It is normal that you loose them. This is a HTTP Redirect. The webbrowser will do a second GET. You can use from django.utils.http urlencode(request.GET) to build the new URL. This will redirect the webbrowser to the new URL with data. HTH, Thomas --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to find out if a string is contained within another string
You can set up your regular expression like so: import re number_re = re.compile(r'\d+') And then when you want to pull numbers out of the string, you can use this line: number_list = number_re.findall(input_string) That will give you a list of all the numbers in the string, or an empty list if there are no numbers found. I hope this helps! -Gul --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Request data is lost between two views
Hello, I loose request data when I call a view with reverse from a previous view. Here is what I do: def my_first_view(request): # Processing here return HttpResponseRedirect(reverse('my_second_view, args=(request,))) def my_second_view(request): # I would like to processing request data from the previous view, but request is empty return render_to_response('results.html', ...) URLConf: (r'^mysite/secondview/$', 'mysite.my_second_view', {}, 'my_second_view'), Is request data supposed to follow or is it normal to loose it? Is there another way to preserve request data between consecutive views? Thanks! Divan --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Filter objects by owner in admin
Is it possible to show in admin panel only the objects created by the current user? -- Alessandro Ronchi Skype: aronchi http://www.alessandroronchi.net - Il mio sito personale http://www.soasi.com - Sviluppo Software e Sistemi Open Source --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: [newforms] Confirming password widget
On 10/16/07, Przemek Gawronski <[EMAIL PROTECTED]> wrote: > > Hi, is there a password confirmation widget around, to automatically > check and validate (with error messages) if it's the same or not with a > password previously entered (in a different CharField)? > > If not, any guide lines on implementing would be nice :) > > Thanks > > Przemek See this snippet for example: http://www.djangosnippets.org/snippets/191/ kr, jure --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: OT: How did you handle asynchronous tasks?
2007/10/15, Joseph Heck <[EMAIL PROTECTED]>: > > Hi David, > > If you'd be willing to indulge me, why doesn't DQS doesn't fit your > requirements? I'd love to have some explicit feedback on where it > could be improved to match your needs. And yes, I know there's a LOT > of places where it could be improved... :-) > Hi Joe, Here are a couple of suggestions of what I'd like to do if I need to use this project: * Turns it to a RESTful one which mean at least use HTTP verbs instead of /delete/ and so one in URLs, I will probably use django-rest-interface to do that. * Move doctests to the tests.py file and add more tests before the next point. * Review some parts of the code, for example use queryset.count() instead of len(queryset), or change this part: q = None try: q = Queue.objects.get(name=queue_name) except Queue.DoesNotExist: pass if q is None: return None To this one: try: q = Queue.objects.get(name=queue_name) except Queue.DoesNotExist: return None I don't know if it works but it seems more natural to me. Regards, David --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to define urls
On 10/16/07, Pythoni <[EMAIL PROTECTED]> wrote: > Thanks a lot for help.It works well for , e.g. John Smith > but what if a user inserts John.Smith ( period instead of space)? > I tried to add a period This is the point where you really want to pause and read Python's regular-expression documentation ;) (understanding regexes is one of the fundamental "must-have" skills for pretty much any sort of programming, and Django, with its regex-based URLs, is no exception) -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to find out if a string is contained within another string
Since I haven't much experience with regex, I also can't give you the solution right away. Perhaps you have to try a bit: http://docs.python.org/lib/re-syntax.html --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to define urls
On Oct 16, 8:13 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > On 10/16/07, Pythoni <[EMAIL PROTECTED]> wrote: > ... > > > so I have in urls.py > > (r'^Myscript/(?P\w+)/','miproject.apps.mi.views.mi.Myscript'), > > > it works only ifNameis one word, e.g. John. > > You'll see documentation of python's re syntax > here:http://docs.python.org/lib/re-syntax.html > > Based on that, \w is indeed only these chars: > [a-zA-Z0-9_] > > You can extend the character class to accept spaces as well like so: > [\w ]+ > > So this would work for your purpose: > (r'^Myscript/(?P[\w ]+)/','miproject.apps.mi.views.mi.Myscript'), Jeremy, Thanks a lot for help.It works well for , e.g. John Smith but what if a user inserts John.Smith ( period instead of space)? I tried to add a period (r'^Myscript/(?P[\w .] +)/','miproject.apps.mi.views.mi.Myscript'), but it did not work.Any idea why? Thank you B. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---