Re: Address book using django

2015-05-22 Thread Gergely Polonkai
You say that your backend is ready. Does this mean you have created your
models and can access them from the shell (pythen manage.py shell, see the
first chapter of the tutorial, section Playing with the API)?

If so, what parts of the frontend creation you don't understand? Is it view
creation or templates, or maybe something else?
On 23 May 2015 08:09, "Preeti"  wrote:

> Hi James,
>
> I started learning Django this week.
> My code isn't on Github.
>
>  I learnt building the app, and the backend work but I'm not able to
> understand how to connect front-end with the framework.
>
> I have enclosed a copy of what I want in my app. Please go through it, and
> guide.
>
> Thanks
>
> On Friday, May 22, 2015 at 9:51:05 PM UTC+5:30, James Brewer wrote:
>>
>> Hey Preeti,
>>
>> Glad you're getting into Django! It's a fantastic framework. (I'm kind of
>> biased.)
>>
>> With that said, we need more information to know how to help you. What
>> have you tried? Is your code available on Github? The "Where do I start?"
>> question is too broad for anyone to give an answer more effective than
>> "read the docs".
>>
>> Happy Friday!
>>
>> James
>>
>>  --
> 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 to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0f1d0d85-2aa7-4790-b721-5a217cfae32c%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBU%2BjskmoLbkC9UKAa4CzH25%2BSiwzBYt_VGStLTNu2YTCEA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Address book using django

2015-05-22 Thread Preeti
Hi James,

I started learning Django this week. 
My code isn't on Github.

 I learnt building the app, and the backend work but I'm not able to 
understand how to connect front-end with the framework.

I have enclosed a copy of what I want in my app. Please go through it, and 
guide.

Thanks

On Friday, May 22, 2015 at 9:51:05 PM UTC+5:30, James Brewer wrote:
>
> Hey Preeti,
>
> Glad you're getting into Django! It's a fantastic framework. (I'm kind of 
> biased.)
>
> With that said, we need more information to know how to help you. What 
> have you tried? Is your code available on Github? The "Where do I start?" 
> question is too broad for anyone to give an answer more effective than 
> "read the docs".
>
> Happy Friday!
>
> James
>
>

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0f1d0d85-2aa7-4790-b721-5a217cfae32c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to do a django data migration on a massive Postgres data table (solved)

2015-05-22 Thread Larry Martell
On Fri, May 22, 2015 at 3:09 PM, Vernon D. Cole  wrote:
> Django migrations are run in a single transaction (if your database is
> capable of doing a rollback of DDL, as PostgreSQL is) so data migrations of
> large tables become impossible.
>
> I was able to solve this problem by having the migration run a no-wait
> subprocess which performs the data migration using raw SQL without the
> django ORM.  In order to keep things together, the subprocess is contained
> in the same source file as the migration... when run as a module it runs
> itself as a main program.  In my case, it ran for about two days, converting
> my 10 million row table 1000 rows at a time. [Actually, I had to restart it
> three times by pretending to remove it and then re-applying it.]
>
> In case I need to do it some other time, I am putting the code into a GIST.
> I am posting here so that others may find it when searching for the right
> keywords...
> https://gist.github.com/9adedbab1899224a4eaf.git

Thanks very much Vern for doing this. I'm sure it will be very useful
to a lot of people.

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACwCsY53TK56_4nZb105qdC7QNnMOW44K2x2nBf6rCSom53G_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Non-profit membership management suggestions

2015-05-22 Thread Teruo Utsumi
Thanks for the advice.  I'm so new and there's SOOO much out there.  I'm 
thinking your buffet-style approach of picking and choosing different 
Django apps is probably the best way to go.

Think what I'll do is do a bit more research, come up w/ a set of apps and 
ask the group for comments.

On Friday, May 22, 2015 at 12:02:03 PM UTC-7, James Brewer wrote:
>
> Perhaps the problem is that you are looking for a single solution that 
> meets all of your needs. This is not a very useful approach. It's called 
> custom software and it's very expensive. :) Have you thought of finding 
> different packages that each meet an individual need? For example, the 
> python-social-auth and django-allauth packages can handle authentication 
> for you.
>

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a4385324-05f4-4003-8236-1f542f81efbb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: "&" string to template adds "&" in the html

2015-05-22 Thread Javier Guerra Giraldez
On Fri, May 22, 2015 at 1:11 PM, dk  wrote:
> I fixed doing this
>
> {% autoescape off %}
>  {{ my_var_with_& }}
> {% endautoescape%}


the "right" way is:

