Re: form.Forms + POST + forms.ChoiceField

2012-04-03 Thread Sergiy Khohlov
try to use django generic class view https://docs.djangoproject.com/en/dev/topics/class-based-views/ Sorting is added by adding next construction to the your class view: class yourclassview(ListView): """ model = yourmodel context_object_name = 'object_or_list' templat

Why using Generic Views?

2012-04-03 Thread abisson
Good evening, I just finished the Django 1.4 Tutorial, and I really don't understand the point of Generic Views in Django? As far as I can see, we wrote more code than before, and what other example would make the Generic Views better than normal views? Thanks for the clarifications! -- You rec

Re: Django database-api

2012-04-03 Thread Eugenio Minardi
Hi, Do you mean the SQL generated by your model? In this case you can use python manage.py sql APPNAME On Tue, Apr 3, 2012 at 8:45 AM, KasunLak wrote: > Hi all, > > I just wonder is there a way to browse/view the code of database api > methods generated? Is there any tool for this? > > Thanks

"Expression of Interest" django project

2012-04-03 Thread Alec Taylor
I am thinking to setup an "expression of interest" page with a survey ending with a "subscribe for updates" button. The relevant features being: • View percentages who choice which options in the survey on a graph • Subscribe for updates equates to newsletter backend • Twitter Bootstrap theme It

Re: Why using Generic Views?

2012-04-03 Thread Sergiy Khohlov
Generic views helps to avoid writting some part of the trivial code. For example : you are writing a shop with goods and a lot of the pages contains list of the items. You should about sorting orders, page selecting etc. If you are using generic views then you might not spend time at this. A

Re: Django Contrib Auth + Class Based Generic Views

2012-04-03 Thread Sergiy Khohlov
Please provide your urls.py and your view which is used for this 2012/4/3 Matheus Ashton : > Hello Everybody, > > I'm having a problem using the django.contrib.auth app and class based > generic views in Django 1.3 / 1.4: > > After submitting the login form, my view receives the post data a

Re: Django database-api

2012-04-03 Thread KasunLak
Hi, No, sorry for not giving more details. What I am asking is once we syncdb the generated scripts (create table). Can we see the method implementation of database access api? For example: If we have created and deployed a model called Poll (tutorial example in django site) p = Poll.objects.get

custom manager to control access

2012-04-03 Thread Mike Dewhirst
I'm trying to make a custom manager for a few models. The objective is to limit user access to information in the database belonging to the company of which they are a member. I think I want to say: class Something(models.Model): ... objects = MemberManager() But when I run manage.py

Re: Django database-api

