Any companies in UK interested in outsourcing partnership with a Romanian company?

2015-03-23 Thread Gabriel - Iulian Dumbrava
Hi all,

I don't know if this is the perfect place to post this, but I couldn't 
think of a better one. I'm open to suggestions.

I run my own software company in Romania and between 8th and 21st of April 
I'll be in London. If there is anyone interested in having a chat face to 
face please contact me so I can schedule the appointments.

We have migrated all our web development to Django quite some years ago, 
back in the Django 1.1 era and I've never been happier with the decision.

If you want to 'disqus' more, please contact me by email or skype: 
gabriel_dumbrava

For more info about us check our website: http://www.VerticalProjects.com

Have a great day!
Gabriel

-- 
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/ac46f427-2bd9-4355-b1ac-d790af824470%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Data migration script populating db table - testing

2015-03-23 Thread Filipe Ximenes
One way to do it is to run all operations, don't call "save" and verify
"manually" if objects are correct.
I don't know about other methods, but if someone else does it would be
great.

On Sun, Mar 22, 2015 at 6:29 AM, Murthy Sandeep 
wrote:

> Hi
>
> I have created an data migration script for populating one of
> app db tables with data from a JSON file.  First I ran
>
> python manage.py makemigrations --empty TPP_App
>
>
>
> (‘TPP_App’ is the name of my app) and then I added a custom
> method called populate_db which will use bulk_create to add
> multiple entries to the table, and then do a save() to write the
> changes to the db.  At the moment the custom method is empty
> because I am still working on it, but the script looks like this right
> now
>
> # -*- coding: utf-8 -*-
> from __future__ import unicode_literals
>
> from django.db import models, migrations
>
> def populate_db( apps, schema_editor ):
> print ‘Populating db from JSON file...'
>
> class Migration(migrations.Migration):
>
> dependencies = [
> ('TPP_App', '0003_auto_20150224_2024'),
> ]
>
> operations = [
>migrations.RunPython( populate_db ),
> ]
>
> How do I test this script to make sure the custom method works
> as expected, before I run it fully?  Can I call this from the interpreter
> and test it with the db API?
>
> At the moment if I do
>
> python manage.py migrate
>
> it reports there are no migrations to apply.
>
> Sandeep
>
>
> --
> 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/10767D81-937A-4F08-983A-B055C4AB3982%40sandeepmurthy.is
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


*Filipe Ximenes*+55 (81) 8245-9204

*Vinta Software Studio*http://www.vinta.com.br

-- 
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/CAA-QWB34WORCeaYAYxSN6FewAKJ1xhzVZcJitQFiL7s9eBDS%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Misleading 404 exception during unit tests.

2015-03-23 Thread Benjamin Scherrey
Can someone explain the test condition on line 31 of
https://github.com/django/django/blob/master/django/contrib/staticfiles/views.py
- Just spent a few hours trying to get my unit tests to pass and couldn't
figure out what was going on until I found this weirdness.

I understand serve() isn't meant for production but, prior to having
production ready it's nice to be able to unit test my code as it's being
developed with serve() as a temporary measure. Right now I'm using serve()
as a temporary hack to stand in for an external URI router that isn't
present yet. Throwing a 404 without any helpful indication of the true
cause of the exception simply confuses people and makes them wonder why the
URI they're passing in is not being found when they can try it on the
command line and see it work just fine. At minimum this exception should be
more explicit.


-- 
Chief Systems Architect Proteus Technologies 
Chief Fan Biggest Fan Productions 
Personal blog where I am not your demographic
.

This email intended solely for those who have received it. If you have
received this email by accident - well lucky 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/CAHN%3D9D5U0gtKym4Er5hBURwhJ2aC_zteUthVR4Rq5-7EDrMkYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Misleading 404 exception during unit tests.

2015-03-23 Thread Benjamin Scherrey
I see now that the behaviour of serve() was changed for 1.7 and it now
returns a silent misleading 404 result rather than the old
ImproperlyConfigured exception which would have provided a clue as to the
actual root cause.

See:
https://docs.djangoproject.com/en/1.7/ref/contrib/staticfiles/#django.contrib.staticfiles.views.serve

I don't understand the purpose of this change but it certainly sent me on a
wild goose chase trying to understand the 404 response. Would be VERY
useful if this 404 at least provided some information as to what it's
really all about - preferably with the above link embedded in it.

Thanx to Rene Fleschenberg on irc for the doc link.


On Mon, Mar 23, 2015 at 8:42 PM, Benjamin Scherrey 
wrote:

> Can someone explain the test condition on line 31 of
> https://github.com/django/django/blob/master/django/contrib/staticfiles/views.py
> - Just spent a few hours trying to get my unit tests to pass and couldn't
> figure out what was going on until I found this weirdness.
>
> I understand serve() isn't meant for production but, prior to having
> production ready it's nice to be able to unit test my code as it's being
> developed with serve() as a temporary measure. Right now I'm using serve()
> as a temporary hack to stand in for an external URI router that isn't
> present yet. Throwing a 404 without any helpful indication of the true
> cause of the exception simply confuses people and makes them wonder why the
> URI they're passing in is not being found when they can try it on the
> command line and see it work just fine. At minimum this exception should be
> more explicit.
>
>
> --
> Chief Systems Architect Proteus Technologies 
> Chief Fan Biggest Fan Productions 
> Personal blog where I am not your demographic
> .
>
> This email intended solely for those who have received it. If you have
> received this email by accident - well lucky you!!
>



-- 
Chief Systems Architect Proteus Technologies 
Chief Fan Biggest Fan Productions 
Personal blog where I am not your demographic
.

This email intended solely for those who have received it. If you have
received this email by accident - well lucky 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/CAHN%3D9D6-LRBp-rEB0AsVDqLWeRicHMKPuYRS09fxAR-LvZrNgg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Why I don't access the {{ user }} variable in template?

2015-03-23 Thread Fellipe Henrique
Hello,

I have this settings.py [1], and my CustomUser [2]

When I try to use in my template:

{{ user_first_name }}

don't show anything... What I miss in these code?

Regards,


[1] - https://gist.github.com/fellipeh/adbfaf06361d68650f95

[2] - https://gist.github.com/fellipeh/a0cc18f26aa9868a061f

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/CAF1jwZG2Qwk8n7TGT3ZcZv7FHtnm0MH7r34PkU92N0cBo1%3DgCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Misleading 404 exception during unit tests.

2015-03-23 Thread Tim Graham
Please see https://github.com/django/django/commit/4c6ffcf7 for the 
rationale for the change. I am open to ideas, but I'm concerned that 
including details about the reason for the 404 might cause information 
leakage in production which wouldn't be desirable.

On Monday, March 23, 2015 at 10:06:25 AM UTC-4, Ben Scherrey wrote:
>
> I see now that the behaviour of serve() was changed for 1.7 and it now 
> returns a silent misleading 404 result rather than the old 
> ImproperlyConfigured exception which would have provided a clue as to the 
> actual root cause.
>
> See: 
> https://docs.djangoproject.com/en/1.7/ref/contrib/staticfiles/#django.contrib.staticfiles.views.serve
>
> I don't understand the purpose of this change but it certainly sent me on 
> a wild goose chase trying to understand the 404 response. Would be VERY 
> useful if this 404 at least provided some information as to what it's 
> really all about - preferably with the above link embedded in it.
>
> Thanx to Rene Fleschenberg on irc for the doc link.
>
>
> On Mon, Mar 23, 2015 at 8:42 PM, Benjamin Scherrey  > wrote:
>
>> Can someone explain the test condition on line 31 of 
>> https://github.com/django/django/blob/master/django/contrib/staticfiles/views.py
>>  
>> - Just spent a few hours trying to get my unit tests to pass and couldn't 
>> figure out what was going on until I found this weirdness.
>>
>> I understand serve() isn't meant for production but, prior to having 
>> production ready it's nice to be able to unit test my code as it's being 
>> developed with serve() as a temporary measure. Right now I'm using serve() 
>> as a temporary hack to stand in for an external URI router that isn't 
>> present yet. Throwing a 404 without any helpful indication of the true 
>> cause of the exception simply confuses people and makes them wonder why the 
>> URI they're passing in is not being found when they can try it on the 
>> command line and see it work just fine. At minimum this exception should be 
>> more explicit.
>>
>>
>> -- 
>> Chief Systems Architect Proteus Technologies 
>> Chief Fan Biggest Fan Productions 
>> Personal blog where I am not your demographic 
>> .
>>
>> This email intended solely for those who have received it. If you have 
>> received this email by accident - well lucky you!!
>>  
>
>
>
> -- 
> Chief Systems Architect Proteus Technologies 
> Chief Fan Biggest Fan Productions 
> Personal blog where I am not your demographic 
> .
>
> This email intended solely for those who have received it. If you have 
> received this email by accident - well lucky 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/6b30729f-5a8f-47e2-81f3-d73c44b697e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why I don't access the {{ user }} variable in template?

2015-03-23 Thread aRkadeFR

Do you have 'django.contrib.auth.context_processors.auth' in
your context template processor?

{{ user_first_name }} won't work anyway cause the variable
set by the context_processor auth is user. To access a key
or an attribute of a variable, the syntax is:
{{ user.first_name }}

documentation on the django template language:
https://docs.djangoproject.com/en/1.7/ref/templates/api/

On 03/23/2015 03:15 PM, Fellipe Henrique wrote:

Hello,

I have this settings.py [1], and my CustomUser [2]

When I try to use in my template:

{{ user_first_name }}

don't show anything... What I miss in these code?

Regards,


[1] - https://gist.github.com/fellipeh/adbfaf06361d68650f95

[2] - https://gist.github.com/fellipeh/a0cc18f26aa9868a061f

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/CAF1jwZG2Qwk8n7TGT3ZcZv7FHtnm0MH7r34PkU92N0cBo1%3DgCw%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/5510214C.4020505%40arkade.info.
For more options, visit https://groups.google.com/d/optout.


Re: Why I don't access the {{ user }} variable in template?

2015-03-23 Thread Fellipe Henrique
Yes, I have django.contrib.auth.context_processors.auth in my Tamplate
processor: here is my template processor:

TEMPLATE_CONTEXT_PROCESSORS ('django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static', 'django.core.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request',
'core.context_processor.default_proc',
'social.apps.django_app.context_processors.backends',
'social.apps.django_app.context_processors.login_redirect')



sorry, in my template I use this:
   
{{ user.first_name }} {{ user.last_name }} 




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 Mon, Mar 23, 2015 at 11:21 AM, aRkadeFR  wrote:

>  Do you have 'django.contrib.auth.context_processors.auth' in
> your context template processor?
>
> {{ user_first_name }} won't work anyway cause the variable
> set by the context_processor auth is user. To access a key
> or an attribute of a variable, the syntax is:
> {{ user.first_name }}
>
> documentation on the django template language:
> https://docs.djangoproject.com/en/1.7/ref/templates/api/
>
>
> On 03/23/2015 03:15 PM, Fellipe Henrique wrote:
>
> Hello,
>
>  I have this settings.py [1], and my CustomUser [2]
>
>  When I try to use in my template:
>
>  {{ user_first_name }}
>
>  don't show anything... What I miss in these code?
>
>  Regards,
>
>
>  [1] - https://gist.github.com/fellipeh/adbfaf06361d68650f95
>
>  [2] - https://gist.github.com/fellipeh/a0cc18f26aa9868a061f
>
>   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/CAF1jwZG2Qwk8n7TGT3ZcZv7FHtnm0MH7r34PkU92N0cBo1%3DgCw%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/5510214C.4020505%40arkade.info
> 
> .
> 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/CAF1jwZFFkppQMXTxFMVhp_E8YANwwW0pAvsW7Yw%3Dp%3DXYAnTPWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Misleading 404 exception during unit tests.

2015-03-23 Thread Benjamin Scherrey
Hey Tim,

   Appreciate the link. It looks like we're trying to have it go both ways
here. If we don't want to allow it into production then make it explicit
and break it - just as before. If we want to recommend that it not go into
production but then let users actually do it, don't silently break it -
just let it work and buyer beware. Requiring --insecure is fine but without
it the explicit exception should be thrown I believe. In other words the
original behaviour seems correct to me.

   I think silently absorbing exceptions is more dangerous than just
outright breaking and exposing the root problem early. Many of the issues
with the ORM have been due to a misapplication of this policy. I get the
intent of the change but I'm not sure of the risk security-wise and have
just experienced the impact of the misleading exception result personally.

  -- Ben

On Mon, Mar 23, 2015 at 9:19 PM, Tim Graham  wrote:

> Please see https://github.com/django/django/commit/4c6ffcf7 for the
> rationale for the change. I am open to ideas, but I'm concerned that
> including details about the reason for the 404 might cause information
> leakage in production which wouldn't be desirable.
>
> On Monday, March 23, 2015 at 10:06:25 AM UTC-4, Ben Scherrey wrote:
>>
>> I see now that the behaviour of serve() was changed for 1.7 and it now
>> returns a silent misleading 404 result rather than the old
>> ImproperlyConfigured exception which would have provided a clue as to the
>> actual root cause.
>>
>> See: https://docs.djangoproject.com/en/1.7/ref/contrib/
>> staticfiles/#django.contrib.staticfiles.views.serve
>>
>> I don't understand the purpose of this change but it certainly sent me on
>> a wild goose chase trying to understand the 404 response. Would be VERY
>> useful if this 404 at least provided some information as to what it's
>> really all about - preferably with the above link embedded in it.
>>
>> Thanx to Rene Fleschenberg on irc for the doc link.
>>
>>
>> On Mon, Mar 23, 2015 at 8:42 PM, Benjamin Scherrey 
>> wrote:
>>
>>> Can someone explain the test condition on line 31 of
>>> https://github.com/django/django/blob/master/django/
>>> contrib/staticfiles/views.py - Just spent a few hours trying to get my
>>> unit tests to pass and couldn't figure out what was going on until I found
>>> this weirdness.
>>>
>>> I understand serve() isn't meant for production but, prior to having
>>> production ready it's nice to be able to unit test my code as it's being
>>> developed with serve() as a temporary measure. Right now I'm using serve()
>>> as a temporary hack to stand in for an external URI router that isn't
>>> present yet. Throwing a 404 without any helpful indication of the true
>>> cause of the exception simply confuses people and makes them wonder why the
>>> URI they're passing in is not being found when they can try it on the
>>> command line and see it work just fine. At minimum this exception should be
>>> more explicit.
>>>
>>>
>>> --
>>> Chief Systems Architect Proteus Technologies 
>>> Chief Fan Biggest Fan Productions 
>>> Personal blog where I am not your demographic
>>> .
>>>
>>> This email intended solely for those who have received it. If you have
>>> received this email by accident - well lucky you!!
>>>
>>
>>
>>
>> --
>> Chief Systems Architect Proteus Technologies 
>> Chief Fan Biggest Fan Productions 
>> Personal blog where I am not your demographic
>> .
>>
>> This email intended solely for those who have received it. If you have
>> received this email by accident - well lucky 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/6b30729f-5a8f-47e2-81f3-d73c44b697e1%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Chief Systems Architect Proteus Technologies 
Chief Fan Biggest Fan Productions 
Personal blog where I am not your demographic
.

