how shall I built online address book using Django

2015-05-21 Thread Preeti
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/3d31ab5d-a01e-43c8-966a-61997c8dc1e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Address book using django

2015-05-21 Thread Preeti
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.


Combining Social auth and normal auth in Django

2015-05-21 Thread akshat
I am developing a full-fledged user management in django. I want to combine 
normal django authentication and social authentications. Django normal 
authentication contains one User table which stores all the fields of user 
such as (username,email,password etc). I want to know the sequential steps 
to add social auth to this normal authentication process using 
python-social-auth plugin.
Also I have some concerns regarding functioning of python-social-auth. How 
does it actually behave. For ex. - suppose user is registered with email - 
a...@gmail.com and his facebook login email is also a...@gmail.com then will 
they be one entries in the User table in the backend?
I mean I want to know the exact process to add social auth without 
disturbing my initial django normal authentication.Is there any tool which 
handles both normal and social auth in a single app?
I know this is a broad topic but general guidance would do.
Thanks in advance

-- 
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/e1b4f3d3-7cbd-49a9-8521-7d3e4f31ee66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Migrating from sqllite3 to postgres

2015-05-21 Thread jaspinder singh
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.


Re: utf-16le encode generic view object_list

2015-05-21 Thread Stephen J. Butler
I think that looks fine. I would change the mimetype to "text/plain;
charset=UTF-16LE" just to play nice, but it probably will never matter
with your Content-Disposition. Also, HttpResponse's mimetype parameter
has been deprecated since 1.5; use content_type instead.

On Thu, May 21, 2015 at 3:04 PM, JHeasly  wrote:
> Hello all,
>
> I've got a function-based generic view that I want to return a utf-16le
> encoded response (for use as an InDesign tagged text file; the utf-16le is
> what InDesign wants). I've got it working here, but am wondering if there's
> an more straightforward way.
>
> For comparison, the "original" utf-8 encoded version is here and shorter. I
> tried a
>
> response.content.encode('utf-16le')
>
> as response seems to have some sort of HttpResponse wrapper on it.
>
> Thanks,
> John
>
> --
> 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/396a9248-5930-43d9-a3bb-43154fd2ae9b%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/CAD4ANxX35fr1CBNNumS6eRyKOgbKk4vNrcuFW%3Dyr4Hmkeb-4sA%40mail.gmail.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-21 Thread Gergely Polonkai
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
 
 .
 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/CAF1jwZHE9K2n%3Dvu-yb2HuNSvkJcx3XYqo6KTzmRYKPESVtGOEw%40mail.gmail.com
>> 

Re: 'ImageFieldFile' object has no attribute 'startswith'

2015-05-21 Thread YusufSalahAdDin
I have the same problem doing feeds, can anyone help me?
Yes, i'm using sorl-thumbnail.

El lunes, 11 de agosto de 2008, 14:59:47 (UTC-5), Daehee escribió:
>
> Thank you for the prompt responses. I am using sorl-thumbnail on 
> Google Code, and with your tips I found the solution to the problem 
> based on the FileField refactoring here: 
> http://code.google.com/p/sorl-thumbnail/issues/detail?id=34 
>
> Daehee 
>
> On Aug 11, 3:37 pm, "Marty Alchin"  wrote: 
> > On Mon, Aug 11, 2008 at 3:22 PM, Daehee  wrote: 
> > > Hi, I'm using Django revision 8309. After I recently update to this 
> > > revision, it seems to break my code... Just wondering if anyone else 
> > > is having the same errors. I tried to roll back to a previous revision 
> > > but now the error seems stuck. Any help would be appreciated. 
> > 
> > This would have been introduced in revision 8244, with the FileField 
> > changes. Values for FileField are no longer raw strings, so they don't 
> > have the startswith() method anymore. I was told last night that some 
> > of the thumbnail apps rely on startswith(), and are thus breaking. 
> > 
> > The solution here is to update the thumbnail app to use the value's 
> > "name" attribute as the string it wants. 
> > 
> > -Gul