{{ my_var_with_anything|safe }}

-- 
Javier

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFkDaoQGBKY2YWarBgL9qg2BkHkZ%2BYybw74rJE0eaessr%3DEGkg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


how to do a django data migration on a massive Postgres data table (solved)

2015-05-22 Thread Vernon D. Cole
Django migrations are run in a single transaction (if your database is 
capable of doing a rollback of DDL, as PostgreSQL is) so data migrations of 
large tables become impossible.

I was able to solve this problem by having the migration run a no-wait 
subprocess which performs the data migration using raw SQL without the 
django ORM.  In order to keep things together, the subprocess is contained 
in the same source file as the migration... when run as a module it runs 
itself as a main program.  In my case, it ran for about two days, 
converting my 10 million row table 1000 rows at a time. [Actually, I had to 
restart it three times by pretending to remove it and then re-applying it.]

In case I need to do it some other time, I am putting the code into a 
GIST.  I am posting here so that others may find it when searching for the 
right keywords...
https://gist.github.com/9adedbab1899224a4eaf.git

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/86fda457-03a2-4ef7-9d3f-e540fa0e8c1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Non-profit membership management suggestions

2015-05-22 Thread James Brewer
Perhaps the problem is that you are looking for a single solution that
meets all of your needs. This is not a very useful approach. It's called
custom software and it's very expensive. :) Have you thought of finding
different packages that each meet an individual need? For example, the
python-social-auth and django-allauth packages can handle authentication
for you.

On Fri, May 22, 2015 at 9:53 AM, Teruo Utsumi  wrote:

> Hi James,
>
> I previously did come across that website.  But I've tried searches for
> "membership", "association", "club", and a few others, all to no avail.
>
> Similar searches on GitHub result in hits, but for packages unrelated to
> what I'm looking for.  Or maybe I'm not digging deep enough.
>
> Membership management for a small organization is such a common thing that
> I'd thought it'd be easy to find, but it's turned out to be a rather tough
> task.
>
> On Friday, May 22, 2015 at 9:21:05 AM UTC-7, James Brewer wrote:
>>
>> Hey Teruo,
>>
>> I <3 astronomy :) Check out this nifty tool I found the other day:
>> https://www.djangopackages.com/
>>
>  --
> 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 to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d65679c4-89b6-4bab-8c8b-78d5105ba5f8%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFryp_iSj9JteG7PM_H9w%2Bp3pXESDs%2B3d%2BgPyn9L4br1iSeqrQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: httml form to django

2015-05-22 Thread dk
thanks for the help, 
at the end I did it with 
putting it on the url as a url variable ?var=my_var
and in the view 
request.POST.get("username").

thanks for the tips,  super helpful.


On Thursday, May 21, 2015 at 10:29:24 PM UTC-5, luisza14 wrote:

> You don't need to alter any model, only need to create a form class 
> (better) or using request.POST.get("username").
>
> If you want to do in right way 
> See 
> https://docs.djangoproject.com/en/1.8/topics/forms/
>
>
> El jueves, 21 de mayo de 2015, dk > 
> escribió:
> > I am not going to update any models for the database or anything I just 
> need some info from the user that will be process by the view.
> > I could put that info in the url as a variable such /?=variable.
> > and then get it with
> > info = request.GET.get("info", "") 
> > but its little ugly since you display it on the url.
> >
> > On Wednesday, May 20, 2015 at 9:07:11 PM UTC-5, luisza14 wrote:
> >>
> >> And you need to put inside the form the csrf token .
> >>
> >> {% csrf_token %} ...
> >>
> >> See: https://docs.djangoproject.com/en/1.8/ref/csrf/
> >>
> >>
> >> 2015-05-20 16:40 GMT-06:00 술욱 :
> >>>
> >>> Hi,
> >>>
> >>> just make sure you match your input names with what Django expects. 
> For example:
> >>>
> >>> If the HTML is  your Form will need a 
> "username" field.
> >>>
> >>> HTH,
> >>> Norberto
> >>>
> >>> 2015-05-20 18:24 GMT-03:00 dk :
> >>> > i have a regular form in the template.   the user and the password 
> since the
> >>> > web designer did it like that.
> >>> > can I still use it in django view?
> >>> >
> >>> > any particular way that's need to be use?  or we need to change it 
> to use
> >>> > django forms?
> >>> >
> >>> > =)
> >>> >
> >>> > --
> >>> > 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...@googlegroups.com.
> >>> > To post to this group, send email to django...@googlegroups.com.
> >>> > Visit this group at http://groups.google.com/group/django-users.
> >>> > To view this discussion on the web visit
> >>> > 
> https://groups.google.com/d/msgid/django-users/8070bda1-e549-4a3a-89ee-7c1e1df9ff2c%40googlegroups.com
> .
> >>> > For more options, visit https://groups.google.com/d/optout.
> >>>
> >>> --
> >>> 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...@googlegroups.com.
> >>> To post to this group, send email to django...@googlegroups.com.
> >>> Visit this group at http://groups.google.com/group/django-users.
> >>> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CADut3oAaXtGjzK9repN_waOzn0SsuWkT3Mp5DYhzMWTzosUk3g%40mail.gmail.com
> .
> >>> For more options, visit https://groups.google.com/d/optout.
> >>
> >>
> >>
> >> --
> >> "La utopía sirve para caminar" Fernando Birri
> >>
> >>
> > --
> > 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...@googlegroups.com .
> > To post to this group, send email to django...@googlegroups.com 
> .
> > Visit this group at http://groups.google.com/group/django-users.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/cbe6f8ba-c31e-4fe7-93b2-309178a038b8%40googlegroups.com
> .
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> -- 
> "La utopía sirve para caminar" Fernando Birri
>
>
>
>

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/961200a3-fd64-4b24-b1cd-b8d515949981%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: change the style of the forms been render in the httml?

