Re: ImportError importing forms.py into models.py

2011-02-01 Thread Daniel Roseman
On Monday, January 31, 2011 11:34:48 PM UTC, Jeffrey Stiles wrote: > > I would really like to make a form instance a model attribute so that > i have access to the form from the template through an object that I > have handy. > > When I try to import import any form into models.py, I get an > I

Re: ImportError importing forms.py into models.py

2011-02-01 Thread bruno desthuilliers
On 1 fév, 07:34, Ivo Brodien wrote: > if you have circular imports, you can try to put the name of the model. This > at least works for Foreign Keys > http://www.catb.org/jargon/html/V/voodoo-programming.html HTH -- You received this message because you are subscribed to the Google Groups "D

blank ModelMultipleChoiceField, sort a ManyToManyField that is allowed to be blank

2011-02-01 Thread Santiago Caracol
Hi, why can't a ModelMultipleChoiceField not have the property "blank=True"? I need the ModelMultipleChoiceField to sort the values of a models.ManyToManyField in a form class. Sorting works as expected, but only if the field is obligatory. (Else, I get the error message "TypeError: __init__() go

Re: pyodbc & FreeTDS: Can I work with NVARCHAR column on MSSQL2008

2011-02-01 Thread Orgil
Thank you so much Adnan! You have rescued me from the hell like corner! Big big thank, again again. -- 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 grou

Formset problem

2011-02-01 Thread NavaTux
Hi, I wanna to display a THREE recursive ModelForms in a single page in my django admin so i chose my code like that this is my ModelAdmin module admin.py class JobAdminForm(forms.ModelForm): class Meta: model = Job#Job is my model description = forms.CharField(

Re: blank ModelMultipleChoiceField, sort a ManyToManyField that is allowed to be blank

2011-02-01 Thread Daniel Roseman
On Tuesday, February 1, 2011 9:45:04 AM UTC, Santiago Caracol wrote: > > Hi, > > why can't a ModelMultipleChoiceField not have the property > "blank=True"? > > I need the ModelMultipleChoiceField to sort the values of a > models.ManyToManyField in a form class. Sorting works as expected, but

Re: Selecting related objects with condition

2011-02-01 Thread Martin Tiršel
Thanks, I didn't know the {% ifchanged %} tag. Martin On Mon, 31 Jan 2011 22:58:55 +0100, Michael wrote: The easiest way would be to get a list of all closed work items, ordered by user: context['work'] = Work.objects.filter(whatever).order_by('user') {% for work_item in work %}

Re: blank ModelMultipleChoiceField, sort a ManyToManyField that is allowed to be blank

2011-02-01 Thread Santiago Caracol
> No form fields take that argument - that's for model fields. > > Form fields take the argument "required", which defaults to True. Thank you! That is exactly the information I needed. By the way, is there a special reason why "blank" of model fields translates to "required" of form fields? San

memory, time, 1000 lines model or 100 models with 10 lines

2011-02-01 Thread gintare
I have an object, which described in one model has 1000 lines. Another way is to split object to 100 pieces with 10 lines length. In both cases the 1000 lines will be filled in memory. I am going to create tens of thousands entrances of this object. If the object model will be split to 100 model

Re: blank ModelMultipleChoiceField, sort a ManyToManyField that is allowed to be blank

2011-02-01 Thread Santiago Caracol
Ah, now there is a new problem. Before, my ManyToManyField was unsorted, but it was possible to add new items by clicking on the "+" button. Now my items are sorted thanks to a ModelMultipleChoiceFormField (with "order_by('...')" and "required=False"), but the "+" button is gone. Is there a way t

Re: memory, time, 1000 lines model or 100 models with 10 lines

