Re: How to make an app independent on a specific site?

2011-08-24 Thread Praveen Krishna R
*Even if you write from models import Publisher, Book, Author its gonna work, inside the books application; * On Wed, Aug 24, 2011 at 7:09 AM, Jim wrote: > Greetings, everyone. > > I am new to Django, and much of my knowledge comes from the Django book > version 2

Re: Django Development environment

2011-08-24 Thread Praveen Krishna R
On Windows Notepad++, django development server, sqlite3, south On Ubuntu Vim, MySQL, south, virtualenv -- Thanks and Regards, *Praveen Krishna R* -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Error: cannot import name settings

2011-08-24 Thread Mario Gudelj
Hi guys, I'm still a noob so please bear with me :) My friend has made a change to my django project and I got a clone of the project with his changes from the bitbucket repo, but now when I try to validate it I get: Error: cannot import name settings I tried setting the path to the new

Re: mod_wsgi cannot load MySQLdb

2011-08-24 Thread Reinout van Rees
On 23-08-11 00:37, Jim wrote: This probably has been discussed many times, but I still can't find any solution yet. Basically, it turns out that python can load MySQLdb just fine, but Apache can't load MySQLdb from the wsgi script. - Does apache use the virtualenv's environment? - Mod_wsgi:

Re: Problems on using multiple databases

2011-08-24 Thread Reinout van Rees
On 23-08-11 01:31, Jim wrote: def allow_syncdb(self, db, model): # db is a string of database name. label = model._meta.app_label if label == 'books': dbName = 'test' else: dbName = None return dbName == db I'd do the

Re: pydra

2011-08-24 Thread Tom Evans
On Tue, Aug 23, 2011 at 11:44 PM, hinnack wrote: > hi all, > > Anyone ever used pydra? > http://code.osuosl.org/projects/pydra/wiki > > could not find a thread on the list... > > Regards > > Henrik > Looks like a re-invention of celery/amqp. Think I'll stick with the

Re: Admin staticfiles stubbornly hiding behind 404s

2011-08-24 Thread Reinout van Rees
On 23-08-11 13:25, Caomhin wrote: I confess, I'm lost! I've just tried starting my first new site since upgrading to Django 1.3 and the new staticfiles settings seem to be taunting me. I've tried a number of variations but every setting I have returns a 404 for the admin interface css. Here's

Re: Problems on using multiple databases

2011-08-24 Thread Reinout van Rees
On 23-08-11 01:31, Jim wrote: django.db.utils.DatabaseError: no such table: django_content_type Which django version, btw? Early 1.2 beta versions had a bug: https://code.djangoproject.com/ticket/12999 Reinout -- Reinout van Reeshttp://reinout.vanrees.org/

Re: Error: cannot import name settings

2011-08-24 Thread Reinout van Rees
On 24-08-11 09:54, Mario Gudelj wrote: Error: cannot import name settings Are you doing "from django.conf import settings"? Is that going wrong? Or does django refuse to start? If so, what's your settings environment variable like? And: can you give the full traceback? Reinout -- Reinout

Re: How to make an app independent on a specific site?

2011-08-24 Thread Gelonida N
On 08/24/2011 08:15 AM, Praveen Krishna R wrote: > *Even if you write > > from models import Publisher, Book, Author > > its gonna work, inside the books application; > * > On Wed, Aug 24, 2011 at 7:09 AM, Jim > wrote: > It will be working,

Re: can django be used in destop application?

2011-08-24 Thread Gelonida N
> Curious concept, using Django for a desktop application. > > Can't think of any reason why you couldn't at least try it :) > > Cal > > Original poster was rather clear I think, > > it seems its orm can be used in destop application, isn't it? It could make sense to use Django orms,

Re: can django be used in destop application?

2011-08-24 Thread Thomas Weholt
I remember "way back in the day" when Userland was paving way for what was to become xml-rpc, feeds etc ( if I remeber correcly ), the core was a web application running at localhost only. Worked great! I like the idea and allready have a project for something like this. I've tried wxpython, pyqt

Re: Admin staticfiles stubbornly hiding behind 404s