2015-05-22 Thread dk

yea doing it like its easier =)
mucho mas facil.

On Thursday, May 21, 2015 at 10:15:48 PM UTC-5, luisza14 wrote:

> It is easy, you only need to put id attribute to form statement like this 
>
>  {{form.as_p}}
>
> In CSS use cascade starting by #myform.
>
> Other thing I was used form.as_p for printing as , but you could used 
> form.as_ul or form.as_table too.  By default as_table is set when you do 
> {{form}}
>
>
>
> El jueves, 21 de mayo de 2015, dk > 
> escribió:
> > Thanks Galia, since I only have 2 fields, I think the second options 
> will be the faster,   do you have an example? no how to override the id? or 
> the class?
> > in the template I am doing  {{ form }}   I even try to do something 
> like   {{ form }}
> > but that doesn't change it =(  thanks.
> > On Thursday, May 21, 2015 at 2:42:12 AM UTC-5, Galia Ladiray wrote:
> >>
> >> What you want to do is to add a class attribute to your django widget 
> using attrs so that they will be rendered with this class, then to add the 
> style you want to this class in your CSS section,
> >> This doc shows how to do it:
> >> https://docs.djangoproject.com/en/1.8/ref/forms/widgets/
> >> You can of course override the style as well, for example using the 
> rendered id of your field, but it is less cleaner, since you will need to 
> repeat this for every field
> >>
> >> On Thursday, May 21, 2015 at 1:00:50 AM UTC+2, dk wrote:
> >>>
> >>> I did a form class and renders fine in the html.
> >>> but look ugly, I do have another field directly done directly in the 
> HTML with a style like this and look pretty how can I put it to the form?
> >>> can I override the "style"? or can I change the class? so I can change 
> the look?   thanks guys.
> >>> .text_line {
> >>>  -moz-box-shadow:inset 0px 1px 0px 0px #ff;
> >>>  -webkit-box-shadow:inset 0px 1px 0px 0px #ff;
> >>>  box-shadow:inset 0px 1px 0px 0px #ff;
> >>>  background-color:#ededed;
> >>>  -moz-border-radius:6px;
> >>>  -webkit-border-radius:6px;
> >>>  border-radius:6px;
> >>>  border:1px solid #dcdcdc;
> >>>  display:inline-block;
> >>>  cursor:pointer;
> >>>  color:#77;
> >>>  font-family:arial;
> >>>  font-size:20px;
> >>>  font-weight:bold;
> >>>  padding:6px 24px;
> >>>  text-decoration:none;
> >>>  text-shadow:0px 1px 0px #ff;
> >>> }
> >
> > --
> > 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...@googlegroups.com .
> > To post to this group, send email to django...@googlegroups.com 
> .
> > Visit this group at http://groups.google.com/group/django-users.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/2824dccf-ac12-4183-8ced-f4ec1917e49a%40googlegroups.com
> .
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> -- 
> "La utopía sirve para caminar" Fernando Birri
>
>
>
>

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e2dcee42-4aa6-48be-9258-daab121abf55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: "&" string to template adds "&" in the html

2015-05-22 Thread dk
I fixed doing this

{% autoescape off %}
 {{ my_var_with_& }}
{% endautoescape%}

