Re: Multi-table Inheritance: How to add child to parent model?

2011-02-24 Thread Luc Saffre
I had now a similar problem and started to write a generic solution which is certainly not perfect, but works for me. Here is a detailed description: http://lino.saffre-rumma.net/autodoc/lino.test_apps.1.html Looking forward to any comments. Luc On 7.11.2010 17:19, ringemup wrote: > Thank you f

RE: Tracking Row changes

2011-02-24 Thread Chris Matthews
Hi Andre, Also have a look at: http://code.google.com/p/django-history-tables/ and http://qr7.com/2010/10/django-simple-history-ftw/ by Corey Bertram based on book ProJango by Marty Alchin Chapter 11 (page 263 onwards) Regards Chris From: django-users@googlegroups.com [mailto:django-users@google

Re: pgadmin vs schema migration

2011-02-24 Thread Rainy
On Feb 24, 9:54 am, ggavy wrote: > Thanks. It's good to get a little second opinion. I'm sure I'll make > the switch to migration tools eventually as things become a little > more involved. > > Cheers > gav I think the only possible danger is that you might forget to toggle an option like IS NU

Re: mod_wsgi or mod_fcgi

2011-02-24 Thread Eugene MechanisM
> I used this for several months, and encountered all kinds of horrible memory > allocation problems, crashes, etc etc. it's can be posiible with any server software if this server is bad configured. I'll never use apache or cherokee or lighttpd, coz nginx faster and better. -- You received this

Re: Queryset cloning is very expensive

2011-02-24 Thread Karen Tracey
On Thu, Feb 24, 2011 at 11:20 AM, myx wrote: > I found a solution which is suitable for me. > As it turns out, all those methods just clone queryset, and then call > appropriate methods of Query object. > So, for example, to set ordering and to get a slice without cloning > queryset, I can do the

Re: Tracking Row changes

2011-02-24 Thread Andre Terra
Thanks a lot! Will look into it first thing tomorrow. Meanwhile, if anyone has other suggestions, keep them coming, please. Thanks in advance! Sincerely, André On Thu, Feb 24, 2011 at 6:15 PM, elijah rutschman wrote: > On Thu, Feb 24, 2011 at 2:54 PM, Andre Terra wrote: > > Hello everyone, >

Re: mod_wsgi or mod_fcgi

2011-02-24 Thread Cal Leeming [Simplicity Media Ltd]
Yeah, don't use cherokee. I used this for several months, and encountered all kinds of horrible memory allocation problems, crashes, etc etc. On Thu, Feb 24, 2011 at 9:15 PM, Eugene MechanisM < eugene.mechan...@gmail.com> wrote: > You can check out this tutorial: > > http://www.jeremybowers.com/

Re: Tracking Row changes

2011-02-24 Thread elijah rutschman
On Thu, Feb 24, 2011 at 2:54 PM, Andre Terra wrote: > Hello everyone, > I'd like to log user changes to MyModel in an app I'm writing. What are some > third-party solutions that you recommend for this? django-activity-stream might meet your needs. https://github.com/justquick/django-activity-stre

Re: mod_wsgi or mod_fcgi

2011-02-24 Thread Eugene MechanisM
You can check out this tutorial: http://www.jeremybowers.com/blog/post/5/django-nginx-and-uwsgi-production-serving-millions-page-views/ I prefer to use also Varnish and Memcached with this stack. Nginx is best for static files. and will proxy non-static requests to uwsgi. nginx+uwsgi it's the best

Tracking Row changes

2011-02-24 Thread Andre Terra
Hello everyone, I'd like to log user changes to MyModel in an app I'm writing. What are some third-party solutions that you recommend for this? I'm not so interested in revision capabilities because I think that may increase the db tremendously in a very short time (I'm working with 2000+ new rows

Re: Collaborative text editor with Django