2011-08-24 Thread Kevin Golding
On 24 August 2011 09:40, Reinout van Rees wrote: > On 23-08-11 13:25, Caomhin wrote: >> >> I confess, I'm lost!  I've just tried starting my first new site since >> upgrading to Django 1.3 and the new staticfiles settings seem to be >> taunting me.  I've tried a number of

RE: Re: pydra

2011-08-24 Thread Henrik Genssen
yes, some of its features seem to be solved in celery, which I have used for a long time I came across pydra because it claims to provide map/reduce features... regards Henrik >reply to message: >date: 24.08.2011 10:34:40 >from: "Tom Evans" >to:

Re: Newbe DateTimeField Question

2011-08-24 Thread Tom Evans
On Sun, Aug 21, 2011 at 12:33 PM, Torsten wrote: > Hi > > I simply want the DateTime to be set to null. > > payed_at = models.DateTimeField(null=True) > > but always get this as an error: > > IntegrityError at /admin/invoice/invoice/add/ > invoice_invoice.payed_at

Re: Admin staticfiles stubbornly hiding behind 404s

2011-08-24 Thread Reinout van Rees
On 24-08-11 11:32, Kevin Golding wrote: Basically static files is just an easier way to copy the admin css/js/etc. to the project specific directories rather than serving them directly from the master location? It is more. I mean, it doesn't just copy the admin css/js, but the css/js from ALL

Re: saving several models with one save() call

2011-08-24 Thread Babatunde Akinyanmi
You will need to save the A object first. What you can do is override the save method for B model. In the function, check for which argument in *args is an A object. When found, call the super method for A's default save method then call the super method for B's default save method. That should

Upload Progress bar

2011-08-24 Thread Dhinesh Babu
Hi Guys, I'm a newbie to this web framework of Django. As part of a project, I was asked to implement the following things - Upload Progress bar - Showing the percentage uploaded - Generally the files are very large - File being uploaded - There will be tar balls being

Re: Upload Progress bar

2011-08-24 Thread delegbede
Try django-uploadify. Sent from my BlackBerry wireless device from MTN -Original Message- From: Dhinesh Babu Sender: django-users@googlegroups.com Date: Wed, 24 Aug 2011 16:29:33 To: Reply-To: django-users@googlegroups.com

Re: Upload Progress bar

2011-08-24 Thread Cal Leeming [Simplicity Media Ltd]
A simple google search brought back the answers you needed: http://www.google.co.uk/search?sourceid=chrome=UTF-8=upload+progress+django Please refer to the following document before asking for help from the list: https://code.djangoproject.com/wiki/UsingTheMailingList Cal On Wed, Aug 24,

Drag and drop functionality?

2011-08-24 Thread glenn hafstrom
Hi I'm new to this and I have just started with django. I would like to have some kind of container for example I would like to drag and drop a webaddress to the container and then save them in my django application. Is there any Javscript or anything else that I can use to handle this? Regards

Re: Drag and drop functionality?

2011-08-24 Thread Reinout van Rees
On 24-08-11 13:19, glenn hafstrom wrote: I'm new to this and I have just started with django. I would like to have some kind of container for example I would like to drag and drop a webaddress to the container and then save them in my django application. Is there any Javscript or anything else

Need Ideas On Data Migration

2011-08-24 Thread Yaşar Arabacı
Hi, I have a model with a char field. All data saved in database in that field is a valid slug. Now I want to add this model a slug field, and copy all data from char fields to slug fields like so: Table before change: text = thisisavalidslug(char field) Table after change:

Re: message mark_safe and redirect results in message still showiing with encoded tags

2011-08-24 Thread Leon van der Ree
Great tip! thanks for this hint, I decided to (mis-)use extra_tags for this purpose! I have now implemented the following: try: # build a safe message raise InvalidUserException(message=mark_safe('some safe message')) expect Exception e: # test if content is

Re: Need Ideas On Data Migration

2011-08-24 Thread Rory Hart
South[1] handles database migrations. both schema and data. It can be a little tricky when first starting to use it but it is a powerful system. Otherwise you could alter the table yourself and copy the data using SQL or the django-admin shell. [1] http://south.aeracode.org/ -- Rory Hart

urlencode in template gives unexpected result (for me :-)