now works fine.
On Thursday, May 21, 2015 at 11:53:07 AM UTC-5, Andréas Kühne wrote:

>
> 2015-05-21 18:35 GMT+02:00 dk >:
>
>> I am creating a string inside the view that will be use in the template 
>> on the javascript.
>> my string in python contains &   and I print the view and works fine,  
>> but when is send to the template I don get &.
>>
>> is there something magical about &   ?  or any hint on how to make it 
>> work?  thanks guys.
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/a432f1b0-5042-4b4a-a7ff-57e92ce539be%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> Yes & is & when it is HTML encoded. You will get the same problem if 
> you try to send "Bold text" to a template, it will become the HTML 
> equivalent. All strings sent from your view function / class to the 
> template will be HTML encoded UNLESS you use safestring strings: 
> https://docs.djangoproject.com/en/1.8/ref/utils/#module-django.utils.safestring
>
> Regards,
>
> Andréas
>
>

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6ee49346-f842-4880-a118-72bf8de2608d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: utf-16le encode generic view object_list

2015-05-22 Thread JHeasly
@Tim: render_to_string! Forgot about that, somehow. That could clean it up 
a bit. Thanks!

@Stephen: Thanks for the feedback. This app's running internally and is on 
insecure and ancient 1.4, but the mimetype parameter reminder is a good 
one! Thank you.

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ff1a98cf-8cdc-475d-aeb4-516564d741f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to get a application-formpost in django view? Get QueryDict variables.

2015-05-22 Thread Gergely Polonkai
Actually, it is Django that handles it right. Where there are colons (,),
there should be equation signs. This is not really HTTP compliant, so I'm
afraid you must process the incoming data (i.e. request.body) yourself.
On 22 May 2015 15:46, "Fellipe Henrique"  wrote:

> Here is the request.body:
>
> b"'data[id]', ['83A0C50B5A0A43AD8F60C1066B16A163']&'data[status]',
> ['paid']&'event',['invoice.status_changed']"
>
> I think, maybe, something is wrong in Django, because these same POST is
> easy to get using PHP or Rails.. in PHP I get with these:
>  $_POST['data']['id']
>
> Maybe, something in django isn't implemented yet for these kind POST.
>
> T.·.F.·.A.·. S+F
> *Fellipe Henrique P. Soares*
>
> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
> 's/(.)/chr(ord($1)-2*3)/ge'
> *Blog: http://fhbash.wordpress.com/ *
> *GitHub: https://github.com/fellipeh *
> *Twitter: @fh_bash*
>
> On Fri, May 22, 2015 at 2:53 AM, Gergely Polonkai 
> wrote:
>
>> I don't think so, maybe the post request is poorly formatted. Can you
>> somehow catch the raw http request for analyzing?
>> On 22 May 2015 00:14, "Vijay Khemlani"  wrote:
>>
>>> Maybe the brackets confuse the querydict, try calling its items method
>>> (to convert it into a list of tuples) or its dict method (to turn it into a
>>> normal python dict)
>>>
>>> On Thu, May 21, 2015 at 3:34 PM, Fellipe Henrique 
>>> wrote:
>>>
 Any ideas?

 I finish all my possibilities in these problem.. :( and no solution...

 T.·.F.·.A.·. S+F
 *Fellipe Henrique P. Soares*

 e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
 's/(.)/chr(ord($1)-2*3)/ge'
 *Blog: http://fhbash.wordpress.com/ *
 *GitHub: https://github.com/fellipeh *
 *Twitter: @fh_bash*

 On Thu, May 21, 2015 at 10:23 AM, Fellipe Henrique 
 wrote:

> Thanks, I try that! but show me None as value...
>
> I think, that's because the QueryDict is showed in this way:
>
>  'data[status]': ['paid'], 'event': ['invoice.status_changed']": ['']}>
>
> I think the django takes
>
> 'data[id]': ['83A0C50B5A0A43AD8F60C1066B16A163'], 'data[status]':
> ['paid'], 'event': ['invoice.status_changed']
>
> as the "key"...
>
> :(
>
> T.·.F.·.A.·. S+F
> *Fellipe Henrique P. Soares*
>
> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
> 's/(.)/chr(ord($1)-2*3)/ge'
> *Blog: http://fhbash.wordpress.com/ *
> *GitHub: https://github.com/fellipeh *
> *Twitter: @fh_bash*
>
> On Thu, May 21, 2015 at 10:15 AM, Gergely Polonkai <
> gerg...@polonkai.eu> wrote:
>
>> Assuming your QueryDict is called my_post_data, use
>> my_post_data.get('data[id]').
>> On 21 May 2015 15:28, "Fellipe Henrique"  wrote:
>>
>>> Hello,
>>>
>>> I need to get one application-form-post content from one server.
>>> This server isn't mine.
>>>
>>> They send to me this application-form-post, and in Django View I
>>> receive this:
>>>
>>> >> 'data[status]': ['paid'], 'event': ['invoice']}>
>>>
>>> I need to get: data['id'], data['status']  and event variables..
>>>
>>> How I do this in django? Because I can't work with QueryDict... I
>>> try to transform in python dict, in python list, but anyone works...
>>>
>>> Any idea for these problem?
>>>
>>> Regards,
>>>
>>>
>>> T.·.F.·.A.·. S+F
>>> *Fellipe Henrique P. Soares*
>>>
>>> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
>>> 's/(.)/chr(ord($1)-2*3)/ge'
>>> *Blog: http://fhbash.wordpress.com/ *
>>> *GitHub: https://github.com/fellipeh *
>>> *Twitter: @fh_bash*
>>>
>>> --
>>> 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 to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAF1jwZFv5zwKHaDAFOz06n_%2B4EiNzzFoYx9t_MfTNnEFranAWg%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
>> 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,
>>>

Re: Non-profit membership management suggestions

2015-05-22 Thread Teruo Utsumi
Hi James,

I previously did come across that website.  But I've tried searches for 
"membership", "association", "club", and a few others, all to no avail.

Similar searches on GitHub result in hits, but for packages unrelated to 
what I'm looking for.  Or maybe I'm not digging deep enough.

Membership management for a small organization is such a common thing that 
I'd thought it'd be easy to find, but it's turned out to be a rather tough 
task.

On Friday, May 22, 2015 at 9:21:05 AM UTC-7, James Brewer wrote:
>
> Hey Teruo,
>
> I <3 astronomy :) Check out this nifty tool I found the other day: 
> https://www.djangopackages.com/
>

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d65679c4-89b6-4bab-8c8b-78d5105ba5f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Non-profit membership management suggestions