This email intended solely for those who have received it. If you have
received this email by accident - well lucky 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...@goog

Re: templates tags works in scripts sections of the html?

2015-03-23 Thread Vijay Khemlani
JSON is literally the notation for objects and arrays in JavaScript, when
you "print" it it outputs valid JavaScript code.

On Mon, Mar 23, 2015 at 11:59 AM, dk  wrote:

> AHHH!!!...
> that make scenes  that the java script did work when I did it manually.
> I haven't use json files before, so I am not  sure how to manage that, I
> will look around for more information on that.
>
> On Friday, March 20, 2015 at 4:59:30 PM UTC-5, dk wrote:
>
>> I am trying to create an autocomplete tag with jquery UI
>> http://jqueryui.com/autocomplete/
>>
>>
>>
>> in my view I got a list of commands,   in the meant time I am just
>> testing it, so I have a list with ["a", "aaa", "b", "bbb"]
>> 
>>  $(function() {
>>  var avaibleTags = [
>>   {% for i in list_commands %}
>>   {{ i }}
>>   {% endfor %}
>>  ];
>>  $( "#tags" ).autocomplete({
>>   source: avaibleTags
>>  });
>> });
>> 
>>
>> but it doesn't work,   does the string replacement of the template tags
>> works on the script part ?  or I might be missing something?  thanks =)
>>
>  --
> 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/35a2f15f-a406-46b7-b0d4-8087af6c67dc%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/CALn3ei1EJe0xsWL7gYt%2BwW0gfvDbjvATSQrYQaXQREBL_jDaVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why I don't access the {{ user }} variable in template?

2015-03-23 Thread Daniel Roseman
On Monday, 23 March 2015 14:16:00 UTC, Fellipe Henrique wrote:
>
> Hello,
>
> I have this settings.py [1], and my CustomUser [2]
>
> When I try to use in my template:
>
> {{ user_first_name }} 
>
> don't show anything... What I miss in these code?
>
>  
You should show your view. Are you using a RequestContext? 
--
DR.

-- 
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/1e057e9f-8ee7-4c08-90f7-dfabd6e72818%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: templates tags works in scripts sections of the html?

2015-03-23 Thread dk
AHHH!!!...
that make scenes  that the java script did work when I did it manually.   I 
haven't use json files before, so I am not  sure how to manage that, I will 
look around for more information on that.

On Friday, March 20, 2015 at 4:59:30 PM UTC-5, dk wrote:

> I am trying to create an autocomplete tag with jquery UI
> http://jqueryui.com/autocomplete/
>
>
>
> in my view I got a list of commands,   in the meant time I am just testing 
> it, so I have a list with ["a", "aaa", "b", "bbb"]
> 
>  $(function() {
>  var avaibleTags = [
>   {% for i in list_commands %}
>   {{ i }}
>   {% endfor %}
>  ];
>  $( "#tags" ).autocomplete({
>   source: avaibleTags
>  });
> });
> 
>
> but it doesn't work,   does the string replacement of the template tags 
> works on the script part ?  or I might be missing something?  thanks =)
>

-- 
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/35a2f15f-a406-46b7-b0d4-8087af6c67dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to supply parameters to "python manage.py syncdb" from a script?

2015-03-23 Thread Dan Dong
Thanks Russell, that's clear now.

Cheers,
Dan