-- 
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/bc8e4077-2d4e-4e89-836b-d337c841a9c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to concatenate two variables in a template for evaluation..

2015-05-21 Thread Luis Zárate
Mmm maybe creating a tag
https://docs.djangoproject.com/en/1.8/howto/custom-template-tags/#writing-custom-template-tags


In template {% mytag obj prop %}

In tag function

def mytag(obj, prop):
 return getattr(obj, prop)



El miércoles, 20 de mayo de 2015, rishi sijariya 
escribió:
> Hi Hayyan Rafig,
>
>  did you find your solution of adding two variable , if yes pls share
with us, or any one can help pls
>
> On Wednesday, 10 August 2011 03:07:25 UTC+5:30, Hayyan Rafiq wrote:
>>
>> Okay then which way do u recommend that i should follow in case
>> i need to displays objects with different no of properties
>> Example obj has propA and PropB
>> {{obj.propA}}
>> {{obj.propB}}
>> would work but i want it to be dynamic since the no and name of
properties may vary..
>> I tried writing all the properties of an object in a list and passing
that list obj to template
>> but it seems this is not just possible.. since
>> {% for prop in properties %}
>>   {{obj}}+{{.prop}}
>>  {% endfor %}
>> or other things similar to above do not work
>>
>> Any suggestions..
>>
>> > Date: Tue, 9 Aug 2011 17:25:42 -0400
>> > Subject: Re: How to concatenate two variables in a template for
evaluation..
>> > From: sh...@milochik.com
>> > To: django...@googlegroups.com
>> >
>> > You have to write it as {{ obj.title }} in your template. Django
>> > templates are designed to allow very little in the way of logic; that
>> > should take place in your views.
>> >
>> > --
>> > You received this message because you are subscribed to the Google
Groups "Django users" group.
>> > To post to this group, send email to django...@googlegroups.com.
>> > To unsubscribe from this group, send email to
django-users...@googlegroups.com.
>> > For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>> >
>
> --
> 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/bbe5399f-15e3-43b5-ae7d-d79e5f54191b%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/CAG%2B5VyMVdUVzhFzVsj54SZoiR5NDLx9RYZoqgYJ0Am6za%3D3pHg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


httml form to django

2015-05-21 Thread Luis Zárate
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+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/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/CAG%2B5VyN8ntB%3DNs-1zyoe1E7d0yDUMMcOR9gpS%2BEAgRE6J%3DBXTg%40mail.gmail.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-21 Thread Luis Zárate
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+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/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/CAG%2B5VyMdVUa%2Bp_Nd5%2B%3DtcnGnvVKzFS-OqJ8_2ac7QVKGH%3DAW0w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: select_related() / prefetch_related() and sharding

2015-05-21 Thread Simon Charette
Small correction, prefetch_related doesn't issue any JOIN unless a is query 
with a select_related is specified with a Prefetch object.

Simon