2015-05-22 Thread James Brewer
Hey Teruo,

I <3 astronomy :) Check out this nifty tool I found the other day:
https://www.djangopackages.com/

That site lists a bunch (all?) of Django packages with descriptions on what
each one does. You should at least be able to stitch together what you need.

Happy Friday!

James

On Fri, May 22, 2015 at 7:19 AM, Teruo Utsumi  wrote:

> I'm part of a non-profit (an astronomy club that does public outreach).
> To date all our operations are done manually, e.g., our membership database
> is a spreadsheet via cut-and-paste.
>
> We're looking to automate our processes, particularly those that are
> repetitive.
>
> I'm looking for open-source code that manages basic membership tasks, e.g.:
> - new member signups
> - new and renewing membership payment via Paypal (I know there are
> Django-Paypal packages)
> - membership management
> - email list management
> - extensible, e.g., allows adding APIs to Meetup
>
> I've come across Tendenci, but it uses:
> - Postgres - I was hoping to prototype on pythonanywhere.com but they
> charge for Postgres.
> - Django 1.6
> - Python 2
> - I haven't been able to get it to install
> It has much more than we need, but if I can get it to work, it's a viable
> alternative.
>
> I found tidyclub.com.  It's fee-based (although inexpensive) and I'd
> rather use a US-based host.
>
> I can't say my search has been exhaustive, but the above are the best
> examples I've found to date.
>
> I'm just starting to learn Django.  I have _TTD w/ Python_ by Percival and
> am planning to get Two-scoops 1.8.
>
> I know I can build my own package, but it'd obviously be much faster and
> easier to use something that already exists.
>
> I'd be grateful for any suggestions!
>
> --
> 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 to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c35df8ec-78de-4311-bb50-b5df1c0aaae2%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFryp_iWvWY77M78hEYzZXqK9%3DX9uM-XFBb9rddZKSQDN0jXsA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Address book using django

2015-05-22 Thread James Brewer
Hey Preeti,

Glad you're getting into Django! It's a fantastic framework. (I'm kind of
biased.)

With that said, we need more information to know how to help you. What have
you tried? Is your code available on Github? The "Where do I start?"
question is too broad for anyone to give an answer more effective than
"read the docs".

Happy Friday!

James

On Fri, May 22, 2015 at 8:58 AM, Preeti  wrote:

> Hi Gergely,
>
> thanks for replying back!
>
> I followed tutorials on djangoprojects.com but I haven't found it much
> resourceful for creating my app.
>
> Therefore, I seek to get help for some newer links to understand Django a
> better way.
>
>
> On Friday, May 22, 2015 at 11:50:00 AM UTC+5:30, Preeti wrote:
>>
>> I have to create an address book using django
>> it should contain two modules-user and admin
>>
>> the user is allowed to write his/her first name/last name, add the
>> picture, lists the social media links, should add a 4-digit PIN .
>>
>> the other user can use that 4-digit PIN to add a particular contact in
>> his list.
>>
>> I'm using Django 1.8, python 3.3
>> and the database I prefer is MySql
>>
>> Please guide how can I proceed with my application..
>>
>  --
> 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 to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/cd3b8bef-9785-4a44-9eae-57181bb4c6f8%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFryp_gEwmeiZak4yjGzPzbc%3D3orUf_3ji9c1mctp6PMsEDOFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Address book using django

2015-05-22 Thread Preeti
Hi Gergely, 

thanks for replying back!

I followed tutorials on djangoprojects.com but I haven't found it much 
resourceful for creating my app.

Therefore, I seek to get help for some newer links to understand Django a 
better way.


On Friday, May 22, 2015 at 11:50:00 AM UTC+5:30, Preeti wrote:
>
> I have to create an address book using django
> it should contain two modules-user and admin
>
> the user is allowed to write his/her first name/last name, add the 
> picture, lists the social media links, should add a 4-digit PIN .
>
> the other user can use that 4-digit PIN to add a particular contact in his 
> list.
>
> I'm using Django 1.8, python 3.3
> and the database I prefer is MySql
>
> Please guide how can I proceed with my application.. 
>

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cd3b8bef-9785-4a44-9eae-57181bb4c6f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how shall I built online address book using Django

2015-05-22 Thread Preeti
I donot want that people do homework for me or create the app for me.

I referred to that djangoproject.com tutorials  for two days, but for 
creating the app I didnt find it much resourceful.

I wanted few more good links from where I can understand django a better 
way to built my app.

thanks

On Friday, May 22, 2015 at 8:29:00 PM UTC+5:30, C. Kirby wrote:
>
> I think people here will be happy to help if you have specific questions, 
> but don't really want to do your homework for you.
>
> If you need to learn about how django works, and how you can start to 
> think about building this application, I recommend doing the tutorial at:
> https://docs.djangoproject.com/en/1.8/intro/tutorial01/
>
> On Friday, May 22, 2015 at 1:19:58 AM UTC-5, Preeti wrote:
>>
>> I have to create an address book using django
>> it should contain two modules-user and admin
>>
>> the user is allowed to write his/her first name/last name, add the 
>> picture, lists the social media links, should add a 4-digit PIN .
>>
>> the other user can use that 4-digit PIN to add a particular contact in 
>> his list.
>>
>> I'm using Django 1.8, python 3.3
>> and the database I prefer is MySql
>>
>> Please guide how can I proceed with my application.. 
>>
>

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9f0baa31-f87a-42d4-adff-d7fd17799bc5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django real world website samples (with django source codes)

2015-05-22 Thread Наталья Стасюк
Our japan restaurant site is based on django-oscar and django-cms: 
kenzo-resto.ru
Hope it help.
Regards.

четверг, 7 апреля 2011 г., 8:48:31 UTC+3 пользователь django beginner 
написал:
>
> Hi all, 
>
> Could someone please give a link on some of the samples for real world 
> Django websites? 
> Thanks and have a nice day! 
>
> Regards, 
> Django Beginner

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/edad5255-60b4-4826-b9c9-459dc072f73a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django real world website samples (with django source codes)

2015-05-22 Thread Наталья Стасюк
Hi, Django Beginner!
You may look at our restaurant site http://kenzo-resto.ru/
It based on django-oscar and django-cms with some other usefull django apps.
Django-cms with django-cms-cascade plugin works great and allow us to 
create new pages very quickly in visual way.
Hope, its helpfull.
Excuse my bad english)

четверг, 7 апреля 2011 г., 8:48:31 UTC+3 пользователь django beginner 
написал:
>
> Hi all, 
>
> Could someone please give a link on some of the samples for real world 
> Django websites? 
> Thanks and have a nice day! 
>
> Regards, 
> Django Beginner

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8fdb21ec-37b5-4fe4-a056-1f439336b928%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Non-profit membership management suggestions

2015-05-22 Thread Teruo Utsumi
I'm part of a non-profit (an astronomy club that does public outreach).  To 
date all our operations are done manually, e.g., our membership database is 
a spreadsheet via cut-and-paste.