在 2015年3月20日星期五 UTC-5下午6:27:12,Russell Keith-Magee写道:
>
>
> On Sat, Mar 21, 2015 at 5:25 AM, Dan Dong 
> > wrote:
>
>> Hi,
>>   Does anybody know how to supply the input parameters to "python 
>> manage.py syncdb" from a script? E.g, to set the the followings parameters:
>>
>> Would you like to create one now? (yes/no): yes
>> Username (leave blank to use 'root'): 
>> Email address: x
>> Password: xx
>> Password (again): xx
>>
>> You don't - and that's by design.
>
> If you're putting a password into a script, then that script is in plain 
> text, and so is your password - so you've just lost your security.
>
> So - you don't pass input parameters to the script. You run the script 
> with the --noinput flag, which will prevent the script from prompting for 
> user input.
>
> If you want to have an initial user in your database after syncdb, put 
> that user's data in a fixture, and load the fixture as part of the script. 
> The fixture will contain the password in a hashed format, so the password 
> will be protected.
>
> Yours,
> Russ Magee %-)
>

-- 
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/e12b2f3a-05c5-4c33-bcfd-5c6a8c6c9d1c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Misleading 404 exception during unit tests.

2015-03-23 Thread Tim Graham
To have the decision revisited, you should raise it on django-developers.

On Monday, March 23, 2015 at 10:39:57 AM UTC-4, Ben Scherrey wrote:
>
> Hey Tim,
>
>Appreciate the link. It looks like we're trying to have it go both ways 
> here. If we don't want to allow it into production then make it explicit 
> and break it - just as before. If we want to recommend that it not go into 
> production but then let users actually do it, don't silently break it - 
> just let it work and buyer beware. Requiring --insecure is fine but without 
> it the explicit exception should be thrown I believe. In other words the 
> original behaviour seems correct to me.
>
>I think silently absorbing exceptions is more dangerous than just 
> outright breaking and exposing the root problem early. Many of the issues 
> with the ORM have been due to a misapplication of this policy. I get the 
> intent of the change but I'm not sure of the risk security-wise and have 
> just experienced the impact of the misleading exception result personally.
>
>   -- Ben
>
> On Mon, Mar 23, 2015 at 9:19 PM, Tim Graham  > wrote:
>
>> Please see https://github.com/django/django/commit/4c6ffcf7 for the 
>> rationale for the change. I am open to ideas, but I'm concerned that 
>> including details about the reason for the 404 might cause information 
>> leakage in production which wouldn't be desirable.
>>
>> On Monday, March 23, 2015 at 10:06:25 AM UTC-4, Ben Scherrey wrote:
>>>
>>> I see now that the behaviour of serve() was changed for 1.7 and it now 
>>> returns a silent misleading 404 result rather than the old 
>>> ImproperlyConfigured exception which would have provided a clue as to the 
>>> actual root cause.
>>>
>>> See: https://docs.djangoproject.com/en/1.7/ref/contrib/
>>> staticfiles/#django.contrib.staticfiles.views.serve
>>>
>>> I don't understand the purpose of this change but it certainly sent me 
>>> on a wild goose chase trying to understand the 404 response. Would be VERY 
>>> useful if this 404 at least provided some information as to what it's 
>>> really all about - preferably with the above link embedded in it.
>>>
>>> Thanx to Rene Fleschenberg on irc for the doc link.
>>>
>>>
>>> On Mon, Mar 23, 2015 at 8:42 PM, Benjamin Scherrey  
>>> wrote:
>>>
 Can someone explain the test condition on line 31 of 
 https://github.com/django/django/blob/master/django/
 contrib/staticfiles/views.py - Just spent a few hours trying to get my 
 unit tests to pass and couldn't figure out what was going on until I found 
 this weirdness.

 I understand serve() isn't meant for production but, prior to having 
 production ready it's nice to be able to unit test my code as it's being 
 developed with serve() as a temporary measure. Right now I'm using serve() 
 as a temporary hack to stand in for an external URI router that isn't 
 present yet. Throwing a 404 without any helpful indication of the true 
 cause of the exception simply confuses people and makes them wonder why 
 the 
 URI they're passing in is not being found when they can try it on the 
 command line and see it work just fine. At minimum this exception should 
 be 
 more explicit.


 -- 
 Chief Systems Architect Proteus Technologies 
 Chief Fan Biggest Fan Productions 
 Personal blog where I am not your demographic 
 .

 This email intended solely for those who have received it. If you have 
 received this email by accident - well lucky you!!
  
>>>
>>>
>>>
>>> -- 
>>> Chief Systems Architect Proteus Technologies 
>>> Chief Fan Biggest Fan Productions 
>>> Personal blog where I am not your demographic 
>>> .
>>>
>>> This email intended solely for those who have received it. If you have 
>>> received this email by accident - well lucky 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...@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/6b30729f-5a8f-47e2-81f3-d73c44b697e1%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Chief Systems Architect Proteus Technologies 
> Chief Fan Biggest Fan Productions 
> Personal blog where I am not your demographic 
> .
>
> This 

