Re: advice location of site for production and devel
On Tuesday 04 Apr 2006 5:47 pm, Luis P. Mendes wrote: > I thought of having a development site under my /home account and > it is running fine with the django pre-built runserver command. keep it there and configure apache/modpython to access it > > But, I'd like to copy the project, from time to time to under > apache's htdocs/ for production. I'm having some problems with > it: repeat three times: 'never put anything under htdocs' -- regards kg http://www.livejournal.com/users/lawgon tally ho! http://avsap.org.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 -~--~~~~--~~--~--~---
Re: ImageField upload_to
On 4/4/06, timster <[EMAIL PROTECTED]> wrote: > What I would like to do is store the image in a subfolder corresponding > to the gallery_id. If "Subaru" is gallery_id 1 and "Audi" is gallery_id > 2, I would want it to look like this: > > gallery/1/subaru1.jpg > gallery/2/audi1.jpg > > Is this possible to do in the model? Do I need to tie into the > _pre_save() method? I couldn't much documentation on ImageField. > > It would be even better if the image could be renamed corresponding to > the image_id, but this might be asking too much. This is a little bit awkward to do, because the ImageField is just one field in your model, and doesn't have an id of its own. I've done this with a custom field class, but it's a bit easier to do by overriding the save() method of your model. See this thread from last week for both ways of doing this: http://groups.google.com/group/django-users/browse_thread/thread/93c024f1523f5323/6bea5b407797e597 Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ 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: Look at this! Perhaps a bug or a mistake
Confirmed: Works on postgresql... I will switch to mr very soon Thanx for allOn 4/3/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: On Mon, 2006-04-03 at 16:15 -0500, James Bennett wrote:> On 4/3/06, Douglas Campos <[EMAIL PROTECTED]> wrote:> > My environment> > Django 0.91 > > DB: sqlite3>> I'd bet money that this is the problem: IIRC there are some problems> with doing date-based queries on SQLite in 0.91. Can you try with> MySQL or Postgres and see if you run into the same problem? Yeah, this is SQLite specific. I think you are hitting the bug that wasreported in ticket #1460. It is fixed on the magic-removal branch, butnot on the trunk.It is possible to apply the patch in that ticket to trunk by downloading it and then doingcd django/core/metapatch -p4 fields.py < ~/datefield-lookup.diffthat is on a Unix-like system; if you are on Windows, you could edit theappropriate places in the file yourself. The first chunk goes in the DateField class, the second in the DateTimeField class.Regards,Malcolm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ImageField upload_to
I'm trying to create a simple image gallery. Here's what my models look like. It's very simple, a gallery can have one or more images. class Gallery(meta.Model): name = meta.CharField(maxlength=50) class Image(meta.Model): gallery = meta.ForeignKey(Gallery)] image = meta.ImageField(upload_to='gallery/') If I create two galleries, "Subaru" and "Audi" and upload an image to each, the images are stored in the gallery/ directory. It would look like this: gallery/subaru1.jpg gallery/audi1.jpg What I would like to do is store the image in a subfolder corresponding to the gallery_id. If "Subaru" is gallery_id 1 and "Audi" is gallery_id 2, I would want it to look like this: gallery/1/subaru1.jpg gallery/2/audi1.jpg Is this possible to do in the model? Do I need to tie into the _pre_save() method? I couldn't much documentation on ImageField. It would be even better if the image could be renamed corresponding to the image_id, but this might be asking too much. Thanks in advance, Tim Shaffer --~--~-~--~~~---~--~~ 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: 0.91 vs SVN vs m-r
And maybe a link to the M-R docs, in whatever state they're in.ToddOn Apr 4, 2006, at 2:43 PM, Michael wrote:Thanks All!Will stick to m-r.It would be a good idea to put link to m-r on download page ondjangoproject website, so more people will get an idea about m-r.I fould it only in this group. On 4/4/06, tonemcd <[EMAIL PROTECTED]> wrote: This is another +1 for MR.It is a 'moving target', but it's not that bad to keep up with, and thebenefits (cleaner DB API, properties in models etc) are well worthhaving.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: 0.91 vs SVN vs m-r
Thanks All!Will stick to m-r.It would be a good idea to put link to m-r on download page ondjangoproject website, so more people will get an idea about m-r.I fould it only in this group. On 4/4/06, tonemcd <[EMAIL PROTECTED]> wrote: This is another +1 for MR.It is a 'moving target', but it's not that bad to keep up with, and thebenefits (cleaner DB API, properties in models etc) are well worthhaving.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: magic-removal - count with a condition
great, thanks for the tip --~--~-~--~~~---~--~~ 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-admin init won't
Once you create the project (as you did successfully with 'django-admin.py startproject myproject') move into that projects directory (cd myproject) and use manage.py in place of django-admin.py. manage.py eliminates the need for setting DJANGO_SETTINGS_MODULE (because manage.py and your settings file are in the same dir) and will give you everything you need for a basic dev environment. On 4/4/06, Frank Miles <[EMAIL PROTECTED]> wrote: > > Newbie problem ... > > While django-admin.py startproject myproject worked, other django-admin > actions (e.g. init -- for setting up user authentication) don't. I tried > setting DJANGO_SETTINGS_MODULE using both '/' and dotted directory notation, > and using long and short paths to the settings file, and running from several > different directories, including the directory of django-admin.py, but it > tracedumped each time. In this last case it dumped: > > Traceback (most recent call last): >File "./django-admin.py", line 5, in ? > management.execute_from_command_line() >File > "/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/management.py", > line 903, in execute_from_command_line > translation.activate('en-us') >File > "/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/utils/translation.py", > line 192, in activate > _active[currentThread()] = translation(language) >File > "/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/utils/translation.py", > line 111, in translation > from django.conf import settings >File > "/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/conf/settings.py", > line 32, in ? > mod = __import__(me.SETTINGS_MODULE, '', '', ['']) > ValueError: Empty module name > > This is on Debian/testing. If anyone can help I'd certainly appreciate it! > It's quite likely something simple and obvious. > > -frank > > > > -- Waylan Limberg [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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: magic-removal - count with a condition
Istvan wrote: > In Django 0.91 the > > foos.get_count( complex=condition ) > > was a valid construct. The magic removal branch raises an exception: > "count() takes exactly 1 argument (2 given)" when doing a : > > foo.objects.count( condition ) > > Is that intended? What would be a workaround? foo.objects.exclude(somecondition).filter(othercondition).count() The lazyness of the new QuerySets means that the above simply creates a COUNT query, no matter how many exclude()s and filter()s you might combine. -- --Max Battcher-- http://www.worldmaker.net/ "I'm gonna win, trust in me / I have come to save this world / and in the end I'll get the grrrl!" --Machinae Supremacy, Hero (Promo Track) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
magic-removal - count with a condition
In Django 0.91 the foos.get_count( complex=condition ) was a valid construct. The magic removal branch raises an exception: "count() takes exactly 1 argument (2 given)" when doing a : foo.objects.count( condition ) Is that intended? What would be a workaround? i. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
django-admin init won't
Newbie problem ... While django-admin.py startproject myproject worked, other django-admin actions (e.g. init -- for setting up user authentication) don't. I tried setting DJANGO_SETTINGS_MODULE using both '/' and dotted directory notation, and using long and short paths to the settings file, and running from several different directories, including the directory of django-admin.py, but it tracedumped each time. In this last case it dumped: Traceback (most recent call last): File "./django-admin.py", line 5, in ? management.execute_from_command_line() File "/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/management.py", line 903, in execute_from_command_line translation.activate('en-us') File "/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/utils/translation.py", line 192, in activate _active[currentThread()] = translation(language) File "/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/utils/translation.py", line 111, in translation from django.conf import settings File "/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/conf/settings.py", line 32, in ? mod = __import__(me.SETTINGS_MODULE, '', '', ['']) ValueError: Empty module name This is on Debian/testing. If anyone can help I'd certainly appreciate it! It's quite likely something simple and obvious. -frank --~--~-~--~~~---~--~~ 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: Relationship with self with relationship data in app.py
On 04/04/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > Firstly: You can forward reference a model by using its name as a string ( > e.g., ForeignKey("foo") works, in the same way that ForeignKey("self") > works). However, IIRC, this only works with ForeignKeys in 0.91. In > magic-removal, this has been fixed to encompass all field types. Hmm... trying it like that brings up this error. AssertionError: ForeignKey('Relationship') is invalid. First parameter to ForeignKey must be either a model or the string 'self' So it must be completly limited to magic removal. > Second: To build an annotated m2m relation, what you probably want to do is > something like: > > class Foo(Model): > data = meta.CharField() > > class Relation(Model): > from = ForeignKey(Foo, related_name="from") > to = ForeignKey(Foo, related_name="to") > data = meta.CharField() Yeah, that's what I've done except with OneToOneField for from. I'll refactor when some of magic-removal is reintroduced into the trunk. Thanks, Frankie. --~--~-~--~~~---~--~~ 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: Loading Data Custom Manipulator
[EMAIL PROTECTED] schrieb: > I used the manipulator.py script on the wiki to generate it then made > the changes I needed. Ouch. I can't give much of advice about this. Perhaps your manipulator class should derive from yourModels.Model.ChangeManipulator and it starts to work. Worth a try. Please report back ... 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 -~--~~~~--~~--~--~---
Re: Loading Data Custom Manipulator
I used the manipulator.py script on the wiki to generate it then made the changes I needed. --~--~-~--~~~---~--~~ 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 location of site for production and devel
Are you following http://www.djangoproject.com/documentation/modpython/? On 04/04/06, Luis P. Mendes <[EMAIL PROTECTED]> wrote: > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi, > > I'm building my first dynamic web site using Django. mod_python is > installed and runs well. I tried the example supplied at its docs. > > I thought of having a development site under my /home account and it is > running fine with the django pre-built runserver command. > > But, I'd like to copy the project, from time to time to under apache's > htdocs/ for production. I'm having some problems with it: > """ > EnvironmentError: Could not import DJANGO_SETTINGS_MODULE > 'djangoSite.settings.main' (is it on sys.path?): > """ > > Even when I edit httpd.conf to point to the devel directories > it doesn't work as should: I get a list of the files of that directory > and not the view I created. > > So, my questions are: > 1- Do you usually use different production and development directories? > 2- If so, is it possible to post the httpd.conf configuration of the > django and perhaps mod_python definitions? > 3- Do I need to change any values in the 'myproject' settings, or to run > any initialization command to put it to work under apache? > > Luis > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.4.1 (GNU/Linux) > Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org > > iD8DBQFEMmPzHn4UHCY8rB8RAldgAJ9miU9DFZ+/VNHAy/h7RpK0SzemfgCfcppQ > 1SX6zecmWVR1PFcYPI8/Idg= > =HVAu > -END PGP SIGNATURE- > > > > --~--~-~--~~~---~--~~ 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: Loading Data Custom Manipulator
[EMAIL PROTECTED] schrieb: > It appears that I need to have a custom flatten_data() that will Have you derived it from the automatically (in the model) provided manipulator? 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 -~--~~~~--~~--~--~---
Loading Data Custom Manipulator
Hi, I currently have a custom manipulator that I wish to use for both editing and creating new objects. I can create objects using this manipulator, but am currently incapable of editing an object. I have tried searching through the msg list and the documentation to no luck. It appears that I need to have a custom flatten_data() that will transform all the data into strings that can be used to populate the form. I have no idea how to do this, any advice would be greatly appreciated. Thanks, Chris --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
advice location of site for production and devel
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I'm building my first dynamic web site using Django. mod_python is installed and runs well. I tried the example supplied at its docs. I thought of having a development site under my /home account and it is running fine with the django pre-built runserver command. But, I'd like to copy the project, from time to time to under apache's htdocs/ for production. I'm having some problems with it: """ EnvironmentError: Could not import DJANGO_SETTINGS_MODULE 'djangoSite.settings.main' (is it on sys.path?): """ Even when I edit httpd.conf to point to the devel directories it doesn't work as should: I get a list of the files of that directory and not the view I created. So, my questions are: 1- Do you usually use different production and development directories? 2- If so, is it possible to post the httpd.conf configuration of the django and perhaps mod_python definitions? 3- Do I need to change any values in the 'myproject' settings, or to run any initialization command to put it to work under apache? Luis -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFEMmPzHn4UHCY8rB8RAldgAJ9miU9DFZ+/VNHAy/h7RpK0SzemfgCfcppQ 1SX6zecmWVR1PFcYPI8/Idg= =HVAu -END PGP SIGNATURE- --~--~-~--~~~---~--~~ 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: Relationship with self with relationship data in app.py
I wish I'd known about the forward reference method a bit earlier, would have saved a lot of hair-pulling. It seems that most of my hiccups with django seem to be related to data models and accessing that data using the ORM (I'm a Zope guy, and you don't do it that way there...) 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: How do I handel multiple foriegn keys in single model
On Tuesday 04 Apr 2006 12:38 pm, Mir Nazim wrote: > person = meta.ForeignKey(Person) make this a ManyToMany field -- regards kg http://www.livejournal.com/users/lawgon tally ho! http://avsap.org.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 -~--~~~~--~~--~--~---
Re: 0.91 vs SVN vs m-r
Hi Michael, I found myself in the same position a month ago. My project will grow continually for a long time, and there's no near deadline, so I chose the magic-removal branch, and I haven't regretted it. Lots of good ideas went in there. Though, if you need to go productive within two months or so, and then you're done, I'd advise against it. Hope that helps a little bit. Another 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 -~--~~~~--~~--~--~---