2011-02-01 Thread Javier Guerra Giraldez
On Tue, Feb 1, 2011 at 5:41 AM, gintare wrote: > What is better performance of the Django, Sqlite3. > Have 20.000 entrances in the table with 1000 columns > or 2.000.000 entrances in the table with 10 columns I would hate to work with a 1000 column table. and row-oriented databases (like all tra

[Ann] Celery 2.2 released!

2011-02-01 Thread Ask Solem Hoel
== Celery 2.2 is now available! == We're happy to announce the release of Celery 2.2. Thanks to all contributors, testers and users, which without this release would not have been possible. What is it? === Celery is an asynchronou

switch to apache

2011-02-01 Thread Ethan Yandow
Alright, im not really sure how to explain this but here goes. I just got Django running on apache. I got apache to work in the same way that the development server does. The only problem is that when I modify a django file (a template or a view or anything) Django/apache doesn't seem to notice

Re: Storing *big* texts in db fields

2011-02-01 Thread django-us...@fadedink.co.uk
Is it possible the wordcount method is slowing everything down? If the wordcount is displayed in the table list in the Admin interface, I imagine it will need to count words of *every* model instance before showing the table. If might be worth temporarily disabling the wordcount feature to see if

Re: Storing *big* texts in db fields

2011-02-01 Thread Mike Ryan
(I tried to post this once before, but the browser crashed so I am not sure if it got posted. Apologies for dupe content if so) Is it possible the wordcount function is slowing everything down? Does it run each time you view the admin page? If so, I would try adding it as an attribute to the model

using return upper

2011-02-01 Thread makayabou
Hello, I'm trying to modify my admin.py from my app "ordis": from ordis.models import Ordi, Maintenance, OperatingSystem from django.contrib import admin #class MaintenanceAdmin(admin.ModelAdmin): #list_display = (???) here I would like to see my Computer id, and the OS installed on it d

Re: using return upper

2011-02-01 Thread Tom Evans
On Tue, Feb 1, 2011 at 10:32 AM, makayabou wrote: > Hello, > I'm trying to modify my admin.py from my app "ordis": > > from ordis.models import Ordi, Maintenance, OperatingSystem > from django.contrib import admin > > #class MaintenanceAdmin(admin.ModelAdmin): >        #list_display = (???) here I

Re: switch to apache

2011-02-01 Thread Tom Evans
On Tue, Feb 1, 2011 at 4:38 AM, Ethan Yandow wrote: > Alright, im not really sure how to explain this but here goes.  I just > got Django running on apache.  I got apache to work in the same way > that the development server does.  The only problem is that when I > modify a django file (a template

Re: using return upper

2011-02-01 Thread makayabou
Hello, With your stuff, it still shows me (None). You are right, Ordi means Ordinateur (computer) Florian On 1 fév, 13:40, Tom Evans wrote: > On Tue, Feb 1, 2011 at 10:32 AM, makayabou wrote: > > Hello, > > I'm trying to modify my admin.py from my app "ordis": > > > from ordis.models import Or

Re: Storing *big* texts in db fields

2011-02-01 Thread Karen McNeil
Thank you for your responses. I think you're right that calculating the wordcount could be the problem. I also have another method that displays the authors, so that I can see the author(s) in the admin list, even though it's a ManyToMany relationship. I would imagine that that's part of the probl

subprocess blocks view

2011-02-01 Thread Matt Labbé
Hello, I have a problem calling subprocess.Popen from a view: The view that calls subprocess.Popen is not displayed until the subprocess finishes. The server send "200 OK" immediately, but not the content of the page. My question is: Is this a limitation of Django's development server or am I doi

Django, Postgres and recovering from database constraints

2011-02-01 Thread Xavier Ordoquy
Hi all, I got a project which sometime outputs database integrity errors (key violates unique constraint). It is fine since I'm keeping an events table which may have several creation messages for the same object. Until now, I was just catching the exception and forgot about it. Today, I'm not

Re: Storing *big* texts in db fields

2011-02-01 Thread Tom Evans
On Tue, Feb 1, 2011 at 2:18 PM, Karen McNeil wrote: > Thank you for your responses. > > I think you're right that calculating the wordcount could be the > problem. I also have another method that displays the authors, so that > I can see the author(s) in the admin list, even though it's a > ManyTo

Re: Django, Postgres and recovering from database constraints

2011-02-01 Thread bruno desthuilliers
On 1 fév, 15:24, Xavier Ordoquy wrote: > Hi all, > > I got a project which sometime outputs database integrity errors (key > violates unique constraint). > It is fine since I'm keeping an events table which may have several creation > messages for the same object. Hmmm... Either I misunderstood

Re: Styling help_text

2011-02-01 Thread Preston Timmons
Hi Scot, Unfortunately, the patch to that ticket was committed after 1.2 was released. That feature isn't available until 1.3 or in trunk. What you see in the docs is an error. The original patch didn't include an update there. I created a ticket to have the docs corrected. http://code.djangopro

Re: contenttypes and dumpdata options

2011-02-01 Thread Preston Timmons
Hi JD, Yes, using natural keys will allow you to serialize models that use the contenttypes framework. You can read about this feature here: http://docs.djangoproject.com/en/dev/topics/serialization/#natural-keys Preston On Jan 29, 1:59 pm, jd wrote: > hello, > What's the current recommended

Re: switch to apache

2011-02-01 Thread Ethan Yandow
Alright, thanks. Hopefully that will work. I am also trying to figure out the best way to get the information from an html form and set that to a variable and place that information back in my database. What is the simplest way to do that? On Tue, Feb 1, 2011 at 7:49 AM, Tom Evans wrote: > On

Re: switch to apache

2011-02-01 Thread Tom Evans
On Tue, Feb 1, 2011 at 3:25 PM, Ethan Yandow wrote: > Alright, thanks.  Hopefully that will work.  I am also trying to figure out > the best way to get the information from an html form and set that to a > variable and place that information back in my database.  What is the > simplest way to do t

Django SQL Query does not stop

2011-02-01 Thread Ivo Brodien
When I am in admin and I access of a certain model, Django calls mysql with an Query which increases mysql CPU load to 99% and it never returns. If I copy the the SQL Query right into mysql the same thing happens, so it is actually kind of a mysql problem, but since Django created the query, I t

Spatial SQL to Django Query Help

2011-02-01 Thread Ryan Clark
Hi there - I have two related models. MapUnitPolys has a 1:M relationship to DescriptionOfMapUnits. MapUnitPolys has a geometry field, DescriptionOfMapUnits does not. The query that I'm trying to accomplish is something like SELECT DISTINCT DescriptionOfMapUnits.* FROM ( MapUnitPolys INNER JO

Re: Django SQL Query does not stop

2011-02-01 Thread Tom Evans
On Tue, Feb 1, 2011 at 3:53 PM, Ivo Brodien wrote: > When I am in admin and I access of a certain model, Django calls mysql with > an Query which increases mysql CPU load to 99% and it never returns. > > If I copy the the SQL Query right into mysql the same thing happens, so it is > actually kin

Re: Django, Postgres and recovering from database constraints

2011-02-01 Thread Xavier Ordoquy
Le 1 févr. 2011 à 15:59, bruno desthuilliers wrote : > On 1 fév, 15:24, Xavier Ordoquy wrote: >> Hi all, >> >> I got a project which sometime outputs database integrity errors (key >> violates unique constraint). >> It is fine since I'm keeping an events table which may have several creation >

Re: Styling help_text

2011-02-01 Thread shacker
Thanks for the info, and for the doc patch Preston. Back to manual mode for now :) ./s On Feb 1, 6:59 am, Preston Timmons wrote: > Hi Scot, > > Unfortunately, the patch to that ticket was committed after 1.2 was > released. That feature isn't available until 1.3 or in trunk. > > What you see in

Re: Filtered drop down choice django

2011-02-01 Thread shacker
On Jan 31, 6:40 am, sushanth Reddy wrote: > I am trying to create a dynamic filtered drop down choice fields,i gone > through below blog but it confusing,can any one suggest easy way to do this > in django. Do you mean in the admin or on your live site? If in the admin, check out the docs on Mod

Looking for a Python / Django tutor in the Bay Area

2011-02-01 Thread spaceshuttle
Hi Django users, I am looking for someone who can help me work on a web application that I started developing with Django, about 2 months ago. I need someone local to the Bay Area, ideally around Palo-Alto / Mountain View, for a weekly or bi-weekly meetings. I'm a beginner and am looking for an ex

Re: Django, Postgres and recovering from database constraints

2011-02-01 Thread Casey S. Greene
Here is some code pulled from my (using postgres) django application that recovers fine. Perhaps this is helpful to you. I am storing the non-unique values and dealing with them later (pulling from an external source that is supposed to have unique IDs assigned but they don't always pan out s

Re: Django, Postgres and recovering from database constraints

2011-02-01 Thread Casey S. Greene
Also (sorry for the follow-up spam but I just remembered this) if you are hoping to use the database level autocommit (postgres 8.2 or later), you need to configure it: Autocommit mode New in Django 1.1: Please, see the release notes If your application is particularly read-heavy and doesn’t m

Re: Django, Postgres and recovering from database constraints

2011-02-01 Thread Xavier Ordoquy
thanks, I'll give it a try tomorrow and let you know. Xavier. Le 1 févr. 2011 à 19:57, Casey S. Greene a écrit : > Also (sorry for the follow-up spam but I just remembered this) if you are > hoping to use the database level autocommit (postgres 8.2 or later), you need > to configure it: > >

Re: Django SQL Query does not stop

2011-02-01 Thread Ivo Brodien
On 01.02.2011, at 16:55, Tom Evans wrote: > In the mysql shell: > > EXPLAIN SELECT ... unfortunately same problem. CPU turns to 100% and it is stuck. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django

Re: Django SQL Query does not stop

2011-02-01 Thread Ivo Brodien
The Change List that I am calling is a Intermediate Table if that is of any interest. Is it possible that there is some sort of circular inner joints or something? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send em

Add/Remove fields in ModelForm in Admin site

2011-02-01 Thread andmart
Hi all, I'm trying to remove or add fields based in presence of 'instance' parameter in ModelForm __init__ like this: class ItemForm(ModelForm): class Meta: model = Item def __init__(self, *args, **kwargs): if not kwargs.has_key('instance'):

DRY and static attribute for multiple classes.

2011-02-01 Thread Marc Aymerich
Hi all, I want to provide an encapsulated static attribute called _registry for several classes. I try to use inheritance in order to make it DRY: all classes inherit from a BaseClass that implements the _registry encapsulation. But with inheritance it doesn't work how I want, because a single ins

Re: Add/Remove fields in ModelForm in Admin site

2011-02-01 Thread andmart
There is an error in code above. I forgot to write to message the call to super. Here is the code I'm trying to work http://dpaste.com/375663/ Thanks in advance for any help On 1 fev, 17:48, andmart wrote: > Hi all, > > I'm trying to remove or add fields based in presence of 'instance' > par

Re: DRY and static attribute for multiple classes.

2011-02-01 Thread bruno desthuilliers
On 1 fév, 22:05, Marc Aymerich wrote: > Hi all, > I want to provide an encapsulated static attribute called _registry > for several classes. > > I try to use inheritance in order to make it DRY: all classes inherit > from a BaseClass that implements the _registry encapsulation. But with > inherita

Re: DRY and static attribute for multiple classes.

2011-02-01 Thread Adrian Bool
On 1 Feb 2011, at 21:05, Marc Aymerich wrote: > Hi all, > I want to provide an encapsulated static attribute called _registry > for several classes. > > I try to use inheritance in order to make it DRY: all classes inherit > from a BaseClass that implements the _registry encapsulation. But with

Re: DRY and static attribute for multiple classes.

2011-02-01 Thread Marc Aymerich
On Tue, Feb 1, 2011 at 10:22 PM, bruno desthuilliers wrote: > On 1 fév, 22:05, Marc Aymerich wrote: >> Hi all, >> I want to provide an encapsulated static attribute called _registry >> for several classes. >> >> I try to use inheritance in order to make it DRY: all classes inherit >> from a BaseC

Re: DRY and static attribute for multiple classes.

2011-02-01 Thread Marc Aymerich
On Tue, Feb 1, 2011 at 10:29 PM, Adrian Bool wrote: > > On 1 Feb 2011, at 21:05, Marc Aymerich wrote: > >> Hi all, >> I want to provide an encapsulated static attribute called _registry >> for several classes. >> >> I try to use inheritance in order to make it DRY: all classes inherit >> from a Ba

Re: Django SQL Query does not stop

2011-02-01 Thread Ivo Brodien
I found a solution be changing the MySQL server setting optimizer_search_depth to 3 (default 62) http://dev.mysql.com/doc/refman/5.0/en/controlling-optimizer.html http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_optimizer_search_depth My query had over 20 INNER JOINTS a

Re: cascading create

2011-02-01 Thread Phlip
Bump? String together the SQL myself? On Jan 31, 3:40 pm, Phlip wrote: > Djangoists: > > Given a model Tree with many Leaves, I want to write this: > >   t = Tree(data=42) >   t.leaves.add(leafy_data=43) >   t.leaves.add(leafy_data=44) >   t.save() > > I want the save() to create the Tree, then c

AttributeError 'module' object has no attribute '__path'

2011-02-01 Thread gintare
I searched all help, could not find a solution. Windows7 python and django runs from cmd 1) to run python c:\Python27\python 2)to run django and to create the project c:\Python27\python c:\Python27\Scripts\django-admin.py startproject Spokas THERE is an error while trying to create tables a