2011-02-24 Thread Piotr Zalewa
On 02/23/11 08:32, Anoop Thomas Mathew wrote: > Is there any collaborative text editing application available for django. > Has anybody tried with etherpad(www.etherpad.org > ) along with django? If you'd start building it - I'd be collaborating. zalun -- blog http://pi

Re: mod_wsgi or mod_fcgi

2011-02-24 Thread Eric Chamberlain
On Feb 23, 2011, at 11:10 PM, Shamail Tayyab wrote: > Hi, > > I am going to deploy a site today on an Amazon's large instance. > Our setup is like this: > > server 1: mongoDB + redis server > server 2: django + nodejs > > We are using node for server push things. Can you please suggest what

TypeError: unhashable type: 'ManyToManyField'

2011-02-24 Thread Julian Hodgson
I'm getting this error message when I try to validate even a brand new project and application. Does this ring any bells with anyone? Windows XP 64 I'm using Django 1.1.1 (but it still happens with 1.1.4) Python 2.6 (winxp 64) In my actual database I can only connect when I remove by ManyToMany

Re: Problem with unicode in form posts

2011-02-24 Thread Tom Evans
On Thu, Feb 24, 2011 at 5:17 PM, Lee Hinde wrote: > On Thu, Feb 24, 2011 at 1:32 AM, Tom Evans wrote: >> On Wed, Feb 23, 2011 at 9:17 PM, Lee Hinde wrote: >>> Except, now the data that's in the database for the username field >>> goes from looking like this: >>> leehinde >>> to this >>> (u'leehi

Re: Problem with unicode in form posts

2011-02-24 Thread Lee Hinde
On Thu, Feb 24, 2011 at 1:32 AM, Tom Evans wrote: > On Wed, Feb 23, 2011 at 9:17 PM, Lee Hinde wrote: >> Except, now the data that's in the database for the username field >> goes from looking like this: >> leehinde >> to this >> (u'leehinde',) >> >> I'd like it to be 'leehinde' again >> so, clea

Re: Python/Django AMQP?

2011-02-24 Thread Brian Bouterse
+1 for Celery and django-celery. I use them also. On Thu, Feb 24, 2011 at 9:07 AM, Shawn Milochik wrote: > +1 on Celery and django-celery. I use them both. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send em

Re: label_tag in queryset

2011-02-24 Thread Greg Corey
Ok. So it seems you can't access the field verbose_name without a little trickery. So here is how I did it. Model: def get_fields(self): return [(field.name, field.value_to_string(self)) for field in self._meta.fields] Template Filter: @register.filter def get_verbose_name(model, field):

Re: Queryset cloning is very expensive

2011-02-24 Thread myx
I found a solution which is suitable for me. As it turns out, all those methods just clone queryset, and then call appropriate methods of Query object. So, for example, to set ordering and to get a slice without cloning queryset, I can do the following: qs.query.add_ordering('-created') qs.query.s

Re: label_tag in queryset

2011-02-24 Thread Greg Corey
Pardon the continued confusion, but the problem is that I don't know how to access the model field to get it's associated label like I can when rendering a form. I don't want to manually type out each label text in my template because I like knowing that if I do need to change the label, I can chan

Re: WSGI eating search args?

2011-02-24 Thread Christoph Pingel
Thanks, I tracked it down. Nothing to do with WSGI, it's just that SQLite doesn't support REGEXP on the target platform. best regards, Christoph On Feb 24, 12:22 pm, Tom Evans wrote: > > You get a 500 if your view raises an exception. Since you aren't > showing the exception traceback, any adv

Re: mod_wsgi or mod_fcgi

2011-02-24 Thread Eugene MechanisM
I'll advice you to use nginx+uwsgi stack. -- 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 django-users+unsubscr...@googlegroups.co

date_hierarchy with datetime field stored in another model

2011-02-24 Thread Marc Aymerich
Hi, I want to provide an admin date_hierarchy filter for a model that actually doesn't have a datetime field itself. The datetime value for each object is stored in another model. It's possible to define a date_hierarchy filter in this scenario? I've tried to use date_hierarchy with a property tha