Le jeudi 21 mai 2015 17:53:30 UTC-4, Ash Christopher a écrit :
>
> Hi David,
>
> *select_related* does a JOIN under the hood, and you can't do 
> cross-database joins in the databases supported by Django. For 
> prefetch_related, there is no way out of the box to perform a 
> cross-database join in Python (which is what prefetch_related is doing) but 
> perhaps there is some way to programatically make that happen. I haven't 
> put any effort into exploring that idea.
>
> Thanks,
>
> On Thu, May 21, 2015 at 3:42 PM, David > 
> wrote:
>
>> Dear List,
>>
>> I came about conflicting information (to my mind) concerning the use of
>> select_related() and prefetch_related().
>> My question is whether you can combine select_related() and
>> prefetch_related() with sharding techniques. If so, how are you doing it?
>>
>> Background:
>> I was watching various videos on Django under load and Django scaling,
>> generally there comes a point at which they point at database sharding.
>> Ash Christopher (https://www.youtube.com/watch?v=frlsGUHYu04) points out
>> that as you use multiple databases with your Application,
>> select_related() and prefetch_related() can no longer be used. In
>> Christophe Pettus' videos I have not found such a comment, in fact
>> select_related() and prefetch_related() seem to be habitually
>> recommended to speed database connections up.
>>
>> Thanks for your insights!
>>
>> David
>>
>
>

-- 
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/93fccd09-9d66-4e95-b242-7a8f81254726%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Lots of django questions

2015-05-21 Thread Lachlan Musicman
0. Yep, just delete your secret key and get a new one - wont affect
anything negatively.
2. I put things like menus into the base.html template. It means a little
bit of hand coding once, but only once.
How to do it depends on your design. I personally am terrible at design, so
using bootstrap makes it dead easy. In bootstrap it is called a navbar:
http://getbootstrap.com/components/#navbar
3. I've only ever used {{csrf_token}} in forms. If you don't have one in a
form, I think it fails. Don't need it in other pages to my knowledge.
4. Django Packages is the best repo of django apps around:
https://www.djangopackages.com/ I have recently installed Zinnia. It was
dead easy and works well. Depends on what you need.

--
let's build quiet armies friends, let's march on their glass towers...let's
build fallen cathedrals and make impractical plans

- GYBE

On 22 May 2015 at 06:35, Derek Riemer  wrote:

> Hi guys,
> A few questions here.
>
> First of all,
>
> 0.
> Woopsi, I accidentally pushed my secret key to a public github multiple
> times (I must be an idiot Lol). Can I simply just change this key to a
> random string like those on https://www.grc.com/passwords.htm? Luckilly I
> never really did anything with django with this app where the secret key
> matters.
>
> 2. How is the best way to generate menus?
> I have pages such as these.
>
> My menu below this line.
> ---
> Personal website
> Random pieces of software.
> College/academic portfolio.
> Resume
> ...
>
> and under some of these I have things like
> software one currently has a weather app,
> the personal website will have
> Home,
> About Me,
> Contact me form,
> ...
>
> ..., ...
>
> Is there an already built django solution to this problem? I don't want to
> have to have repetative pages on each level of my menus, and have a set of
> template inheritance schemes already set up in my app. I already have a
> base.htm which my homepage, and 3 other pages already inherit from and that
> page specifies css styles and custom javascript.
>
> 3. Is it safe to put {{csrf_token}} in my app in the page since the cookie
> isn't there always?
> Can I tell python to send the cookie but not insert the token into the dom?
>
> 4. What type of django blogs exist? I kind of want to keep my blog data
> private, and don't know if I should migrate my current blog to wordpress
> from blogger, or just role something with django.
> Enter code here...
>
> Enter code here...
>
> Enter code here...
>
> Enter code here...
>
>
> Thanks,
> Derek
>
>
>  --
> 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/0e5b2b69-764b-4d55-a891-0a468743aff4%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/CAGBeqiOVXwOVn%3Dpyiz8fp-3rFrEDiM%3DowOB%3DACjQRxVeGPbv_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Lots of django questions

2015-05-21 Thread Derek Riemer
Hi guys,
A few questions here.

First of all,

0.
Woopsi, I accidentally pushed my secret key to a public github multiple 
times (I must be an idiot Lol). Can I simply just change this key to a 
random string like those on https://www.grc.com/passwords.htm? Luckilly I 
never really did anything with django with this app where the secret key 
matters.

2. How is the best way to generate menus?
I have pages such as these.

My menu below this line.
---
Personal website
Random pieces of software.
College/academic portfolio.
Resume
...

and under some of these I have things like 
software one currently has a weather app,
the personal website will have 
Home,
About Me,
Contact me form,
...

..., ...

Is there an already built django solution to this problem? I don't want to 
have to have repetative pages on each level of my menus, and have a set of 
template inheritance schemes already set up in my app. I already  have a 
base.htm which my homepage, and 3 other pages already inherit from and that 
page specifies css styles and custom javascript.

3. Is it safe to put {{csrf_token}} in my app in the page since the cookie 
isn't  there always?
Can I tell python to send the cookie but not insert the token into the dom?

4. What type of django blogs exist? I kind of want to keep my blog data 
private, and don't know if I should migrate my current blog to wordpress 
from blogger, or just role something with django.
Enter code here...

Enter code here...

Enter code here...

Enter code here...


Thanks,
Derek


-- 
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/0e5b2b69-764b-4d55-a891-0a468743aff4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: select_related() / prefetch_related() and sharding

2015-05-21 Thread Ash Christopher
Hi David,

*select_related* does a JOIN under the hood, and you can't do
cross-database joins in the databases supported by Django. For
prefetch_related, there is no way out of the box to perform a
cross-database join in Python (which is what prefetch_related is doing) but
perhaps there is some way to programatically make that happen. I haven't
put any effort into exploring that idea.

Thanks,

On Thu, May 21, 2015 at 3:42 PM, David  wrote:

> Dear List,
>
> I came about conflicting information (to my mind) concerning the use of
> select_related() and prefetch_related().
> My question is whether you can combine select_related() and
> prefetch_related() with sharding techniques. If so, how are you doing it?
>
> Background:
> I was watching various videos on Django under load and Django scaling,
> generally there comes a point at which they point at database sharding.
> Ash Christopher (https://www.youtube.com/watch?v=frlsGUHYu04) points out
> that as you use multiple databases with your Application,
> select_related() and prefetch_related() can no longer be used. In
> Christophe Pettus' videos I have not found such a comment, in fact
> select_related() and prefetch_related() seem to be habitually
> recommended to speed database connections up.
>
> Thanks for your insights!
>
> David
>

-- 
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/CAJdxA4uqMB_-ovXehbiUnqaX6Co6LP7LPMKAf88fb-Zb6VW_%2BQ%40mail.gmail.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-21 Thread Vijay Khemlani
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
>>> 
>>> .
>>> 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/CAF1jwZHE9K2n%3Dvu-yb2HuNSvkJcx3XYqo6KTzmRYKPESVtGOEw%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 recei

Re: utf-16le encode generic view object_list

2015-05-21 Thread Tim Chase
On 2015-05-21 13:04, JHeasly wrote:
> I've got a function-based generic view that I want to return a
> utf-16le encoded response (for use as an InDesign tagged text file;
> the utf-16le is what InDesign wants). I've got it working here 
> , but am
> wondering if there's an more straightforward way.
> 
> For comparison, the "original" utf-8 encoded version is here 
>  and shorter.
> I tried a 
> 
> response.content.encode('utf-16le')
> 
> as response seems to have some sort of HttpResponse wrapper on it.

you could reduce the verbosity by using render_to_string()

https://docs.djangoproject.com/en/1.7/ref/templates/api/#the-render-to-string-shortcut


but otherwise, I suspect the extras code is just the cost of doing
something off the ordinary path.

-tkc




-- 
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/20150521152535.162c8d66%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.


utf-16le encode generic view object_list

2015-05-21 Thread JHeasly
Hello all,

I've got a function-based generic view that I want to return a utf-16le 
encoded response (for use as an InDesign tagged text file; the utf-16le is 
what InDesign wants). I've got it working here 
, but am wondering if 
there's an more straightforward way.

For comparison, the "original" utf-8 encoded version is here 
 and shorter. I tried 
a 

response.content.encode('utf-16le')

as response seems to have some sort of HttpResponse wrapper on it.

Thanks,
John

-- 
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/396a9248-5930-43d9-a3bb-43154fd2ae9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


select_related() / prefetch_related() and sharding

2015-05-21 Thread David
Dear List,

I came about conflicting information (to my mind) concerning the use of
select_related() and prefetch_related().
My question is whether you can combine select_related() and
prefetch_related() with sharding techniques. If so, how are you doing it?

Background:
I was watching various videos on Django under load and Django scaling,
generally there comes a point at which they point at database sharding.
Ash Christopher (https://www.youtube.com/watch?v=frlsGUHYu04) points out
that as you use multiple databases with your Application,
select_related() and prefetch_related() can no longer be used. In
Christophe Pettus' videos I have not found such a comment, in fact
select_related() and prefetch_related() seem to be habitually
recommended to speed database connections up.

Thanks for your insights!

David

-- 
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/555E350C.9010600%40gmx.net.
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-21 Thread Fellipe Henrique
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
>> 
>> .
>> 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/CAF1jwZHE9K2n%3Dvu-yb2HuNSvkJcx3XYqo6KTzmRYKPESVtGOEw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


django-1-8-form-with-fieldmap-for-receiving-mailgun-icoming-mails

2015-05-21 Thread Klaas Feenstra
Hello Django users,

I want to receive mails from mailgun in a Django web application. I have 
problem with parsing the data to the form. As you can see, in the froms.py 
there is a field_map, to convert the fields Mailgun sends to the model 
fields. This is not working. All fields that are not converted I receive, 
but for example the from field I cannot retrieve. I have installed Django 
1.8 and Python2.7. The code is from
https://github.com/hedberg/django-mailgun-incoming I think this would work 
for Django < 1.8, because in Django 1.8 is introduced the obligation to 
specify the fields. In older versions, omitting both fields and exclude 
resulted in a form with all the model’s fields. Doing this now raises an 
ImproperlyConfigured exception.Hope someone can help me. Thanks in advance

Here is the link to Mailgun for more information 
https://documentation.mailgun.com/user_manual.html#routes
forms.py

from django import forms
from models import EmailBaseModel

class EmailForm(forms.ModelForm):
field_map = {'from_str':'from',
 'body_plain':'body-plain',
 'body_html':'body-html',
 'stripped_text':'stripped-text',
 'stripped_html':'stripped-html',
 'message_headers':'message-headers',
 'stripped_signature':'stripped-signature',
 'content_id_map':'content-id-map'}

class Meta:
#model = EmailBaseModel
fields = '__all__'

def __init__(self, *args, **kwargs):
super(EmailForm, self).__init__(*args, **kwargs)
for (field_name, form_key) in self.field_map.items():
self.fields[form_key] = self.fields[field_name]
del self.fields[field_name]
self.fields['attachment-count'] = forms.IntegerField(required=False)

def clean(self):
for (field_name, form_key) in self.field_map.items():
if form_key in self.cleaned_data:
self.cleaned_data[field_name] = self.cleaned_data[form_key]
return self.cleaned_data

views.py

# -*- coding: utf-8 -*-import hashlib, hmacimport logging#import pdb
from django.conf import settings
from django.http import HttpResponse, HttpResponseBadRequest
from django.forms.models import modelform_factory
from django.views.generic.base import View
from django.views.decorators.csrf import csrf_exempt
from django.utils.decorators import method_decorator
from mailgun_incoming.models import Attachment, IncomingEmail
from mailgun_incoming.signals import email_received
from mailgun_incoming.forms import EmailForm

logger = logging.getLogger(__name__)

API_KEY = getattr(settings, "MAILGUN_ACCESS_KEY", "")
VERIFY_SIGNATURE = getattr(settings, "MAILGUN_VERIFY_INCOMING", API_KEY!="")
class Incoming(View):
#pdb.set_trace()
email_model = IncomingEmail
attachment_model = Attachment
form = EmailForm
api_key = API_KEY
verify = VERIFY_SIGNATURE

def get_form(self):
return modelform_factory(self.email_model, form=self.form)

@method_decorator(csrf_exempt)
def dispatch(self, *args, **kwargs):
return super(Incoming, self).dispatch(*args, **kwargs)

def post(self, request, *args, **kwargs):
if self.verify:
verified = self.verify_signature(request.POST.get('token',''),
  request.POST.get('timestamp',''),
  request.POST.get('signature',''))
if not verified:
logger.debug("Signature verification failed. Email posted from 
%s. %s" % (
  request.META.get('REMOTE_ADDR',''),
  request.POST.get('subject', '')))
return HttpResponseBadRequest("Invalid signature")

form = self.get_form()(request.POST)

if form.is_valid():
#save email

email = form.save()
#save attachments
attachments = []
if form.cleaned_data.get('attachment-count',0):
attachments = []
#reverse mapping in content_ids dict
content_ids = dict((attnr,cid) for cid,attnr in 
(email.content_ids or {}).iteritems())
i = 1
for file in request.FILES.values():
attachment = self.attachment_model(email=email, file=file, 
content_id=content_ids.get('attachment-{0!s}'.format(i),'')).save()
attachments.append(attachment)
i += 1
self.handle_email(email, attachments=attachments)
else:
logger.debug("Received email message contained errors. %s" % 
form.errors)

return HttpResponse("OK")

def handle_email(self, email, attachments=None):
email_received.send(sender=self.email_model, instance=email, 
attachments=attachments or [])

def verify_signature(self, token, timestamp, signature):
 

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

2015-05-21 Thread Andreas Kuhne
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+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/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/CALXYUbkWtEDzmn4GjD0puhanC10Q9Wq0JoESd%3D71cNGuG7%3DWfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2015-05-21 Thread 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+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/a432f1b0-5042-4b4a-a7ff-57e92ce539be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: httml form to django

2015-05-21 Thread dk
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+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/cbe6f8ba-c31e-4fe7-93b2-309178a038b8%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-21 Thread dk
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+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/2824dccf-ac12-4183-8ced-f4ec1917e49a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


trouble with creditcard expiry field

2015-05-21 Thread john

Hi,

I'm using a module called creditcard.py (to be honest I can't recall 
where I got it) and it works just great for phones, firefox desktop, 
chrome desktop with my Django forms.  But (of course there is a but) it 
is not working with the Safari desktop (laptop) 10.9 (mostly likely all 
versions of Safari).


Of course I only want month and year and could get it work using using 
numbers and two fields.  But I don't want to lose the nice way the field 
works on phones - where a native date/Month selection control appears 
when entering the field.


So does anyone have a suggestion on how to create a credit card expire 
field on my website that works for Safari and the phones?



Johnf

--
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/555DF17B.2000402%40jfcomputer.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-21 Thread Fellipe Henrique
Thanks, I try that! but show me None as value...

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



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
> 
> .
> 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/CAF1jwZFMBR5--WXuwd3-Hdi6KO1sLLBogt%2BE6N3xepvXz_ovsw%40mail.gmail.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-21 Thread Gergely Polonkai
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.
For more options, visit https://groups.google.com/d/optout.


Re: Microsoft SQL Server and Azure SQL Database support

2015-05-21 Thread Michael Manfre
django-pyodbc-azure might be a better choice and it seems to be more 
actively maintained.

On Thursday, May 21, 2015 at 8:30:33 AM UTC-4, felix wrote:
>
>  El 20/05/15 14:39, Meet Bhagdev escribió:
>  
> When I last checked the Django ORM did not have official support for SQL 
> Server and Azure SQL DB. Is there a way to use SQL Server and more 
> importantly Azure SQL DB by modifying the DATABASES configuration 
> in settings.py 
>  
>  
>  Try django-pyodbc. On Linux I've used  it for SQL Server.
>  

-- 
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/ab9b9c1d-356d-45a9-8b43-e09897d4bcab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Microsoft SQL Server and Azure SQL Database support

2015-05-21 Thread felix

El 20/05/15 14:39, Meet Bhagdev escribió:
When I last checked the Django ORM did not have official support for 
SQL Server and Azure SQL DB. Is there a way to use SQL Server and more 
importantly Azure SQL DB by modifying the DATABASES configuration 
in settings.py




Try django-pyodbc. On Linux I've used  it for SQL Server.

--
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/555DD0C2.5060709%40epepm.cupet.cu.
For more options, visit https://groups.google.com/d/optout.


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

2015-05-21 Thread Fellipe Henrique
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:



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.


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

2015-05-21 Thread Galia Ladiray
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+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/7328fff3-7385-4740-937e-d5d58695045c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.