Re: Why I don't access the {{ user }} variable in template?

2015-03-23 Thread Fellipe Henrique
I found the problem, I was create a custom template context processor, and
for some reason I choose one name that override some function in one os 3rd
apps I'm using... I change the name of my custom context processor, and
works Fine!

Thanks again

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 Mon, Mar 23, 2015 at 12:07 PM, Daniel Roseman 
wrote:

> On Monday, 23 March 2015 14:16:00 UTC, Fellipe Henrique wrote:
>>
>> Hello,
>>
>> I have this settings.py [1], and my CustomUser [2]
>>
>> When I try to use in my template:
>>
>> {{ user_first_name }}
>>
>> don't show anything... What I miss in these code?
>>
>>
> You should show your view. Are you using a RequestContext?
> --
> DR.
>
> --
> 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/1e057e9f-8ee7-4c08-90f7-dfabd6e72818%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/CAF1jwZFEQ7AN-Nm%2Bur3oYkeS1ue%3D3YtBYn6Hr4aQGwoCOcPYXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Ho to "create" a field in a queryset to show in my template?

2015-03-23 Thread Fellipe Henrique
Hello,

I have these view:

def planos_view(request, cat_id=0):
if cat_id == '0':
categorias = Categoria.objects.filter(publicado=True)
else:
categorias = Categoria.objects.filter(publicado=True).filter(id=cat_id)

for c in categorias:
c.total = Plano.objects.filter(categoria=c).count()

return render_to_response('planos.html', locals(),
  context_instance=RequestContext(request))

I want to add the "total" field in my "categories" model.. What's the best
approach for these, because these code above don't work...

Thanks agains

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/CAF1jwZGvrVY2PG8YCgR3r4LS8URaR6-V2rP_EW3j9RJMpkVr3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Image in Form Field

2015-03-23 Thread Sandeep kaur
Anybody please help.

On Sun, Mar 22, 2015 at 3:07 PM, Sandeep kaur  wrote:

> Greetings,
> I want to have the thumnails of images with the names in the dropdown
> field of form. To return the image as foreign key field, I have used  this
> code :
> def __unicode__(self):
> image_data =
> open("/home/sandy/whats-fresh-api/media/images/download.jpg", "rb").read()
> return '%s' % (self.name) + HttpResponse(image_data,
> content_type="image/jpg")
>
> But it give following error :
> Exception Value:
>
> coercing to Unicode: need string or buffer, HttpResponse found
>
>
> Is it possible to do this ?
>
> Thanks.
>
> --
> Sandeep Kaur
> Blog: sandymadaan.wordpress.com
> SCM: https://github.com/sandeepmadaan
>
>
>
>


-- 
Sandeep Kaur
Blog: sandymadaan.wordpress.com
SCM: https://github.com/sandeepmadaan

-- 
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/CAF66xG00kpdSJqW-2D7W_HYR4e%3DVEeW3E81KMHBoU-OhDbUFNA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Ho to "create" a field in a queryset to show in my template?

2015-03-23 Thread Masklinn
Adding it as a regular property to your Categories class should work:

# inside Categoria
@property
def total(self):
return Plano.object.filter(categoria=self).count()

You may also want to use backward relationship links to simplify the
code and make it more robust, but I don't know how your models are
setup. If it's just an FK without an explicit related_name, should be 
something along the lines of:

@property
def total(self):
return self.plano_set.count()

On 2015-03-23, at 17:47 , Fellipe Henrique  wrote:

> Hello,
> 
> I have these view:
> 
> def planos_view(request, cat_id=0):
> if cat_id == '0':
> categorias = Categoria.objects.filter(publicado=True)
> else:
> categorias = 
> Categoria.objects.filter(publicado=True).filter(id=cat_id)
> 
> for c in categorias:
> c.total = Plano.objects.filter(categoria=c).count()
> 
> return render_to_response('planos.html', locals(),
>   context_instance=RequestContext(request))
> I want to add the "total" field in my "categories" model.. What's the best 
> approach for these, because these code above don't work...
> 
> Thanks agains 
> 
> 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/CAF1jwZGvrVY2PG8YCgR3r4LS8URaR6-V2rP_EW3j9RJMpkVr3A%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/9E3FEBC0-AC39-4051-A1EB-EC7D1A54C1BA%40masklinn.net.
For more options, visit https://groups.google.com/d/optout.


Re: Image in Form Field

2015-03-23 Thread Vijay Khemlani
You can't include images in the options of a typycal html dropdown

To do so you need to use JavaScript, for example this plugin

http://designwithpc.com/plugins/ddslick#demo

And pass the options in the format specified by the plugin