django-pluggables urlconf problem (NoReverseMatch TemplateSyntaxError)

2011-02-24 Thread Andre Terra
Hello, folks I'm trying to use django-pluggables ( https://github.com/nowells/django-pluggables) and I'm having a very hard time figuring out how to set it up. The documentation is slender and the example app has the same name as its one and only model, which is very different from my case. So fa

CSRF question

2011-02-24 Thread CristiM1
Hi, how can I make a RESTful interface working with CSRF if there are multiple servers involved. So we have a REST API that will be deployed on one server and multiple servers for retrieving the HTML (this HTML will use AJAX to call the REST) thanks, Cristian -- You received this message becaus

Re: pgadmin vs schema migration

2011-02-24 Thread ggavy
Thanks. It's good to get a little second opinion. I'm sure I'll make the switch to migration tools eventually as things become a little more involved. Cheers gav On Feb 24, 11:58 am, Mike Ramirez wrote: > On Thursday, February 24, 2011 03:48:18 am ggavy wrote: > > > Hello everyone, > >     if

Re: field choices() as queryset?

2011-02-24 Thread galago
I think it works. Thanks. What I did: changed the form cal in view: form_provinces_to_add = ProvinceForm(request.POST, user=request.user) changed a form a little: class ProvinceForm(ModelForm): def __init__(self, *args, **kwargs): self.user = kwargs.pop('user') super(ProvinceFo

Re: Admin-enabled glossary

2011-02-24 Thread urukay
Hi, maybe you can try to use autocomplete function with JQuery, but i don't fully understand what you mean. Radovan On 23. Feb, 20:02 h., yuri2k wrote: > Anyone? > > On 23 Fev, 10:14, yuri2k wrote: > > > I need to find a way to use a glossary (sort of > > likehttps://github.com/kcunning/djang

Re: field choices() as queryset?

2011-02-24 Thread Tom Evans
On Thu, Feb 24, 2011 at 2:17 PM, galago wrote: > Now I have some strange thing. I display my form, send post and try to save > it. But it doesn't save:/ > Here's my code: > model: > class UserProvince(models.Model): >     user = models.ForeignKey(User) >     province = models.ForeignKey(Province)

Re: field choices() as queryset?

2011-02-24 Thread galago
Now I have some strange thing. I display my form, send post and try to save it. But it doesn't save:/ Here's my code: model: class UserProvince(models.Model): user = models.ForeignKey(User) province = models.ForeignKey(Province) class Meta: unique_together = (('user', 'provinc

Re: Python/Django AMQP?

2011-02-24 Thread Shawn Milochik
+1 on Celery and django-celery. I use them both. -- 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 django-users+unsubscr...@googlegr

Re: mod_wsgi or mod_fcgi

2011-02-24 Thread Cal Leeming [Simplicity Media Ltd]
Personally, I *always* use WSGI with uWSGI by unbit. Always proven stable. On Thu, Feb 24, 2011 at 7:10 AM, Shamail Tayyab wrote: > Hi, > > I am going to deploy a site today on an Amazon's large instance. > Our setup is like this: > > server 1: mongoDB + redis server > server 2: django + nodej

Re: Python/Django AMQP?

2011-02-24 Thread Tom Evans
On Thu, Feb 24, 2011 at 1:29 PM, ju wrote: > I have a django web application which creates and saves jobs in a database. > For every job I have to send email and export data to another system. I want > to make it asynchronously. > > What is the recommended way to do it? > > It have to be reliable

Re: Django pagination is repeating results

2011-02-24 Thread diogobaeder
Nevermind, it is a SQL Server problem. (I hate SQL Server. There, I said it.) I had to first filter manually by the m2m objects, then apply the pagination to the results. Thanks! On Feb 18, 2:53 pm, David De La Harpe Golden wrote: > On 18/02/11 17:38,diogobaederwrote: > > > Hi, > > Any ideas of

Python/Django AMQP?

2011-02-24 Thread ju
I have a django web application which creates and saves jobs in a database. For every job I have to send email and export data to another system. I want to make it asynchronously. What is the recommended way to do it? - It have to be reliable (no jobs missed). - There have to be easy wa

Re: field choices() as queryset?

2011-02-24 Thread Mike Ramirez
On Thursday, February 24, 2011 05:15:09 am Tom Evans wrote: > Cargo cult programming is bad. > > Cheers > > Tom Not going to really argue the point, it's valid, but it could be based on habits taught by others, mentors... Mike -- Never, ever lie to someone you love unless you're absolutely

Re: field choices() as queryset?

2011-02-24 Thread Tom Evans
On Thu, Feb 24, 2011 at 1:07 PM, Mike Ramirez wrote: > On Thursday, February 24, 2011 05:00:23 am galago wrote: >> class ProvinceForm(ModelForm): > >> def __init__(self, *args, **kwargs): >> > > for self.instance, you'll wnat to do something like this: > > self.instance = kwargs.pop('instance') >

Re: unittest problems

2011-02-24 Thread refreegrata
I add this to my settings: --- TEMPLATE_CONTEXT_PROCESSORS = ( . 'django.contrib.messages.context_processors.messages', <- new line ) --

Re: unittest problems

2011-02-24 Thread Renne Rocha
You ran the tests and they are telling you what is wrong. Read the test result! You have the django.contrib.auth app installed in your project. But it seems that you haven't create the default templates needed for this app works. For these tests work, you need to define some templates (read

Re: Problems with permissions in the admin panel.

2011-02-24 Thread Adam Tonks
Assigning every permission in the list still gave the same 'You don't have permission' message. I think it's all sorted now though - I had a custom authentication backend to allow case insensitive login (http://djangosnippets.org/ snippets/1368/), and I assumed it would just override the two funct

Re: field choices() as queryset?

2011-02-24 Thread Mike Ramirez
On Thursday, February 24, 2011 05:00:23 am galago wrote: > I made it that way but i get empty select list > > class ProvinceForm(ModelForm): > def __init__(self, *args, **kwargs): > super(ProvinceForm, self).__init__(*args, **kwargs) > user_provinces = > UserProvince.objects.se

Re: field choices() as queryset?

2011-02-24 Thread galago
hmm, that solutoin works great:) class ProvinceForm(ModelForm): def __init__(self, *args, **kwargs): super(ProvinceForm, self).__init__(*args, **kwargs) user_provinces = UserProvince.objects.select_related().filter(user__exact=self.instance.id).values_list('province') s

Re: field choices() as queryset?

2011-02-24 Thread galago
I made it that way but i get empty select list class ProvinceForm(ModelForm): def __init__(self, *args, **kwargs): super(ProvinceForm, self).__init__(*args, **kwargs) user_provinces = UserProvince.objects.select_related().filter(user__exact=self.instance.id).values_list('provi

Re: field choices() as queryset?

2011-02-24 Thread Mike Ramirez
On Thursday, February 24, 2011 04:21:46 am galago wrote: > Thanks, that's the way I'll do it:) > But now I have 1 more problem. In ModelForm I want to get some data about > user from DB. I nedd to filter user provinces. How canI call the user id > in my query? I pass request.user as form instance

RE: field choices() as queryset?

2011-02-24 Thread Chris Matthews
Typo choices.append((item.name, item.name)) should be choices.append((item.id, item.name)) From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Mike Ramirez Sent: 24 February 2011 14:10 To: django-users@googlegroups.com Subject: Re: field choices() as queryset?

Re: field choices() as queryset?

2011-02-24 Thread galago
Thanks, that's the way I'll do it:) But now I have 1 more problem. In ModelForm I want to get some data about user from DB. I nedd to filter user provinces. How canI call the user id in my query? I pass request.user as form instance in view: form = ProvinceForm(instance=request.user) How to rea

Re: Problem with unicode in form posts

2011-02-24 Thread Lachlan Musicman
On Thu, Feb 24, 2011 at 20:41, Mike Ramirez wrote: > On Thursday, February 24, 2011 01:32:11 am Tom Evans wrote: > But that doesn't explain the tuple form, (u'', ) of the return value. That's how unicode strings are marked in django cheers L. -- Crunchiness is the gustatory sensation of muffle

Re: field choices() as queryset?

2011-02-24 Thread Mike Ramirez
On Thursday, February 24, 2011 03:53:03 am galago wrote: > I need to make a form, which have 1 select and 1 text input. Select must be > taken from database. > model looks like this: > class Province(models.Model): > name = models.CharField(max_length=30) > slug = models.SlugField(max_lengt

Re: pgadmin vs schema migration

2011-02-24 Thread Mike Ramirez
On Thursday, February 24, 2011 03:48:18 am ggavy wrote: > Hello everyone, > if I have a live app running off a postgres db (containing data) > and I want to make reasonably simple schema (and possibly data > content) changes, are there any dangers in just using pgadmin (e.g > adding a column) a

Re: pgadmin vs schema migration

2011-02-24 Thread Kenneth Gonsalves
On Thu, 2011-02-24 at 03:48 -0800, ggavy wrote: > I'd keep my models.py up-to-date with any changes I make > to the database (in case of future uses of the app). I haven't seen > anything online warning me not to do it, but the separation worries me > slightly well, that is the way django does it

pgadmin vs schema migration

2011-02-24 Thread ggavy
Hello everyone, if I have a live app running off a postgres db (containing data) and I want to make reasonably simple schema (and possibly data content) changes, are there any dangers in just using pgadmin (e.g adding a column) as opposed to using some type of migration software, e.g. south. I

field choices() as queryset?

2011-02-24 Thread galago
I need to make a form, which have 1 select and 1 text input. Select must be taken from database. model looks like this: class Province(models.Model): name = models.CharField(max_length=30) slug = models.SlugField(max_length=30) def __unicode__(self): return self.name It's row

Re: WSGI eating search args?

2011-02-24 Thread Tom Evans
On Thu, Feb 24, 2011 at 11:13 AM, Christoph Pingel wrote: > My app runs with mod_wsgi behind Apache. > > A local configuration of the app runs without problems, but behind > Apache every call involving GET args results in a HTTP 500 error. > > The url config is > (r'^sem/search/$', 'paragon.sem.vi

WSGI eating search args?

2011-02-24 Thread Christoph Pingel
My app runs with mod_wsgi behind Apache. A local configuration of the app runs without problems, but behind Apache every call involving GET args results in a HTTP 500 error. The url config is (r'^sem/search/$', 'paragon.sem.views.search'), and in my view, I get the search param with query = requ

Re: CSRF verification failed. Request aborted.

2011-02-24 Thread Tom Evans
On Thu, Feb 24, 2011 at 10:00 AM, Ankit Rai wrote: > There is the problem "django1.2.5"  has some more security updates beacuse > of which your old code may break . Citation? > > Your code will start working after you add @csrf_exempt in all your views > .And cross check your settings.py middlew

Re: CSRF verification failed. Request aborted.

2011-02-24 Thread Kenneth Gonsalves
On Thu, 2011-02-24 at 15:30 +0530, Ankit Rai wrote: > Your code will start working after you add @csrf_exempt in all your > views why should he exempt all his views from csrf checking? -- regards KG http://lawgon.livejournal.com Coimbatore LUG rox http://ilugcbe.techstud.org/ -- You received th

Re: CSRF verification failed. Request aborted.

2011-02-24 Thread Ankit Rai
There is the problem "django1.2.5" has some more security updates beacuse of which your old code may break . Your code will start working after you add @csrf_exempt in all your views .And cross check your settings.py middleware classes ('django.middleware.common.CommonMiddleware', 'django.contr

Re: Problems with serving static files

2011-02-24 Thread Tom Evans
On Thu, Feb 24, 2011 at 1:39 AM, Roy Smith wrote: > I'm running r15624, OSX-10.6.5, Python-2.6.1 > > In my top-level urls.py, I have: > >    # Serve static > files >    (r'^static/(?P.*)$', >     'django.views.static.serve', >     {'document_root': '/Users/roy/dev/try.django/mysite/static', >    

Re: CSRF verification failed. Request aborted.

2011-02-24 Thread Kenneth Gonsalves
On Thu, 2011-02-24 at 01:55 -0800, luca72 wrote: > (1, 2, 5, 'final', 0) and one more thing - how are you deploying? -- regards KG http://lawgon.livejournal.com Coimbatore LUG rox http://ilugcbe.techstud.org/ -- You received this message because you are subscribed to the Google Groups "Django

Re: CSRF verification failed. Request aborted.

2011-02-24 Thread luca72
(1, 2, 5, 'final', 0) Thanks Luca On 24 Feb, 10:50, Ankit Rai wrote: > after removing add @csrf_exempt, it will work retsart the server. > > Which version of django are you using > to know version > type follwoing cmd > python > import django > django.VERSION > > On Thu, Feb 24, 2011 at 3:18 PM

Re: CSRF verification failed. Request aborted.

2011-02-24 Thread Ankit Rai
after removing add @csrf_exempt, it will work retsart the server. Which version of django are you using to know version type follwoing cmd python import django django.VERSION On Thu, Feb 24, 2011 at 3:18 PM, luca72 wrote: > removing @crsf_protect i get the same error > > On 24 Feb, 10:34, Kenn

Re: CSRF verification failed. Request aborted.

2011-02-24 Thread luca72
removing @crsf_protect i get the same error On 24 Feb, 10:34, Kenneth Gonsalves wrote: > On Thu, 2011-02-24 at 01:20 -0800, luca72 wrote: > > @csrf_protect > > try removing this > -- > regards > KGhttp://lawgon.livejournal.com > Coimbatore LUG roxhttp://ilugcbe.techstud.org/ -- You received thi

Re: Problem with unicode in form posts

2011-02-24 Thread Mike Ramirez
On Thursday, February 24, 2011 01:32:11 am Tom Evans wrote: > On Wed, Feb 23, 2011 at 9:17 PM, Lee Hinde wrote: > > Except, now the data that's in the database for the username field > > goes from looking like this: > > leehinde > > to this > > (u'leehinde',) > > > > I'd like it to be 'leehinde'

Re: CSRF verification failed. Request aborted.

2011-02-24 Thread Kenneth Gonsalves
On Thu, 2011-02-24 at 01:20 -0800, luca72 wrote: > @csrf_protect try removing this -- regards KG http://lawgon.livejournal.com Coimbatore LUG rox http://ilugcbe.techstud.org/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this grou

Re: Problem with unicode in form posts

2011-02-24 Thread Tom Evans
On Wed, Feb 23, 2011 at 9:17 PM, Lee Hinde wrote: > Except, now the data that's in the database for the username field > goes from looking like this: > leehinde > to this > (u'leehinde',) > > I'd like it to be 'leehinde' again > so, clearly objects.create is more clever than my pure post. But I'm

Re: CSRF verification failed. Request aborted.

2011-02-24 Thread Kenneth Gonsalves
On Thu, 2011-02-24 at 00:54 -0800, luca72 wrote: > I get CSRF verification failed. Request aborted. after the submit you have to use RequestContext if you are using csrf - also make sure csrf middleware is loaded. -- regards KG http://lawgon.livejournal.com Coimbatore LUG rox http://ilugcbe.techs

mod_wsgi or mod_fcgi

2011-02-24 Thread Shamail Tayyab
Hi, I am going to deploy a site today on an Amazon's large instance. Our setup is like this: server 1: mongoDB + redis server server 2: django + nodejs We are using node for server push things. Can you please suggest what would be the best way to deploy django as? (via wsgi or fcgi). We've pl