2012-04-03 Thread akaariai
On Apr 3, 11:27 am, KasunLak wrote: > Hi, > > No, sorry for not giving more details. What I am asking is once we > syncdb the generated scripts (create table). Can we see the method > implementation of database access api? > > For example: If we have created and deployed a model called Poll > (tut

Re: custom manager to control access

2012-04-03 Thread Tom Evans
On Tue, Apr 3, 2012 at 9:43 AM, Mike Dewhirst wrote: > I'm trying to make a custom manager for a few models. The objective is to > limit user access to information in the database belonging to the company of > which they are a member. > > I think I want to say: > > class Something(models.Model): >

Re: Django database-api

2012-04-03 Thread KasunLak
Hi, Thanks you very much for the informative answer! It clears all the questions I had in my mind. Because I have some idea to build a tool to draw the model (UML) --> Generate Django Model code --> and then we can deploy it to db. Moreover I was thinking that if it possible to customize (edit exi

Re: django admin form customization

2012-04-03 Thread anand jeyahar
Hi al, > >     1. I have customized the admin change form to display as inline > form  a child table/model fields. Now how do i get this form to > display existing child rows too? I guess, i will have to customize the > views.py for the admin app right?? >  If so how can point django to pick up th

querysets

2012-04-03 Thread MikeKJ
Although I use the queryset I dont really understand the object return, when the object is returned just what is returned like list = This.objects.all() list is [, http://groups.google.com/group/django-users?hl=en.

Is this a bug? - Translation in error messages django.forms.models._update_errors()

2012-04-03 Thread david_aa
First at all, my apologies if this message is off-topic. I'm not sure if this is a bug and I can't find any related ticket in code.djangoproject.com The problem is the following: I've defined in my model some fields with the attribute verbose_name marked for translation: class Item(): name

Re: querysets

2012-04-03 Thread MikeKJ
FORGET THIS, I was having a brain fart -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/s69DS52RSR4J. To post to this group, send email to django-users@goog

Re: Is this a bug? - Translation in error messages django.forms.models._update_errors()

2012-04-03 Thread david_aa
Sorry, my django version: 1.4.0 El martes 3 de abril de 2012 12:33:32 UTC+2, david_aa escribió: > > First at all, my apologies if this message is off-topic. I'm not sure if > this is a bug and I can't find any related ticket in > code.djangoproject.com > > The problem is the following: > > I'v

Re: where do you host your django app and how to you deploy it?!

2012-04-03 Thread N.Aleksandrenko
What about cloud solutions? On Mon, Apr 2, 2012 at 2:38 PM, Jani Tiainen wrote: > 2.4.2012 13:48, fix3d kirjoitti: > >> Where do you host your django app and how to you deploy it?! >> >> Please share personal exp. >> > > We're deploying to our own application server cluster. > > And we're using f

Re: Django: 404 page not found

2012-04-03 Thread Homer
Sorry, I did not find "TEMPLATE_CONTEXT_PROCESSORS" in my settings.py. I do not know whether it is related to the version of Django. I am using Django 1.3 right now. 在 2012年4月3日星期二UTC-4上午2时20分30秒,skhohlov写道: > > please post section of the setting.py file > > TEMPLATE_CONTEXT_PROCESSORS > > Ha

Re: Django: 404 page not found

2012-04-03 Thread Sergiy Khohlov
this section from my last project : TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.request', 'django.core.context_processors.debug', 'django.core.context_processors.i18n', 'django.core.context_processors.media', 'django.core.context_processors.static',

Profiling Django (WAS Django database-api)

2012-04-03 Thread Andre Terra
While I know of the two methods mentioned by Anssi, I've often wondered how to profile my code from a project level. I have some complex and database intensive asynchronous tasks running under celery which take a LONG time to complete and I'd just love to be able to keep track of the queries they

Problemas con syncdb

2012-04-03 Thread DIEGO CENZANO PRADO
I am trying to do the tutorial and I get an error doing 'python manage.py syncdb'. I am using the DATABASES as it is created and I've try to use sqlite3 and mysql backends. I tried it in windows and in unix. Rasult is always the same: raise ImproperlyConfigured("settings.DATABASES is improperly

Re: Django: 404 page not found

2012-04-03 Thread Homer
I add the section you provided to my settings.py but it still does not work... 在 2012年4月3日星期二UTC-4上午8时57分57秒,skhohlov写道: > > this section from my last project : > > > TEMPLATE_CONTEXT_PROCESSORS = ( > > 'django.core.context_processors.request', > 'django.core.context_processors.debug',

Re: Django: 404 page not found

2012-04-03 Thread Sergiy Khohlov
Could you please add your setting.py from root of the your project to your letter ? 2012/4/3 Homer : > I add the section you provided to my settings.py but it still does not > work... > > 在 2012年4月3日星期二UTC-4上午8时57分57秒,skhohlov写道: >> >> this section from my last project : >> >> >> TEMPLATE_CONTEX

Re: Django: 404 page not found

2012-04-03 Thread Tom Evans
On Tue, Apr 3, 2012 at 1:14 AM, Homer wrote: > I met "404" page not found when I try to enter 127.0.0.1:8000/cn/bedroom . > It says on the webpage that "C:/Django/final/media/bedroom" does not exist". > Why would this happen? > > urls.py: > > from django.conf.urls.defaults import * > from final im

Re: Problemas con syncdb

2012-04-03 Thread Andre Terra
I guess you could check if you're actually looking at the right file. $ python manage.py shell >>> import settings >>> print settings.__file__ Cheers, AT On Tue, Apr 3, 2012 at 10:28 AM, DIEGO CENZANO PRADO wrote: > I am trying to do the tutorial and I get an error doing 'python manage.py

Re: Problemas con syncdb

2012-04-03 Thread Sandro Dutra
# Or *path to database file* if using *sqlite3*. 2012/4/3 DIEGO CENZANO PRADO > I am trying to do the tutorial and I get an error doing 'python manage.py > syncdb'. I am using the DATABASES as it is created and I've try to use > sqlite3 and mysql backends. I tried it in windows and in unix. Ras

Re: Django: 404 page not found

2012-04-03 Thread Sebastian Goll
On Mon, 2 Apr 2012 17:14:00 -0700 (PDT) Homer wrote: > I met "404" page not found when I try to enter 127.0.0.1:8000/cn/bedroom . > It says on the webpage that "C:/Django/final/media/bedroom" does not > exist". Why would this happen? I am positive the problem is with your URL patterns: > # ur

Re: Problemas con syncdb

2012-04-03 Thread DIEGO CENZANO PRADO
Thank you for your feedback. I was using django 1.4. I have changed to the previous version and it is working. Maybe a bug in the new version? El martes 3 de abril de 2012 16:12:04 UTC+2, imarcelolz escribió: > > Try to setup the absolute path on "NAME". > > *Um Abraço!* > *Ivo Marcelo Leonardi Z

Re: Need help

2012-04-03 Thread thongor
Wow this post is really old but this also solved my problem strangely enough. On Thursday, June 25, 2009 2:48:32 PM UTC-4, amy wrote: > > I had this same problem...the user and pass were fine but no users > could authenticate on any DB, regardless of settings. > > Turns out my issue was only t

Re: Problemas con syncdb

2012-04-03 Thread Ivo Marcelo Leonardi Zaniolo
Its not a bug. Im using 1.4 too and got no error. Att Ivo Marcelo Leonardi Zaniolo Sent from mobile imarcelolz.blogspot.com.br On Apr 3, 2012 11:29 AM, "DIEGO CENZANO PRADO" wrote: > Thank you for your feedback. I was using django 1.4. I have changed to the > previous version and it is working.

Problems with Virtualenv and Django 1.4 -- deployment on uwsgi.

2012-04-03 Thread Maciej Szlosarczyk
Since I've upgraded the version of Django and started a new project on it, I cannot make it work properly with uwsgi. The problem is that django doesn't import apps from project tree. My settings.py looks like this: INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes',

Re: Problems with Virtualenv and Django 1.4 -- deployment on uwsgi.

2012-04-03 Thread Roberto De Ioris
> Since I've upgraded the version of Django and started a new project on > it, I cannot make it work properly with uwsgi. > > The problem is that django doesn't import apps from project tree. My > settings.py looks like this: > > INSTALLED_APPS = ( > 'django.contrib.auth', > 'django.contri

Re: Need help

2012-04-03 Thread Andre Terra
It could be a regression bug. To be honest, I don't see a reason why '' should become 'localhost' automagically. I'd much prefer if users were forced to write 'localhost' rather than having Django do it (and fail) for them. Explicit is better than implicit. If you haven't yet, please file a bug

Re: Django: 404 page not found

2012-04-03 Thread Homer
OK. # Django settings for final project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_em...@example.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mys

Re: Django: 404 page not found

2012-04-03 Thread Homer
OK. # Django settings for final project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_em...@example.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mys

Re: Django: 404 page not found

2012-04-03 Thread Homer
If I split them up, I cannot see my pictures on the webpage since the links of them becomes "http://127.0.0.1:8000/cn/simages/XXX.jpg";. But my pictures stored in "http://127.0.0.1:8000/media/simages/XXX.jpg";... That's why I mix them up... 在 2012年4月3日星期二UTC-4上午10时09分11秒,Tom Evans写道: > > On Tue

Re: Django: 404 page not found

2012-04-03 Thread Homer
I fixed it by changing the urlconf to r'^bedroom/'. Thanks!! 在 2012年4月3日星期二UTC-4上午10时17分03秒,Sebastian写道: > > On Mon, 2 Apr 2012 17:14:00 -0700 (PDT) > Homer wrote: > > > I met "404" page not found when I try to enter 127.0.0.1:8000/cn/bedroom. > > It says on the webpage that "C:/Django/

Re: Profiling Django (WAS Django database-api)

2012-04-03 Thread Javier Guerra Giraldez
On Tue, Apr 3, 2012 at 8:21 AM, Andre Terra wrote: > I have some complex and database intensive asynchronous tasks running under > celery which take a LONG time to complete and I'd just love to be able to > keep track of the queries they generate in order to optimize and possibly > remove the bigg

AttributeError at /admin/coltrane/entry/add/ 'Entry' object has no attribute 'pubdate'

2012-04-03 Thread laurence Turpin
Hello, I'm trying to learn Django from the book "Practical Django Projects 2nd Edition" I'm using Django 1.3.1 and Python 2.7.2 on Windows 7 Also I'm using Eclipse Indigo with pydev The current project I'm working on is to create a Weblog called coltrane. coltrane is an application that exists

dynamically adding form fields

2012-04-03 Thread Matt Warren
I'm working on a complex form and not sure if there is an elegant way to handle it in django. The form creates an invoice and it uses jQuery to dynamically add/remove extra form fields into the HTML for line items. Each line item contains several fields including description, unit price, quant

Re: Profiling Django (WAS Django database-api)

2012-04-03 Thread Andre Terra
Hey Javier, Thanks for the reply. My problem with the logs in the past was that they tended to make the task even slower (due to recursion) but I guess that's probably because I didn't call the logging from the appropriate places in the code. To make things a little more complicated, the task inv

Re: dynamically adding form fields

2012-04-03 Thread Andre Terra
Hi Matt, Search the docs for inlines, inline formsets and inline formset factories, and you'll find exactly what you need [0]. Read them carefully cause it's easy to make mistakes and debugging inlines has always been frustrating for me. Good luck and happy coding. Cheers, AT [0] https://docs.

Re: custom manager to control access

2012-04-03 Thread Mike Dewhirst
On 3/04/2012 7:00pm, Tom Evans wrote: On Tue, Apr 3, 2012 at 9:43 AM, Mike Dewhirst wrote: I'm trying to make a custom manager for a few models. The objective is to limit user access to information in the database belonging to the company of which they are a member. I think I want to say: cla

Re: where do you host your django app and how to you deploy it?!

2012-04-03 Thread Mario Gudelj
EC2 with Ubuntu instance with Postgre+nginx On 3 April 2012 20:57, N.Aleksandrenko wrote: > What about cloud solutions? > > On Mon, Apr 2, 2012 at 2:38 PM, Jani Tiainen wrote: > > 2.4.2012 13:48, fix3d kirjoitti: > > > >> Where do you host your django app and how to you deploy it?! > >> > >> Pl

Re: Django Contrib Auth + Class Based Generic Views

2012-04-03 Thread Matheus Ashton
urls.py: urlpatterns = patterns('', url(r'^/login$', LoginView.as_view()), url(r'^$', HomeView.as_view(), {}, 'home'), ) settings.py: LOGIN_URL='/login/' views.py: class LoginView(FormView): form_class = LoginForm template_name = "auth/form.html" def post(self, request, *args,

Model validation fails, when inherited model redeclare parent field

2012-04-03 Thread shiva
Hello! In our apps (that use Django 1.2.7) we use following models: class BaseRegistration(models.Model): exhibition = models.ForeignKey(...) year = models.IntegerField(...) user = models.ForeignKey('auth.User') class BarcodeRegistration(BaseRegistration): class M

Re: Profiling Django (WAS Django database-api)

2012-04-03 Thread Javier Guerra Giraldez
On Tue, Apr 3, 2012 at 5:25 PM, Andre Terra wrote: > To make things a little more complicated, the task involves writing a large > amount of data to a temp database, handling it and then saving some > resulting queries to the permanent DB. This makes it a tad harder to analyze > what goes on in th

Re: django-admin change form page validation

2012-04-03 Thread kenneth gonsalves
On Sat, 2012-03-31 at 09:25 +0530, Nikhil Verma wrote: > How can i do this kind validation where fields are dependent on each > other https://docs.djangoproject.com/en/1.4/ref/contrib/admin/#adding-custom-validation-to-the-admin docs are wonderful -- regards Kenneth Gonsalves -- You received

Help. ORM Trigger After Insert.

2012-04-03 Thread Ganesh Kumar
Hi Guys, I am new to the ORM concepts in Django. My Django application writing on table. it's working fine. But I want writing table the same copy of writing data stored in another table . Guys help me the concepts in mysql Triggers in After insert. the same way achieve in django ORM. guide me. -

Re: Model validation fails, when inherited model redeclare parent field

2012-04-03 Thread Jani Tiainen
Hi, You'ew hitting limitation of Django ORM which prohibits overriding fields. https://docs.djangoproject.com/en/1.3/topics/db/models/#field-name-hiding-is-not-permitted 4.4.2012 6:34, shiva kirjoitti: Hello! In our apps (that use Django 1.2.7) we use following models: class BaseRegistratio

Re: Model validation fails, when inherited model redeclare parent field

2012-04-03 Thread shiva
Jani, thank you. 2012/4/4 Jani Tiainen : > Hi, > > You'ew hitting limitation of Django ORM which prohibits overriding fields. > > https://docs.djangoproject.com/en/1.3/topics/db/models/#field-name-hiding-is-not-permitted > > > 4.4.2012 6:34, shiva kirjoitti: > >> Hello! >> >> In our apps (that use

Re: Questions about UnicodeDecodeError

2012-04-03 Thread Ian Clelland
On Monday, April 2, 2012, Ali Mesdaq wrote: > I did have UTF-8 in the db before but then when I was inserting(done by a > script) values in I would get errors. I really want to avoid doing > conversions before I insert the data so I can maintain the data in the > exact format as it was seen in.