Re: Prefetch object (django 1.7)

2014-01-30 Thread Marcin Szamotulski
('postauthor__created')) Post.objects.prefetch_related(p).all() I think it would be nice to add such examples to the docs. If that's the case I can write a paragraph with an example like the one I am using, i.e. with a custom through model. Best regards, Marcin Szamotulski On 30 January 2014 05:23

Re: Prefetch object (django 1.7)

2014-01-29 Thread Marcin Szamotulski
On 01:42 Mon 27 Jan , Marcin Szamotulski wrote: > Hello, > > I have a model > > class Post(models.Model): > > ... > authors = models.ManyToManyField('accounts.User', through='PostAuthor', > related_name='authors_posts') > > > class Pos

Prefetch object (django 1.7)

2014-01-26 Thread Marcin Szamotulski
'authors_posts' into field. Choices are: created, id, post, post_id, user, user_id Thanks for help, Marcin Szamotulski -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, sen

Re: Textarea and initial value

2013-09-30 Thread Marcin Szamotulski
Thanks, I thought I checked this. Marcin On 30 September 2013 18:22, Daniel Roseman wrote: > On Monday, 30 September 2013 18:18:00 UTC+1, Zoltan Szalai wrote: > >> try not to use the same value ('about') for the name attribute of the >> textarea and your submit button.

Re: Textarea and initial value

2013-09-30 Thread Marcin Szamotulski
ps. If I render the form with {{ form.as_ul() }} I get the same behaviour. Marcin On 30 September 2013 17:11, Marcin Szamotulski <msza...@gmail.com> wrote: > Sure here it is how the form is render: > > > value='' /> >

Re: Textarea and initial value

2013-09-30 Thread Marcin Szamotulski
September 2013 15:41:47 UTC+1, Marcin Szamotulski wrote: > >> >> I don't do anything odd: I simply modify it by typing in side textarea. >> The page has a very simple JavaScript which does not do anything with >> the textarea (though I double-checked that turning it o

Re: Textarea and initial value

2013-09-30 Thread Marcin Szamotulski
On 06:38 Mon 30 Sep , Daniel Roseman wrote: > On Sunday, 29 September 2013 22:58:38 UTC+1, Marcin Szamotulski wrote: > > > Dear Django users, > > > > The short question is: How to use Textarea widget with initial value? > > The long version: I have a form

Textarea and initial value

