Re: Read-only fields and complex relationships in admin

2011-03-25 Thread Jacob Kaplan-Moss
On Fri, Mar 25, 2011 at 6:39 PM, Micah Carrick wrote: > I have an application which handles a typical "checkout" process for an > e-commerce website. Orders from online customers end up in several models [... snip complex problem ...] > Anybody have any tips, links to

Re: Tutorial Problems

2011-03-25 Thread Mike Ramirez
On Friday, March 25, 2011 08:03:30 pm ruler501 wrote: > I have been going through the tutorial and this is the code I > currently have: > http://www.omnimaga.org/index.php?action=dlattach;topic=7310.0;attach=6834 > I have gotten to the 404 part in part 3 before deciding to post here. > Almost

Tutorial Problems

2011-03-25 Thread ruler501
I have been going through the tutorial and this is the code I currently have: http://www.omnimaga.org/index.php?action=dlattach;topic=7310.0;attach=6834 I have gotten to the 404 part in part 3 before deciding to post here. Almost everything since the very last part of part 2(beginning with HTML)

Re: Setting system path for django

2011-03-25 Thread Tim Johnson
* Graham Dumpleton [110325 16:43]: > > > On Saturday, March 26, 2011 8:56:53 AM UTC+11, tim042849 wrote: > > > > I've set up python 2.7 on slax. > > I've also set up django 1.1 on slax. Slax does things a little > > differently, so it appears. django is installed at

Re: How to run a file.py in the django environement