2011-08-24 Thread Michel30
Hi all, I have written an application using Django 1.3 , apache2 and a mysql db. I'm using the db to store filepaths and filenames for legacy purposes while serving them to users with apache. Now mysql is using latin-1 (with the filenames most likely stored in CP-1252) while Django uses utf-8.

query concerning three tables

2011-08-24 Thread john
i had three tables, trademarks, publication, and entry trademarks has a foreign key to publication, and publication has a foreign key to entry, and entry has a field called published_date, which i am intrested in.. how should i go about such using filters or similar.. when i am writing something

Re: urlencode in template gives unexpected result (for me :-)

2011-08-24 Thread Tom Evans
On Wed, Aug 24, 2011 at 1:47 PM, Michel30 wrote: > Hi all, > > I have written an application using Django 1.3 , apache2 and a mysql > db. > I'm using the db to store filepaths and filenames for legacy purposes > while serving them to users with apache. > > Now mysql is

Re: query concerning three tables

2011-08-24 Thread Tom Evans
On Wed, Aug 24, 2011 at 2:12 PM, john wrote: > i had three tables, > trademarks, publication, and entry > trademarks has a foreign key to publication, and publication has a > foreign key to entry, and entry has a field called published_date, > which i am intrested in.. > how

Re: urlencode in template gives unexpected result (for me :-)

2011-08-24 Thread Michel30
On Aug 24, 3:22 pm, Tom Evans wrote: > On Wed, Aug 24, 2011 at 1:47 PM, Michel30 wrote: > > Hi all, > > > I have written an application using Django 1.3 , apache2 and a mysql > > db. > > I'm using the db to store filepaths and filenames for

Re: saving several models with one save() call

2011-08-24 Thread ernando
Hi Babatunde, Thanks, I see your point. I know about this solution but thought that I've missed anything and there is a common approach how to do it automatically. So, will start working on save() method overriding. Regards, Dmitry On Aug 24, 12:36 pm, Babatunde Akinyanmi

Re: urlencode in template gives unexpected result (for me :-)

2011-08-24 Thread Tom Evans
On Wed, Aug 24, 2011 at 2:50 PM, Michel30 wrote: > > > On Aug 24, 3:22 pm, Tom Evans wrote: >> On Wed, Aug 24, 2011 at 1:47 PM, Michel30 wrote: >> > Hi all, >> >> > I have written an application using Django 1.3 , apache2

Re: saving several models with one save() call

2011-08-24 Thread Tom Evans
On Tue, Aug 23, 2011 at 11:28 PM, ernando wrote: > Hi all, > > maybe it's newbie question but I wasn't able to find clear answer/ > solution on it. > > For example, we have the following models: > > class A(models.Model): >    id = models.AutoField(primary_key=True) >    

Re: m2m assignments lost when saving in admin but not shell

2011-08-24 Thread Shawn Milochik
In case anyone's interested: I still don't know what the problem was, but I solved it by just doing a delay call to a Celery task, so it happens asynchronously. I was already using Celery/RabbitMQ, and the functionality was one of the things I wanted to make async anyway. -- You received

Re: mod_wsgi cannot load MySQLdb

2011-08-24 Thread Jianbao Tao
Thank you, Reinout. I don't know which version of python mod_wsgi uses. Here is a list of python versions on my machine. /Library/Frameworks/Python.framework//Versions/2.7/bin/python /usr/bin/python2.5 /usr/bin/python2.6 /usr/bin/pythonw2.5 /usr/bin/pythonw2.6 /usr/local/bin/python

Re: mod_wsgi cannot load MySQLdb

2011-08-24 Thread Jianbao Tao
Sorry, I pasted the 'python django.wsgi' output in a wrong place. On Wed, Aug 24, 2011 at 9:12 AM, Jianbao Tao wrote: > Thank you, Reinout. > > I don't know which version of python mod_wsgi uses. Here is a list of > python versions on my machine. > >

Re: What is Django?

2011-08-24 Thread Derek
http://www.djangobook.com/en/2.0/chapter01/ discusses what a web framework is, and why/how it might offer you more productivity just using "raw" Python (bearing in mind that most of the time, apart from the HTML templates, you *will* be using Python anyway). You cannot "see" a sample app because

Re: saving several models with one save() call