On Mon, Mar 23, 2015 at 1:51 PM, Sandeep kaur  wrote:

> Anybody please help.
>
> On Sun, Mar 22, 2015 at 3:07 PM, Sandeep kaur 
> wrote:
>
>> Greetings,
>> I want to have the thumnails of images with the names in the dropdown
>> field of form. To return the image as foreign key field, I have used  this
>> code :
>> def __unicode__(self):
>> image_data =
>> open("/home/sandy/whats-fresh-api/media/images/download.jpg", "rb").read()
>> return '%s' % (self.name) + HttpResponse(image_data,
>> content_type="image/jpg")
>>
>> But it give following error :
>> Exception Value:
>>
>> coercing to Unicode: need string or buffer, HttpResponse found
>>
>>
>> Is it possible to do this ?
>>
>> Thanks.
>>
>> --
>> Sandeep Kaur
>> Blog: sandymadaan.wordpress.com
>> SCM: https://github.com/sandeepmadaan
>>
>>
>>
>>
>
>
> --
> Sandeep Kaur
> Blog: sandymadaan.wordpress.com
> SCM: https://github.com/sandeepmadaan
>
>
>
>  --
> 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/CAF66xG00kpdSJqW-2D7W_HYR4e%3DVEeW3E81KMHBoU-OhDbUFNA%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/CALn3ei06ociqOZPdGgccgO%3Db6cwegvu02oat48kFcQj1O%2B_fvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Ho to "create" a field in a queryset to show in my template?

2015-03-23 Thread Fellipe Henrique
Ok,

But, if I want to create some "fields" in RunTime, I thinking to use Dict,
but I don't know what to use to create "temporary" queryset...

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/CAF1jwZFK5Qv%3Dumu7AVi2AY0C%2BrDc_34O88FGwcgAUJcvVOsrSw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to create a multi valued field in the model?

2015-03-23 Thread Daniel Grace
How to create a field with multiple values?  For example an integer field 
that takes on particular values:

state = models.IntegerField()

... where state=0 represents 'pending', state=1 represents 'accepted' and 
state=2 represents 'rejected'.
Is it possible to put these values / constants into the model?

-- 
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/0ffb0a31-d900-4b62-826b-b779bab472a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create a multi valued field in the model?

2015-03-23 Thread Vijay Khemlani
You can use an IntegerField with choices

https://docs.djangoproject.com/en/1.7/ref/models/fields/#choices

On Mon, Mar 23, 2015 at 4:28 PM, Daniel Grace  wrote:

> How to create a field with multiple values?  For example an integer field
> that takes on particular values:
>
> state = models.IntegerField()
>
> ... where state=0 represents 'pending', state=1 represents 'accepted' and
> state=2 represents 'rejected'.
> Is it possible to put these values / constants into the model?
>
> --
> 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/0ffb0a31-d900-4b62-826b-b779bab472a2%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/CALn3ei1X%2Bam5Mdwq6Upz_CCnEaea8XaZkKbEnpHL3MC25CrmJQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create a multi valued field in the model?

2015-03-23 Thread Filipe Ximenes
I'd also recommend using the "Choices" functionality of the Django Model
Utils project. It will give you good tools to keep the code readable,
simplify access and presentation of data:

https://django-model-utils.readthedocs.org/en/latest/utilities.html#choices

On Mon, Mar 23, 2015 at 4:34 PM, Vijay Khemlani  wrote:

> You can use an IntegerField with choices
>
> https://docs.djangoproject.com/en/1.7/ref/models/fields/#choices
>
> On Mon, Mar 23, 2015 at 4:28 PM, Daniel Grace  wrote:
>
>> How to create a field with multiple values?  For example an integer field
>> that takes on particular values:
>>
>> state = models.IntegerField()
>>
>> ... where state=0 represents 'pending', state=1 represents 'accepted' and
>> state=2 represents 'rejected'.
>> Is it possible to put these values / constants into the model?
>>
>> --
>> 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/0ffb0a31-d900-4b62-826b-b779bab472a2%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/CALn3ei1X%2Bam5Mdwq6Upz_CCnEaea8XaZkKbEnpHL3MC25CrmJQ%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 


*Filipe Ximenes*+55 (81) 8245-9204

*Vinta Software Studio*http://www.vinta.com.br

-- 
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/CAA-QWB3qK3Vex8%2Bzf2xFX%2BzRb9CMjfuoWaAU8uYMNk6umo4NxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


multiple parameters search

2015-03-23 Thread nobody
Hi,

How can I search the database using multiple parameters similar like "where 
username ="myUserName" or email = "MyEmail"? 

I tried to run User.object.get(username = myusername or email = myEmail), 
but that caused syntax error.

Thank you.

Kind regards,

 - -j

-- 
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/8e59ae31-579c-45d2-8490-6c64988c064a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: multiple parameters search