2011-03-25 Thread Mike Ramirez
On Friday, March 25, 2011 06:06:39 pm José António Silva wrote: > Is there any command like > python manage.py shell filename.py (I know this particular command > isn't allowed, but is there any other?) > > thanks, > JA how about turning filename.py into a django command?

Re: Setting system path for django

2011-03-25 Thread Tim Johnson
* Mike Ramirez [110325 17:13]: > On Friday, March 25, 2011 05:46:54 pm Tim Johnson wrote: > > > > > > It really sounds like when you install python, you're using `python > > > setup.py` > > > That's my bad. that should read "install django". The only reason python > should

How to run a file.py in the django environement

2011-03-25 Thread José António Silva
I wrote a simple django application just to write a record in a table I can run this application from the django shell, i.e., typing python manage.py shell and then >>> execfile('app/filename.py') It works, but I'd like to call filename.py directly from the ubuntu command line or from a shell

Re: Setting system path for django

2011-03-25 Thread Mike Ramirez
On Friday, March 25, 2011 05:46:54 pm Tim Johnson wrote: > > > > It really sounds like when you install python, you're using `python > > setup.py` > That's my bad. that should read "install django". The only reason python should install to django /usr/lib/python2.5/site-packages is if you're

Re: Setting system path for django

2011-03-25 Thread Tim Johnson
* Mike Ramirez [110325 15:42]: > On Friday, March 25, 2011 02:56:53 pm Tim Johnson wrote: > > I've set up python 2.7 on slax. > > I've also set up django 1.1 on slax. Slax does things a little > > differently, so it appears. django is installed at > >

Re: Setting system path for django

2011-03-25 Thread Graham Dumpleton
On Saturday, March 26, 2011 8:56:53 AM UTC+11, tim042849 wrote: > > I've set up python 2.7 on slax. > I've also set up django 1.1 on slax. Slax does things a little > differently, so it appears. django is installed at > /usr/lib/python2.5/site-packages/django > > python 2.7 does not know where

Django 1.3 - Question about static files

2011-03-25 Thread Sandro Dutra
Hello everyone! I'm using Python 2.7.x with Django 1.3 and I've some questions about the new way to set the static files for the dev server. My Settings: - abspath = lambda *p:

Read-only fields and complex relationships in admin

2011-03-25 Thread Micah Carrick
I have an application which handles a typical "checkout" process for an e-commerce website. Orders from online customers end up in several models (order, billing/shipping address, line items, gateway data, shipments, etc.). An administrator will have to be able to (a) create new orders manually

Re: Setting system path for django

2011-03-25 Thread Shawn Milochik
Super-short tutorial: Download virtualenv tarball. http://pypi.python.org/pypi/virtualenv#downloads Install virtualenv using Python2.7 explicitly: extract the tarball and run /path/to/python2.7 setup.py install Then do this: virtualenv --no-site-packages somedir source somedir/bin/activate

Re: Setting system path for django

2011-03-25 Thread Mike Ramirez
On Friday, March 25, 2011 02:56:53 pm Tim Johnson wrote: > I've set up python 2.7 on slax. > I've also set up django 1.1 on slax. Slax does things a little > differently, so it appears. django is installed at > /usr/lib/python2.5/site-packages/django > > python 2.7 does not know where to find

Re: Setting system path for django

2011-03-25 Thread Tim Johnson
* Tim Johnson [110325 14:39]: > * Shawn Milochik [110325 14:30]: > > Use virtualenv and save yourself a lot of trouble. > Setting system paths is not a lot of trouble for me. It is just > that I have not had to use .pth files for years, on my

Re: Setting system path for django

2011-03-25 Thread Shawn Milochik
On Fri, Mar 25, 2011 at 6:37 PM, Tim Johnson wrote: >  Shawn, I am reluctant to use your advice on this netbook with the >  'pocket' slax OS. Certainly I would consider it on my workstation. There's no reason for this reluctance. Virtualenv is not an emulator or anything

Re: Setting system path for django

2011-03-25 Thread Tim Johnson
* Shawn Milochik [110325 14:30]: > Use virtualenv and save yourself a lot of trouble. Setting system paths is not a lot of trouble for me. It is just that I have not had to use .pth files for years, on my workstation I address sys.path directly >

Re: Setting system path for django

2011-03-25 Thread Shawn Milochik
Use virtualenv and save yourself a lot of trouble. http://pypi.python.org/pypi/virtualenv Also, if you're starting a new project I highly recommend you use Django 1.3. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

ImageField and quality after save

2011-03-25 Thread galgal
How can I set the image quality to 100? The default value in PIL i 75 and Django saves an image with that value. Where can I change it? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Setting system path for django

2011-03-25 Thread Tim Johnson
I've set up python 2.7 on slax. I've also set up django 1.1 on slax. Slax does things a little differently, so it appears. django is installed at /usr/lib/python2.5/site-packages/django python 2.7 does not know where to find django, because the path to django is not being added to sys.path. I've

Re: Detect if file is being changed

2011-03-25 Thread Shawn Milochik
You can use a custom form in the admin. http://docs.djangoproject.com/en/1.3/ref/contrib/admin/ There are lots of cool and useful things on that page. Check 'em out. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: mod_wsgi - two sites on apache

2011-03-25 Thread Graham Dumpleton
Impossible to know because you haven't supplied the Apache configuration for VirtualHosts to verify you have done it correctly. Also need to know if you have set NameVirtualHosts directive properly. Graham On Saturday, March 26, 2011 5:54:48 AM UTC+11, CrabbyPete wrote: > > I am trying to run

Re: Detect if file is being changed

2011-03-25 Thread galgal
But I don't use any forms. I have simple model with image and date. I use it only in my Admin. -- 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,

Re: Detect if file is being changed

2011-03-25 Thread Shawn Milochik
This is probably something you should handle in the form itself. Override its save method and add whatever logic you need. Within a model instance you only have information about 'self' and anything you explicitly pass in. Shawn -- You received this message because you are subscribed to the

Detect if file is being changed

2011-03-25 Thread galgal
I make some file operations in admin. I use ImageField for it. In model's save method I need to detect if new image is sent via form, or form file field is empty. How can I detect it in my model's save method? -- You received this message because you are subscribed to the Google Groups

Re: mod_wsgi - two sites on apache

2011-03-25 Thread Dan Poirier
On Fri. 2011-03-25 at 02:54 PM EDT, CrabbyPete wrote: > I am trying to run two sites on one server with apache. I created > virtual hosts for each in my hpttd.conf file > When I hit the first site everthing is fine. When I hit the second one > I get an error. If I reload

Re: unique_for_date not working?

2011-03-25 Thread Karen Tracey
On Fri, Mar 25, 2011 at 12:17 PM, Andre Terra wrote: > Overwrite the model's save method and add the date automatically on save. > That is the best way to do most things "auto" in your models. > > But if you do this, you are past the point where you can flag non-unique for

Re: extend User Model for custom fields

2011-03-25 Thread Mike Ramirez
On Friday, March 25, 2011 01:16:51 pm Nick Serra wrote: > Andre's solution is out of date. Calvin is correct, use the user > profile model that is built into django auth. OP, the link you found > is correct. > > > > > http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-m... > >

Re: Integrity Error on chained FKs

2011-03-25 Thread gladys
The error you are getting has something to do with your user field in the Venue model, which based from your models cannot be null. How are you associating a user to it? On Mar 25, 7:45 pm, shofty wrote: > I've got the following models. > > class UserProfile(models.Model): >    

Re: extend User Model for custom fields

2011-03-25 Thread Nick Serra
Andre's solution is out of date. Calvin is correct, use the user profile model that is built into django auth. OP, the link you found is correct. On Mar 25, 11:39 am, Andre Terra wrote: > This is the correct way: > >

mod_wsgi - two sites on apache

2011-03-25 Thread CrabbyPete
I am trying to run two sites on one server with apache. I created virtual hosts for each in my hpttd.conf file When I hit the first site everthing is fine. When I hit the second one I get an error. If I reload and switch the order in which I access the sites. The first one is fine the second one

Re: unique_for_date not working?

2011-03-25 Thread Andre Terra
Overwrite the model's save method and add the date automatically on save. That is the best way to do most things "auto" in your models. Sincerely, Andre Terra On Fri, Mar 25, 2011 at 12:48 PM, Ryan Osborn wrote: > The problem with this is that the unique_for_date no

Re: Rewriting Java UI for Django?

2011-03-25 Thread Javier Guerra Giraldez
On Fri, Mar 25, 2011 at 10:40 AM, Brian Bouterse wrote: > Alarm bells usually go off for me when I am required to purchase a license > for code I have written.  Maybe I'm just an open source kinda guy, but if > I'm going to write code, I should be free to run it without paying

Re: unique_for_date not working?

2011-03-25 Thread Ryan Osborn
The problem with this is that the unique_for_date no longer works again On Mar 25, 3:15 pm, Daniel Roseman wrote: > On Friday, March 25, 2011 3:01:47 PM UTC, Ryan Osborn wrote: > > > Thanks for your reply Jacob.  The only problem with the method you > > suggested is that

Re: Rewriting Java UI for Django?

2011-03-25 Thread Brian Bouterse
Alarm bells usually go off for me when I am required to purchase a license for code I have written. Maybe I'm just an open source kinda guy, but if I'm going to write code, I should be free to run it without paying a license fee. Flex is a life choice ... I won't be making it. Brian On Fri,

Re: extend User Model for custom fields

2011-03-25 Thread Andre Terra
This is the correct way: http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/ Sincerely, Andre Terra On Fri, Mar 25, 2011 at 11:26 AM, Antonio Sánchez wrote: > i have found this: >

Re: Limiting file upload type?

2011-03-25 Thread David De La Harpe Golden
On 25/03/11 13:48, Sithembewena Lloyd Dube wrote: > Hi folks, > > I have a model with a FileField, and I need to chech that the file is .mp3 > before it is uploaded. How would I go about this without the hack of getting > the file name and slicing it? > Uh. File names are just names. There's

Re: unique_for_date not working?

2011-03-25 Thread Daniel Roseman
On Friday, March 25, 2011 3:01:47 PM UTC, Ryan Osborn wrote: > > Thanks for your reply Jacob. The only problem with the method you > suggested is that the field now shows up in the admin form which > allows people to edit it. I would rather that this didn't happen. Is > there any way around

RE: Rewriting Java UI for Django?

2011-03-25 Thread Sells, Fred
I also have made the conversion from Java/Swing/Webapp(jnlp) to Django, but I used Flex (a.k.a. Flash) for my UI because I've got a rich client background and did not want to deal with Browser inconsistencies. I'm happy with that choice. I use a very simple django template to render a very

Django on IIS 6

2011-03-25 Thread mofle
I've finally managed to set up Django on IIS 6 using this guide: http://whelkaholism.blogspot.com/2010/10/django-on-iis.html My Django project is located at the following url: http://server.com/djangoproject/ When trying to access the "http://server.com/djangoproject/admin/; I get the "Page not

Re: unique_for_date not working?

2011-03-25 Thread Ryan Osborn
Thanks for your reply Jacob. The only problem with the method you suggested is that the field now shows up in the admin form which allows people to edit it. I would rather that this didn't happen. Is there any way around this? Thanks, Ryan On Mar 25, 1:54 pm, Jacob Kaplan-Moss

django-admin commands from installed egg

2011-03-25 Thread George Lund
Hi all.. I'm having trouble with Django not registering custom django-admin commands from applications that are installed to egg files. The app is correctly listed in INSTALLED_APPS, and is installed to a location on the pythonpath. But its custom admin commands do not appear when running

LANGUAGE_CODE inside the template of an inclusion tag

2011-03-25 Thread gontran
Hello everybody, I'd like to use LANGUAGE_CODE in the template of an inclusion tag but this doesn't work. I added 'django.core.context_processors.i18n' in the settings, I load i18n in my template, and I specified to take context when I register my inclusion_tag. Am I missing something or is it

Re: extend User Model for custom fields

2011-03-25 Thread Antonio Sánchez
i have found this: http://digitaldreamer.net/blog/2010/12/8/custom-user-profile-and-extend-user-admin-django/ do you think its the correct way?? thanks for your reply! On Mar 25, 2:12 pm, Calvin Spealman wrote: > The auth app includes support to use a profile model,

Re: Turning off USE_L10N more than doubled my site performance!

2011-03-25 Thread Carsten Fuchs
Dear Karen, Am 25.03.2011 01:18, schrieb Karen Tracey: First, do you really mean USE_I18N everywhere where you have USE_L10N? The top cumtime item: ncalls tottime percall cumtime percall filename:lineno(function) 183330.7060.0004.3680.000

Re: unique_for_date not working?

2011-03-25 Thread Jacob Kaplan-Moss
Hi Ryan -- On Fri, Mar 25, 2011 at 3:55 AM, Ryan Osborn wrote: > I am using django 1.3 and have the following in my models.py: > > class Entry(models.Model): >    title = models.CharField(max_length=255) >    slug = models.SlugField(unique_for_date='created') >    

Limiting file upload type?

2011-03-25 Thread Sithembewena Lloyd Dube
Hi folks, I have a model with a FileField, and I need to chech that the file is .mp3 before it is uploaded. How would I go about this without the hack of getting the file name and slicing it? -- Regards, Sithembewena Lloyd Dube -- You received this message because you are subscribed to the

Very large files upload

2011-03-25 Thread galgal
I need to make system that allows to upload files that can be sized about 500MB. I want to use pluplod that sends chunks, then I want to merge it into 1 file on my server. Is i a good idea? Or to make reciving 1 big file via post. -- You received this message because you are subscribed to the

Re: extend User Model for custom fields

2011-03-25 Thread Calvin Spealman
The auth app includes support to use a profile model, configured with AUTH_PROFILE_MODULE in settings, which the docs show you how to use. Yes you can use inheritance, but you might assume it is a good idea to use what the auth app promotes. On Fri, Mar 25, 2011 at 9:04 AM, Antonio Sánchez

extend User Model for custom fields

2011-03-25 Thread Antonio Sánchez
hi! i have a question, which is the best option about extending user model?? here: http://docs.djangoproject.com/en/1.2//topics/auth/#storing-additional-information-about-users they say to create a manual OneToOneField between models and some more stuff, but here:

Re: Is there any Open Source Django Newspaper CMS?

2011-03-25 Thread Rehmetjan Tursun
Thanks Nick. I already found a CMS for my Newspaper. it's not EllingtonCMS , maybe better than it :) ArmstrongCMS Will released June, 2011. and I will wait for it. -- You received this message because you are subscribed to the Google

Re: RelatedManager - obj.x_set.add(y) doesn't work for me ?

2011-03-25 Thread Daniel Roseman
On Friday, March 25, 2011 10:34:25 AM UTC, southof40 wrote: > > I've got the models shown at the bottom of this email. I'm having > trouble adding a foreign key reference to a 'BookMark' object I've > created. > > I can do this ... > > >>> from bookmarks.models import BookMark, User, Tag,

Integrity Error on chained FKs

2011-03-25 Thread shofty
I've got the following models. class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) phone_number = models.CharField(max_length=250) def __unicode__(self): return self.user.username class Venue(models.Model): user = models.ForeignKey(UserProfile)

"Error: unable to open database file" when trying out the Django tutorial

2011-03-25 Thread kpk
I was trying out the tutorial "Writing your first Django app, part 1" at http://docs.djangoproject.com/en/1.3/intro/tutorial01/. The configuration is as follows: Windows XP SP2, Python 2.5.2, Django 1.3. The tutorial succeeded up to the stage of creating a project and demonstration the "Welcome

RelatedManager - obj.x_set.add(y) doesn't work for me ?

2011-03-25 Thread southof40
I've got the models shown at the bottom of this email. I'm having trouble adding a foreign key reference to a 'BookMark' object I've created. I can do this ... >>> from bookmarks.models import BookMark, User, Tag, Resource >>> User.objects.all() [] >>> b = BookMark(private=False, notes="test

Modelformset queryset problem

2011-03-25 Thread shagun jhaver
I am working with modelformset, and am stuck at one point. I am passing, say 20 forms using modelformsetfactory. These forms are constructed and displayed in the page. When I return after the posting, I do not want all of these forms to be validated and saved, but only a few ones(depending upon a

Re: Check all foreign keys before delete.

2011-03-25 Thread Jani Tiainen
On Thursday 24 March 2011 20:46:12 pbzRPA wrote: > Hi, > > I am constantly running in a brick wall when it comes to deleting > records in Django. If you have one or two foreign keys it is easy to > check if they are in use, but once an application starts getting big > you can not remember which

unique_for_date not working?

2011-03-25 Thread Ryan Osborn
Hi, I am using django 1.3 and have the following in my models.py: class Entry(models.Model): title = models.CharField(max_length=255) slug = models.SlugField(unique_for_date='created') created = models.DateField(auto_now_add=True, editable=False) However, I can add an entry in the

Re: how to select tables in inspectdb?

2011-03-25 Thread Jani Tiainen
On Thursday 24 March 2011 22:07:53 Savio Sabino wrote: > Hi. > How I select what tables (in a db with 900 tables) has the model > generated for inpectdb? Better yet, real life has pointed out that doing models by hand (even for legacy database) gives out better results than automation. You just

Re: High availability deployments

2011-03-25 Thread Jani Tiainen
We're all wrong... :) We're all wrong... Yes... Well first at all regradless of any programing language etc. there must be a service level agreement that states what that magical "high availabilty" really means. Usually, even in very critical systems there is reservation for short downtimes to

Re: Admin theme started reverting to default

2011-03-25 Thread Artem
All from project and from django source? Try to remove all the pyc files from python packages, clear cache if used, copy django into project folder, restart server. If you really didn't change anything in sources it must be cache problem at some level On 25 мар, 06:28, gondor