2013-09-29 Thread Marcin Szamotulski
Dear Django users, The short question is: How to use Textarea widget with initial value? The long version: I have a form with a simple Textarea widget class Form(forms.Form): f = forms.CharField(widget=forms.Textarea()) in a view I set an initial value: form = Form(initial={'f': 'initial

Re: Paginattion: How do I pass current page number around views, forms and templates?

2013-09-17 Thread Marcin Szamotulski
You can also pass it around as a GET argument. Best regards, Marcin On 02:10 Mon 16 Sep , DJ-Tom wrote: > > I think I could use the views name as the key to the current page - that > way the system "remembers" the page number for each view. > > Am Dienstag, 10. September 2013 18:59:19

Re: bad request 400

2013-09-09 Thread Marcin Szamotulski
The problem has solved somehow (reboot). Marcin On 19:08 Sun 08 Sep , Germán wrote: > If you don't post your code it's quite difficult to help yo > On Sunday, September 8, 2013 3:34:33 PM UTC-5, Marcin Szamotulski wrote: > > > > Hello, > > > > I start wo

bad request 400

2013-09-08 Thread Marcin Szamotulski
Hello, I start working on a new app. I started in the usual way (with django-admin.py startproject, configured the settings (nothing special though) and when I try to use my first view function I always get: [08/Sep/2013 21:32:31] "GET / HTTP/1.1" 400 26 (BAD REQUEST) I reviewed my settings

Re: db queries made twice

2013-08-31 Thread Marcin Szamotulski
evaluating template context. > > > > > > Cheers, > >Tom > > > > Dne Sat, 31 Aug 2013 12:09:00 +0100 > > Marcin Szamotulski napsal(a): > > > > > Hello, > > > > > > I am using django-1.6.b2 on a localserver (./manage.py ru

db queries made twice

2013-08-31 Thread Marcin Szamotulski
Hello, I am using django-1.6.b2 on a localserver (./manage.py runserver) and for every request I have the chain of db lookups made twice. For example my log looks something like this (after enabling django.db.backands logger): # HERE VIEW IS CALLED (0.001) SELECT "django_session"."session_key",

Re: Django ORM: default value from sql query

2013-08-21 Thread Marcin Szamotulski
t; > [1] > https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.Field.default > Le mercredi 21 août 2013 18:49:48 UTC-4, Marcin Szamotulski a écrit : > > > > Dear Django users, > > > > I am would like to set a default value on a model's f

Django ORM: default value from sql query

2013-08-21 Thread Marcin Szamotulski
Dear Django users, I am would like to set a default value on a model's field as a result of a simple query. Something that in SQLAlchemy is done like that: http://docs.sqlalchemy.org/en/rel_0_7/core/schema.html#sql-expressions Specifically I want to count some objects in the database and

Re: jquery in django

2013-07-01 Thread Marcin Szamotulski
On 13:20 Mon 01 Jul , Christian Erhardt wrote: > Hey Harjot, > > i can't provide an easy answer to your question. An Ajax enabled search with > django is nothing, that one programs in 30 minutes especially not if he has > no understanding of query and or ajax. > > I'll try to give you some

Re: Missing peice before best practises

2013-06-26 Thread Marcin Szamotulski
On 06:19 Wed 26 Jun , Sayth Renshaw wrote: > Any thoughts? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to

Re: Registration error

2013-06-24 Thread Marcin Szamotulski
On 16:12 Mon 24 Jun , Deepak Sharma wrote: > On Mon, Jun 24, 2013 at 3:58 PM, Tom Evans wrote: > > > > Looks like you've updated your {% url %} tags to quote the view name, > > and in this case, you've quoted both the view name and the argument > > that should be

Re: Sharing session among multiple domains (generic web development question)

2013-06-11 Thread Marcin Szamotulski
Hi, If you use db backend for sessions you could save the session in both databases. Check this: http://dustinfarris.com/2012/2/sharing-django-users-and-sessions-across-projects/ I hope this helps. Best regards, Marcin On 14:22 Tue 11 Jun , Tomas Ehrlich wrote: > Hi Avraham, > I know that

Re: dictionary update sequence

2013-06-10 Thread Marcin Szamotulski
Hi, This error message one gets in the following way: >>> dict('a') ValueError: dictionary update sequence element #0 has length 1; 2 is required I suspect that the second argument of your url is a keyword argument rather than a positional one. In this case you should write: {%

Re: Suggestions on caching queries for a single request on a subset of Views?

2013-06-10 Thread Marcin Szamotulski
Hi, I am not en expert but since I had a similar problem I found a solution. I just attached data I wanted to persist to the request. You can put the common code in a middleware to be computed early and then use it in your views. You can also add it to the session data (i.e. request.session)

Re: Some problems with Paginator

2013-06-07 Thread Marcin Szamotulski
We all make mistakes, don't worry :) Best regards, Marcin On 00:02 Fri 07 Jun , Federico Erbea wrote: > I'm really stupid, why i never think to the easiest way, never...I wrong > "{% for film in attore.film_set.all %}" because i had write "{% for film in > film_attore %}"...Sorry...;) > >

Re: sphinx migration: addint m2m field

2013-06-04 Thread Marcin Szamotulski
The problem has resolved without my intervention :). Regards, Marcin On 22:29 Mon 03 Jun , Marcin Szamotulski wrote: > Hello, > > I need to add a m2m field to a model. So I did added it and then > I wanted to use south to migrate the app. Since this app was already > us

sphinx migration: addint m2m field

2013-06-03 Thread Marcin Szamotulski
g inside db (with psql since I use postgres) the table is not there. How can I debug this? I did not have any problems with making migrations with this app before. Best regards, Marcin Szamotulski -- You received this message because you are subscribed to the Google Groups "Django users" gro

Re: django , python and ides

2013-06-03 Thread Marcin Szamotulski
checkout something in django internals or one of your apps. Best regards, Marcin Szamotulski On 08:23 Mon 03 Jun , Sergiy Khohlov wrote: > emacs + few plugin. For me it is a better choise > > Many thanks, > > Serge > > > > On Sun, Jun 2, 2013 at 12:01 AM, Doug Sn

Re: middleware question

2013-05-25 Thread Marcin Szamotulski
I did some test myself and the best thing what I can do is to attach data to the request since its live cycle is what I actually need. Best regards, Marcin On 14:20 Sat 25 May , Marcin Szamotulski wrote: > Dear Django Gurus, > > I have a simple question about middleware

middleware question

2013-05-25 Thread Marcin Szamotulski
regards, Marcin Szamotulski -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email