We're looking to automate our processes, particularly those that are 
repetitive.

I'm looking for open-source code that manages basic membership tasks, e.g.:
- new member signups
- new and renewing membership payment via Paypal (I know there are 
Django-Paypal packages)
- membership management
- email list management
- extensible, e.g., allows adding APIs to Meetup

I've come across Tendenci, but it uses:
- Postgres - I was hoping to prototype on pythonanywhere.com but they 
charge for Postgres.
- Django 1.6
- Python 2
- I haven't been able to get it to install
It has much more than we need, but if I can get it to work, it's a viable 
alternative.

I found tidyclub.com.  It's fee-based (although inexpensive) and I'd rather 
use a US-based host.

I can't say my search has been exhaustive, but the above are the best 
examples I've found to date.

I'm just starting to learn Django.  I have _TTD w/ Python_ by Percival and 
am planning to get Two-scoops 1.8.

I know I can build my own package, but it'd obviously be much faster and 
easier to use something that already exists.

I'd be grateful for any suggestions!

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c35df8ec-78de-4311-bb50-b5df1c0aaae2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how shall I built online address book using Django

2015-05-22 Thread C. Kirby
I think people here will be happy to help if you have specific questions, 
but don't really want to do your homework for you.

If you need to learn about how django works, and how you can start to think 
about building this application, I recommend doing the tutorial at:
https://docs.djangoproject.com/en/1.8/intro/tutorial01/

On Friday, May 22, 2015 at 1:19:58 AM UTC-5, Preeti wrote:
>
> I have to create an address book using django
> it should contain two modules-user and admin
>
> the user is allowed to write his/her first name/last name, add the 
> picture, lists the social media links, should add a 4-digit PIN .
>
> the other user can use that 4-digit PIN to add a particular contact in his 
> list.
>
> I'm using Django 1.8, python 3.3
> and the database I prefer is MySql
>
> Please guide how can I proceed with my application.. 
>

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/205d36ff-8e9e-4dea-a9f6-85c4f8bdfd75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to get a application-formpost in django view? Get QueryDict variables.

2015-05-22 Thread Fellipe Henrique
Here is the request.body:

b"'data[id]', ['83A0C50B5A0A43AD8F60C1066B16A163']&'data[status]',
['paid']&'event',['invoice.status_changed']"

I think, maybe, something is wrong in Django, because these same POST is
easy to get using PHP or Rails.. in PHP I get with these:
 $_POST['data']['id']

Maybe, something in django isn't implemented yet for these kind POST.

T.·.F.·.A.·. S+F
*Fellipe Henrique P. Soares*

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
*Blog: http://fhbash.wordpress.com/ *
*GitHub: https://github.com/fellipeh *
*Twitter: @fh_bash*

On Fri, May 22, 2015 at 2:53 AM, Gergely Polonkai 
wrote:

> I don't think so, maybe the post request is poorly formatted. Can you
> somehow catch the raw http request for analyzing?
> On 22 May 2015 00:14, "Vijay Khemlani"  wrote:
>
>> Maybe the brackets confuse the querydict, try calling its items method
>> (to convert it into a list of tuples) or its dict method (to turn it into a
>> normal python dict)
>>
>> On Thu, May 21, 2015 at 3:34 PM, Fellipe Henrique 
>> wrote:
>>
>>> Any ideas?
>>>
>>> I finish all my possibilities in these problem.. :( and no solution...
>>>
>>> T.·.F.·.A.·. S+F
>>> *Fellipe Henrique P. Soares*
>>>
>>> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
>>> 's/(.)/chr(ord($1)-2*3)/ge'
>>> *Blog: http://fhbash.wordpress.com/ *
>>> *GitHub: https://github.com/fellipeh *
>>> *Twitter: @fh_bash*
>>>
>>> On Thu, May 21, 2015 at 10:23 AM, Fellipe Henrique 
>>> wrote:
>>>
 Thanks, I try that! but show me None as value...

 I think, that's because the QueryDict is showed in this way:

 >>> 'data[status]': ['paid'], 'event': ['invoice.status_changed']": ['']}>

 I think the django takes

 'data[id]': ['83A0C50B5A0A43AD8F60C1066B16A163'], 'data[status]':
 ['paid'], 'event': ['invoice.status_changed']

 as the "key"...

 :(

 T.·.F.·.A.·. S+F
 *Fellipe Henrique P. Soares*

 e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
 's/(.)/chr(ord($1)-2*3)/ge'
 *Blog: http://fhbash.wordpress.com/ *
 *GitHub: https://github.com/fellipeh *
 *Twitter: @fh_bash*

 On Thu, May 21, 2015 at 10:15 AM, Gergely Polonkai >>> > wrote:

> Assuming your QueryDict is called my_post_data, use
> my_post_data.get('data[id]').
> On 21 May 2015 15:28, "Fellipe Henrique"  wrote:
>
>> Hello,
>>
>> I need to get one application-form-post content from one server. This
>> server isn't mine.
>>
>> They send to me this application-form-post, and in Django View I
>> receive this:
>>
>> > 'data[status]': ['paid'], 'event': ['invoice']}>
>>
>> I need to get: data['id'], data['status']  and event variables..
>>
>> How I do this in django? Because I can't work with QueryDict... I try
>> to transform in python dict, in python list, but anyone works...
>>
>> Any idea for these problem?
>>
>> Regards,
>>
>>
>> T.·.F.·.A.·. S+F
>> *Fellipe Henrique P. Soares*
>>
>> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
>> 's/(.)/chr(ord($1)-2*3)/ge'
>> *Blog: http://fhbash.wordpress.com/ *
>> *GitHub: https://github.com/fellipeh *
>> *Twitter: @fh_bash*
>>
>> --
>> 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 to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAF1jwZFv5zwKHaDAFOz06n_%2B4EiNzzFoYx9t_MfTNnEFranAWg%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>  --
> 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 to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACczBULAgWb%3D6sn1JHxeg_nq%2BO%3DwR9bTBNR69QsUSKog1FB%3DKw%40mail.gmail.com
> 

Re: Address book using django

2015-05-22 Thread Gergely Polonkai
Hello,

besides that it sounds like a homework to me, I don't see why you need an
admin module, as Django already has one.

For everything else, if you walk through the tutorial app, you should get
most of the ideas from there.

Best,
Gergely
On 22 May 2015 09:19, "Preeti"  wrote:

> I have to create an address book using django
> it should contain two modules-user and admin
>
> the user is allowed to write his/her first name/last name, add the
> picture, lists the social media links, should add a 4-digit PIN .
>
> the other user can use that 4-digit PIN to add a particular contact in his
> list.
>
> I'm using Django 1.8, python 3.3
> and the database I prefer is MySql
>
> Please guide how can I proceed with my application..
>
> --
> 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 to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/849c3f71-c5ad-4b62-b9d6-0012505a2201%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUJZfk%3D33nFmQrnDHosn3xUEgBXn_ZL7cz%2BTb7pGLrCy5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Migrating from sqllite3 to postgres

2015-05-22 Thread Gergely Polonkai
I will also have to do this in the near future (same reason), and already
have some untested ideas. My guess is to add a second database in
settings.DATABASES, fetch all the model instances from my original db and
save them in the other. But if anyone has a better solution, let us know!
On 22 May 2015 09:19, "jaspinder singh"  wrote:

> I have developed an app using sqllite. But my Heroku doesn't support
> sqllite and the data keeps leaking every 24 hours. Can someone list the
> steps how to change from sqllite3 to postgres
>
> --
> 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 to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7fc71178-9609-42c2-8c39-e6c5d132ffdc%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBULGjE0OW3yCNZrRtOQS0JRXjryNGgLB7wzeuiATYSNS9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Custom RelatedManager?

2015-05-22 Thread Erik Cederstrand
Hi folks,


I have some models with a custom Manager that prefetches certain fields:

class PrefetchManager(models.Manager):
def get_queryset(self):
return super().get_queryset()\
.select_related(*self.model.select_fields)\
.prefetch_related(*self.model.prefetch_fields)


class MyModel(models.Model):
foo = models.ForeignKey(Foo)
bars = models.ManyToManyField(Bar, related_name='mymodels')

select_fields = ('foo',)
prefetch_fields = ('bars')
prefetched = PrefetchManager()


This allows the nice and succinct "MyModel.prefetched.filter(...)" to get model 
instances with prefetched fields. However, I would also like this to work with 
RelatedManager, i.e.:

m = MyModel.objects.get(pk=1)
m.bars.prefetched.filter(...)

to get all Bar connected to m with the prefetched fields I have defined on Bar. 
Is there a way to do this? Can I create a custom RelatedManager for 'bars'? I 
can rewrite it as:

   Bar.prefetched.filter(mymodels=m, ...)

but it feels more awkward.

Thanks,
Erik

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9E6B2519-C3BC-4820-B8A2-043E8EC450C2%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.