2011-08-24 Thread Tundebabzy
On Aug 24, 3:36 pm, Tom Evans wrote: > On Tue, Aug 23, 2011 at 11:28 PM, ernando wrote: > > Hi all, > > > maybe it's newbie question but I wasn't able to find clear answer/ > > solution on it. > > > For example, we have the following models:

Re: Problems on using multiple databases

2011-08-24 Thread Jianbao Tao
Thank you, Reinout. I changed the definition of 'allow_syncdb' to the following: def allow_syncdb(self, db, model): # db is a string of database name. label = model._meta.app_label if label == 'books': dbName = 'test' else: dbName =

Re: mod_wsgi cannot load MySQLdb

2011-08-24 Thread Reinout van Rees
On 24-08-11 17:12, Jianbao Tao wrote: Thank you, Reinout. I don't know which version of python mod_wsgi uses. Look in /etc/apache2/mods-enabled/wsgi.load (that's on ubuntu, your mod_wsgi config file might be somewhere else. On one of my older servers it contains: LoadModule wsgi_module

Re: Problems on using multiple databases

2011-08-24 Thread Reinout van Rees
On 24-08-11 17:57, Jianbao Tao wrote: Now './manage.py syncdb' can run through with no problems. However, it doesn't create the database 'test.sqlite', which means the models in the app, books, are still installed in the default database. That's in the django docs: syncdb only managed the

Re: mod_wsgi cannot load MySQLdb

2011-08-24 Thread Tom Evans
On Mon, Aug 22, 2011 at 11:37 PM, Jim wrote: > Hello folks, > This probably has been discussed many times, but I still can't find any > solution yet. Basically, it turns out that python can load MySQLdb just > fine, but Apache can't load MySQLdb from the wsgi script. > I am

Re: Drag and drop functionality?

2011-08-24 Thread glenn hafstrom
Hi Reinout Thanks for your input. I've googled a lot but I haven't found anything where I can drag from another application to my django-site Regards glenn On 24 Aug, 13:30, Reinout van Rees wrote: > On 24-08-11 13:19, glenn hafstrom wrote: > > > I'm new to this and I

Re: saving several models with one save() call

2011-08-24 Thread ernando
Hi Tom & Tundebabzy, I understood your idea & approach. But as I've mentioned - I receive the model from the 3rd party service & want to save it. As I have experience with Hibernate - it provides such features. That's why I'm a little bit frustrated with python approach. BR, Dmitry On Aug 24,

Re: saving several models with one save() call

2011-08-24 Thread Kayode Odeyemi
Dmitry, I understand what you are trying to do clearly, coming from a Java background myself. But this is Python. Do it the Python way. On Wed, Aug 24, 2011 at 6:33 PM, ernando wrote: > Hi Tom & Tundebabzy, > > I understood your idea & approach. But as I've mentioned

Re: Need Ideas On Data Migration

2011-08-24 Thread Kayode Odeyemi
+1 to South Just started with it myself On Wed, Aug 24, 2011 at 1:25 PM, Rory Hart wrote: > South[1] handles database migrations. both schema and data. It can be a > little tricky when first starting to use it but it is a powerful system. > > Otherwise you could alter the

Re: Need Ideas On Data Migration

2011-08-24 Thread Yaşar Arabacı
Thanks, I am marking this thread as SOLVED :) 2011/8/24 Kayode Odeyemi > +1 to South > > Just started with it myself > > > On Wed, Aug 24, 2011 at 1:25 PM, Rory Hart wrote: > >> South[1] handles database migrations. both schema and data. It can be a >>

Re: Django Development environment

2011-08-24 Thread cihan okyay
2011/8/23 Stephen Jackson > I am new to the world of Django. I would like to hear from other django > developers describe their dev environment (tools, os, editors, etc.). OS: Mac OSX Development: TextMate, VIM, virtualenv, pip, south Deployment: Ubuntu, apache,

Creating an alternative change_list view for a specific app/model, not extending or overriding

2011-08-24 Thread Thomas Weholt
I want to create a view looking and working just like the admin change_list, but using my own template ( based on the admin change_list template ) so that all the filtering you get from specifiying filtering in your adminmodel still works in my new view. I DO NOT want to extend or override the

Re: dynamic field display