2015-03-23 Thread Vijay Khemlani
from django.db.models import Q

User.object.get(Q(username=myusername) | Q(email=myEmail))

On Mon, Mar 23, 2015 at 9:30 PM, nobody  wrote:

> Hi,
>
> How can I search the database using multiple parameters similar like
> "where username ="myUserName" or email = "MyEmail"?
>
> I tried to run User.object.get(username = myusername or email = myEmail),
> but that caused syntax error.
>
> Thank you.
>
> Kind regards,
>
>  - -j
>
> --
> 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/8e59ae31-579c-45d2-8490-6c64988c064a%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/CALn3ei3vVX4cEQ-evP9BhrGT99Fqoqu%2BvEB4hSyBHYWPbL-aQQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


ProgrammingError: relation "django_content_type" already exists

2015-03-23 Thread Mike Dewhirst
This is my first stab at upgrading directly from Django 1.6.11 to 1.81c 
to see what needs to be done. I thought I'd skip 1.7.x - is that a bad 
idea? Is there some step in 1.7.x which eases the path to 1.8.x?


On first starting the project up using runserver on localhost it advises:

Python:   3.4
Django:   1.8c1
Database: ssds.climate.com.au
Postgres: 9.1
16:18:54

Performing system checks...

System check identified no issues (0 silenced).

You have unapplied migrations; your app may not work properly until they
are applied.
Run 'python manage.py migrate' to apply them.

See below. Not sure where to go from here. Any ideas?

Thanks

Mike

On running manage.py migrate it returns a ProgrammingError as follows:

(xxex3) C:\Users\mike\env\xxex3\ssds>python manage.py migrate
Operations to perform:
  Synchronize unmigrated apps: admindocs, messages, credit, refer,
company, workplace, staticfiles, substance, common
  Apply all migrations: contenttypes, sessions, auth, sites, admin
Synchronizing apps without migrations:
  Creating tables...
Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying contenttypes.0001_initial...Traceback (most recent call last):
  File
"C:\Users\mike\env\xxex3\lib\site-packages\django\db\backends\utils.py",
line 62, in execute
return self.cursor.execute(sql)
psycopg2.ProgrammingError: relation "django_content_type" already exists


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 24, in 
execute_from_command_line(sys.argv)
  File
"C:\Users\mike\env\xxex3\lib\site-packages\django\core\management\__init__.py",
line 338, in execute_from_command_line
utility.execute()
  File
"C:\Users\mike\env\xxex3\lib\site-packages\django\core\management\__init__.py",
line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"C:\Users\mike\env\xxex3\lib\site-packages\django\core\management\base.py",
line 390, in run_from_argv
self.execute(*args, **cmd_options)
  File
"C:\Users\mike\env\xxex3\lib\site-packages\django\core\management\base.py",
line 441, in execute
output = self.handle(*args, **options)
  File
"C:\Users\mike\env\xxex3\lib\site-packages\django\core\management\commands\migrate.py",
line 221, in handle
executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File
"C:\Users\mike\env\xxex3\lib\site-packages\django\db\migrations\executor.py",
line 94, in migrate
self.apply_migration(states[migration], migration, fake=fake,
fake_initial=fake_initial)
  File
"C:\Users\mike\env\xxex3\lib\site-packages\django\db\migrations\executor.py",
line 131, in apply_migration
state = migration.apply(state, schema_editor)
  File
"C:\Users\mike\env\xxex3\lib\site-packages\django\db\migrations\migration.py",
line 111, in apply
operation.database_forwards(self.app_label, schema_editor,
old_state, project_state)

  File
"C:\Users\mike\env\xxex3\lib\site-packages\django\db\migrations\operations\models.py",
line 59, in database_forwards
schema_editor.create_model(model)
  File
"C:\Users\mike\env\xxex3\lib\site-packages\django\db\backends\base\schema.py",
line 282, in create_model
self.execute(sql, params or None)
  File
"C:\Users\mike\env\xxex3\lib\site-packages\django\db\backends\base\schema.py",
line 107, in execute
cursor.execute(sql, params)
  File
"C:\Users\mike\env\xxex3\lib\site-packages\django\db\backends\utils.py",
line 64, in execute
return self.cursor.execute(sql, params)
  File "C:\Users\mike\env\xxex3\lib\site-packages\django\db\utils.py",
line 97, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "C:\Users\mike\env\xxex3\lib\site-packages\django\utils\six.py",
line 658, in reraise
raise value.with_traceback(tb)
  File
"C:\Users\mike\env\xxex3\lib\site-packages\django\db\backends\utils.py",
line 62, in execute
return self.cursor.execute(sql)
django.db.utils.ProgrammingError: relation "django_content_type" already
exists

--
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/5510FD64.2040901%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.