Re: using return upper

2011-02-01 Thread makayabou
Hello, I try to simplify the problem. This model gives me a (None) result: class OperatingSystem (models.Model): operatingsystem = CharField (max_length=30, blank=True, null=True) def __unicode__(self): return "%s" % (self.operatingsystem) class Ordi(models.Model):

Django model object allocation performance

2011-02-01 Thread oyiptong
Hello, I have been seeing a big performance degradation with my application in production. The traffic is roughly 2.5K pageviews per day. I can expect each page to load 100 model objects in memory. Some might overlap, but I have a large inventory of objects to show. I have noticed that pages hav

Re: using return upper

2011-02-01 Thread Rainy
On Feb 1, 6:12 pm, makayabou wrote: > Hello, > I try to simplify the problem. > > This model gives me a (None) result: > > class OperatingSystem (models.Model): >         operatingsystem = CharField (max_length=30, blank=True, null=True) >         def __unicode__(self): >                 return

Re: AttributeError 'module' object has no attribute '__path'

2011-02-01 Thread Karen Tracey
On Tue, Feb 1, 2011 at 6:03 PM, gintare wrote: > AttributeError 'module' object has no attribute '__path' What is in your INSTALLED_APPS setting? This cryptic message usually means there is something in INSTALLED_APPS that is not correct. (There's a ticket related to this message: http://code.d

RE: Django SQL Query does not stop

2011-02-01 Thread Chris Matthews
Hi Ivo, SQL is like regular expressions. You can go complex (with one mega query/expression) but it could create a maintenance nightmare. See if you cannot simplify the query into multiple queries and a bit of code (for loops and using the joining columns) to lash them together. The code sequen