2011-08-24 Thread Axel Bock
yaah, but that's the most … inconvenient. the data model allows for the user to customize the fields he wants to use, depending on his requirements. I could start small, but the problem _will_ come at some point, so I thought I asked beforehand. but thanks for the answer, I already started

Question on the user auth model

2011-08-24 Thread raj
I'm reading the django docs, and I come across the following: from django.contrib.auth.models import User class UserProfile(models.Model): # This field is required. user = models.OneToOneField(User) # Other fields here accepted_eula = models.BooleanField() favorite_animal =

Re: Creating an alternative change_list view for a specific app/model, not extending or overriding

2011-08-24 Thread Thomas Orozco
What about calling your admin view with a GET "alternate=1" parameter ? An if statement in a template override would then allow you to render properly depending on the aforementioned attribute provided you're passing the request in the Context. This event allows you to fine tune which bits you

Re: Problem updating data

2011-08-24 Thread Malcolm Box
Instead of counting the inactive, try counting the active ones. If that count doesn't go up by one, I'd suspect something's dodgy in your Entry model's save() that means it doesn't write successfully to the db. You could debug by doing: from django.db import connection connection.queries

Tips for setting up multiple databases routing in Django

2011-08-24 Thread Jim
First of all, I would like to thank Reinout van Rees ( http://reinout.vanrees.org/) for his helpful suggestions. Suppose you have two databases, 'default' and 'test', and one app, 'books'. And you want to store the models in books in the database 'test'. According to the guide from Django

Re: Problems on using multiple databases

2011-08-24 Thread Jianbao Tao
Reinout, Thanks so much for your help. I think I have figured out the solution. I posted it on https://groups.google.com/forum/?hl=en#!topic/django-users/zwMWNdIqB3A. Please take a look. Jianbao On Wed, Aug 24, 2011 at 10:13 AM, Reinout van Rees wrote: > On 24-08-11

Re: mod_wsgi cannot load MySQLdb

2011-08-24 Thread Jianbao Tao
Thanks, Tom, Reinout. I think I forgot to mention the configuration of my machine. Here it is. - Mac OS Snow Leopard 10.6.8 - mysql-5.5.14-osx10.6-x86_64 - Apache2 (shipped with OSX) - mod_wsgi 3.3 And here is some additional information that may help. >$ file

Re: mod_wsgi cannot load MySQLdb

2011-08-24 Thread Jianbao Tao
BTW, the virtualenv uses python2.7 On Wed, Aug 24, 2011 at 6:54 PM, Jianbao Tao wrote: > Thanks, Tom, Reinout. > > I think I forgot to mention the configuration of my machine. Here it is. > >- Mac OS Snow Leopard 10.6.8 >- mysql-5.5.14-osx10.6-x86_64 >-

Re: Error: cannot import name settings

2011-08-24 Thread Kejun He
Search "settings" in your project, and see the settings how to be imported. On Wed, Aug 24, 2011 at 4:45 PM, Reinout van Rees wrote: > On 24-08-11 09:54, Mario Gudelj wrote: > >> Error: cannot import name settings >> > > Are you doing "from django.conf import settings"? Is

Customizing the admin form

2011-08-24 Thread Cu7l4ss
Hi, I have customized a model admin form, editing the label_for_instance for a ForeignKey field and a MultiChoice Field. As a result the plus button was gone. How can I insert it back? (didn't find anything in the documentation) Couple more questions: 1. I have a django mptt key and when I

Re: How to add CSRF to context when using test client???

2011-08-24 Thread Matteius
Thanks for both suggestions, I recently tried this approach and reached success when I ran my tests. So I think this is the correct approach and I'll include this CSRF style testing with my test suite now. -Matteius On Jul 7, 6:02 am, Craig Blaszczyk wrote: > csrf_token

Re: Error: cannot import name settings

2011-08-24 Thread Mario Gudelj
Thanks for your help guys. It seems that there is an issue in django_countries app where the fields.py file has "from django_countries import settings", but there's no settings.py file inside the django_countries folder. When I comment out that line the project validates. I wish that the error

Setting default form value in template

2011-08-24 Thread raj
I'm trying to set a default form value in the template, and not in the forms.py file (because I'm trying to make the default value dynamic depending on something that javascript will return). So To test it, I have the following line in my template: {{ form.first_name|default:"Enter Your first