Tuesday, September 30, 2014

Re: Which Version of Django

Thank you Tim Chase. 

On Tuesday, 30 September 2014 22:08:57 UTC+5, Tim Chase wrote:

I haven't seen any discussion of the deployment platform.  I would
also recommend 1.7 for green-field development, but I had to drop
down to 1.6 on one recent project because my deployment host only
offered python2.6 (well, and 2.4, but THAT was OLD) and Django 1.7
uses some 2.7 features.

-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+unsubscribe@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/330c1217-2ff9-48b1-abcb-189451a63588%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Custom User

use list_display:

https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display

Cheers
L.

On 1 October 2014 13:11, Sachin Tiwari <sachin.tiwari50@gmail.com> wrote:
> Ok sorry for incomplete description, I added a field phone number in user
> profile for eg when we click on add user button it will show username,
> password and in my case it will show phone number also but it will not be
> displayed after saving it.
>
> I add
>
> from django.contrib.auth.models import User
>
> class Employee(models.Model):
> user = models.OneToOneField(User)
> phone_no = models.IntegerField(max_length=10)
>
> This code in admin.py
>
> class EmployeeInline(admin.StackedInline):
> model = Employee
> can_delete = False
> verbose_name_plural = 'phon_no'
>
> # Define a new User admin
> class UserAdmin(UserAdmin):
> inlines = (EmployeeInline, )
>
> # Re-register UserAdmin
> admin.site.unregister(User)
> admin.site.register(User, UserAdmin)
>
> Now I want to show it with main users list page.
>
>
> On Tuesday, September 30, 2014 3:20:34 PM UTC+5:30, Sachin Tiwari wrote:
>>
>> Hi
>>
>> I want to display a phone number field at users list page,
>>
>> Username emailAddress FirstName LastName staffstatus PhoneNumber
>> sachin abc@g.com sachin tiwari True
>> 00000000000
>>
>>
>>
>>
> --
> 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+unsubscribe@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/b8afc4e7-9537-466b-9a2b-21047c2476bb%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
You have to be really clever to come up with a genuinely dangerous
thought. I am disheartened that people can be clever enough to do that
and not clever enough to do the obvious thing and KEEP THEIR IDIOT
MOUTHS SHUT about it, because it is much more important to sound
intelligent when talking to your friends.
This post was STUPID.
-----------------------------------------------------------------------------------------------------------
The Most Terrifying Thought Experiment of All Time
http://www.slate.com/articles/technology/bitwise/2014/07/roko_s_basilisk_the_most_terrifying_thought_experiment_of_all_time.html

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

Re: Custom User

Ok sorry for incomplete description, I added a field  phone number in user profile  for eg  when we click on add user button it will show username, password and in my case it will show phone number also  but it will not be displayed after saving it. 

I add 
from django.contrib.auth.models import User    class Employee(models.Model):      user = models.OneToOneField(User)      phone_no = models.IntegerField(max_length=10)
This code in admin.py
class EmployeeInline(admin.StackedInline):      model = Employee      can_delete = False      verbose_name_plural = 'phon_no'    # Define a new User admin  class UserAdmin(UserAdmin):      inlines = (EmployeeInline, )    # Re-register UserAdmin  admin.site.unregister(User)  admin.site.register(User, UserAdmin)
Now I want to show it with main users list page.


On Tuesday, September 30, 2014 3:20:34 PM UTC+5:30, Sachin Tiwari wrote:
Hi 

I want to display a phone number field at users list page,

Username  emailAddress  FirstName  LastName       staffstatus  PhoneNumber
sachin          abc@g.com     sachin        tiwari              True            00000000000




--
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+unsubscribe@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/b8afc4e7-9537-466b-9a2b-21047c2476bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Config: DB or git?

I've been checking out python-decouple and I have to say it's pretty easy, it replaces django-dotenv, django-getenv and django-autoenv for those working in a 12factorish way

2014-09-30 13:29 GMT-05:00 Arthur Alvim <arth.alvim@gmail.com>:
There's a really nice project called python-decouple. (https://github.com/henriquebastos/python-decouple/)

You can store you vars on .ini or .env files and ignore then on git.

Install

pip install python-decouple  

Usage

On your settings.py.

  1. Import the config object:

    from decouple import config  
  2. Retrieve the configuration parameters:

    SECRET_KEY = config('SECRET_KEY')  DEBUG = config('DEBUG', default=False, cast=bool)  EMAIL_HOST = config('EMAIL_HOST', default='localhost')  EMAIL_PORT = config('EMAIL_PORT', default=25, cast=int)
 


-- Atenciosamente
-  Arthur Alvim [ arth.alvim@gmail.com ]

IFPE - Tecnólogo em Análise e Desenvolvimento de Sistemas
UFPE CIn - Mestre em Ciência da Computação

"Partilha os teus conhecimentos. É a forma de conseguires a imortalidade."
Dalai Lama


2014-09-30 14:30 GMT-03:00 Vernon D. Cole <vernondcole@gmail.com>:
12-factor is all the rage, and they have some very good ideas that ought to be followed.  But insisting that environment variables are the only correct way of storing settings, is, well, just plain wrong. [ Note: I have 40 years of experience, I recognize a fad when I see it. ] All of those values have to get _into_ the environment variables somehow, and that means that somewhere there is a disk file which has them in it.  Is it really safer to have them written in some language other than Python so that you have to have a special program to read them?  I doubt it.

So my preference is to use a structured settings arrangement, where the file which is referenced by DJANGO_SETTINGS_MODULE imports settings.py (not vice-verso). 
That outside settings module, called salt_settings.py on my systems, is written by the SaltStack "state" which deploys my server.
The same "state" also creates the database, the nginx configulation, and the uWSGI configuration, so the same passwords, sockets, database names, etc, are used on both sides of an interface.
The sensitive data, such as passwords, are kept in a Salt Pillar structure, which is in a (highly protected) repo, separate from the salt "state" files, which are in a separate repo from the application.  Three purposes, three repos.

Why SaltStack and not one of the other configuration engines mentioned above?  Because Salt, like django, is written using a Python templating system.  You do not program your configuration in Ruby (Puppet and Chef) or Python (fabric), but lay it out in nice, readable, white-space sensitive YAML files, with Jinja templates where needed.
I have an over-simplified example at https://github.com/eHealthAfrica/salt_demo
--
Venon Cole


On Monday, September 29, 2014 2:05:37 PM UTC+1, guettli wrote:
Hi,

of course we separate data from code:

  - code belongs into version control (git)
  - data belongs into a database (postgres)

But where does configuration belong?

Since I am a developer I like version control.

But the longer I think about this question, I think
the perfect configuration for an app just contains
one entry: How to connect to the DB.

Sooner or later you want things to editable via an admin interface.

And if you look at big systems like SAP. There is only very little config in files.

I think config should be done in the database, not files. It is hard to accept
this, since version control is great for files, and not so good for databases,
but I think it is the way to go.

What do you think?

   Thomas



--
Thomas Güttler
http://thomas-guettler.de/

--
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+unsubscribe@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/f518e9ed-e22d-49d6-8f0f-5ef8981b6d88%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+unsubscribe@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/CANjJ3%3DMTW0euFcQiv3QPTV4oidHWay91uK7oviAU8_YF71CN4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
Jorge Andres Vergara Ebratt
#SoftwareDeveloper (Or at least trying to be)
@javebratt

--
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+unsubscribe@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/CAAeX05GKiL-kQsm7JFrE_68_JgHOpTx%3DP2UM48OdCJVt4JD%3D1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Config: DB or git?

There's a really nice project called python-decouple. (https://github.com/henriquebastos/python-decouple/)

You can store you vars on .ini or .env files and ignore then on git.

Install

pip install python-decouple  

Usage

On your settings.py.

  1. Import the config object:

    from decouple import config  
  2. Retrieve the configuration parameters:

    SECRET_KEY = config('SECRET_KEY')  DEBUG = config('DEBUG', default=False, cast=bool)  EMAIL_HOST = config('EMAIL_HOST', default='localhost')  EMAIL_PORT = config('EMAIL_PORT', default=25, cast=int)
 


-- Atenciosamente
-  Arthur Alvim [ arth.alvim@gmail.com ]

IFPE - Tecnólogo em Análise e Desenvolvimento de Sistemas
UFPE CIn - Mestre em Ciência da Computação

"Partilha os teus conhecimentos. É a forma de conseguires a imortalidade."
Dalai Lama


2014-09-30 14:30 GMT-03:00 Vernon D. Cole <vernondcole@gmail.com>:
12-factor is all the rage, and they have some very good ideas that ought to be followed.  But insisting that environment variables are the only correct way of storing settings, is, well, just plain wrong. [ Note: I have 40 years of experience, I recognize a fad when I see it. ] All of those values have to get _into_ the environment variables somehow, and that means that somewhere there is a disk file which has them in it.  Is it really safer to have them written in some language other than Python so that you have to have a special program to read them?  I doubt it.

So my preference is to use a structured settings arrangement, where the file which is referenced by DJANGO_SETTINGS_MODULE imports settings.py (not vice-verso). 
That outside settings module, called salt_settings.py on my systems, is written by the SaltStack "state" which deploys my server.
The same "state" also creates the database, the nginx configulation, and the uWSGI configuration, so the same passwords, sockets, database names, etc, are used on both sides of an interface.
The sensitive data, such as passwords, are kept in a Salt Pillar structure, which is in a (highly protected) repo, separate from the salt "state" files, which are in a separate repo from the application.  Three purposes, three repos.

Why SaltStack and not one of the other configuration engines mentioned above?  Because Salt, like django, is written using a Python templating system.  You do not program your configuration in Ruby (Puppet and Chef) or Python (fabric), but lay it out in nice, readable, white-space sensitive YAML files, with Jinja templates where needed.
I have an over-simplified example at https://github.com/eHealthAfrica/salt_demo
--
Venon Cole


On Monday, September 29, 2014 2:05:37 PM UTC+1, guettli wrote:
Hi,

of course we separate data from code:

  - code belongs into version control (git)
  - data belongs into a database (postgres)

But where does configuration belong?

Since I am a developer I like version control.

But the longer I think about this question, I think
the perfect configuration for an app just contains
one entry: How to connect to the DB.

Sooner or later you want things to editable via an admin interface.

And if you look at big systems like SAP. There is only very little config in files.

I think config should be done in the database, not files. It is hard to accept
this, since version control is great for files, and not so good for databases,
but I think it is the way to go.

What do you think?

   Thomas



--
Thomas Güttler
http://thomas-guettler.de/

--
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+unsubscribe@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/f518e9ed-e22d-49d6-8f0f-5ef8981b6d88%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+unsubscribe@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/CANjJ3%3DMTW0euFcQiv3QPTV4oidHWay91uK7oviAU8_YF71CN4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Config: DB or git?

12-factor is all the rage, and they have some very good ideas that ought to be followed.  But insisting that environment variables are the only correct way of storing settings, is, well, just plain wrong. [ Note: I have 40 years of experience, I recognize a fad when I see it. ] All of those values have to get _into_ the environment variables somehow, and that means that somewhere there is a disk file which has them in it.  Is it really safer to have them written in some language other than Python so that you have to have a special program to read them?  I doubt it.

So my preference is to use a structured settings arrangement, where the file which is referenced by DJANGO_SETTINGS_MODULE imports settings.py (not vice-verso). 
That outside settings module, called salt_settings.py on my systems, is written by the SaltStack "state" which deploys my server.
The same "state" also creates the database, the nginx configulation, and the uWSGI configuration, so the same passwords, sockets, database names, etc, are used on both sides of an interface.
The sensitive data, such as passwords, are kept in a Salt Pillar structure, which is in a (highly protected) repo, separate from the salt "state" files, which are in a separate repo from the application.  Three purposes, three repos.

Why SaltStack and not one of the other configuration engines mentioned above?  Because Salt, like django, is written using a Python templating system.  You do not program your configuration in Ruby (Puppet and Chef) or Python (fabric), but lay it out in nice, readable, white-space sensitive YAML files, with Jinja templates where needed.
I have an over-simplified example at https://github.com/eHealthAfrica/salt_demo
--
Venon Cole

On Monday, September 29, 2014 2:05:37 PM UTC+1, guettli wrote:
Hi,

of course we separate data from code:

  - code belongs into version control (git)
  - data belongs into a database (postgres)

But where does configuration belong?

Since I am a developer I like version control.

But the longer I think about this question, I think
the perfect configuration for an app just contains
one entry: How to connect to the DB.

Sooner or later you want things to editable via an admin interface.

And if you look at big systems like SAP. There is only very little config in files.

I think config should be done in the database, not files. It is hard to accept
this, since version control is great for files, and not so good for databases,
but I think it is the way to go.

What do you think?

   Thomas



--
Thomas Güttler
http://thomas-guettler.de/

--
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+unsubscribe@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/f518e9ed-e22d-49d6-8f0f-5ef8981b6d88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Which Version of Django

On 2014-09-30 09:28, Mark Caglienzi wrote:
> I agree with other advices to start with Django 1.7.
> Django is very stable and the new functionalities are always
> introduced in a very sane way.

I haven't seen any discussion of the deployment platform. I would
also recommend 1.7 for green-field development, but I had to drop
down to 1.6 on one recent project because my deployment host only
offered python2.6 (well, and 2.4, but THAT was OLD) and Django 1.7
uses some 2.7 features.

-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+unsubscribe@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/20140930121048.0028740c%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.

Re: Config: DB or git?

On Mon, Sep 29, 2014 at 2:15 PM, Alejandro Varas G.
<alej0varas@gmail.com> wrote:
> Hi Thomas,
>
> El 29/09/2014 10:05, "Thomas Güttler" <hv@tbz-pariv.de> escribió:
>>
>> Hi,
>>
>> of course we separate data from code:
>>
>> - code belongs into version control (git)
>> - data belongs into a database (postgres)
>>
>> But where does configuration belong?
>
> "To the environment"
>
> A good practice is to place config in the environment[0] and load it from
> code.
>
> 0 - http://12factor.net/config
>

I don't want to start a holy war, but I 100% disagree with putting
configuration in to the environment.

First of all, how does it get in the environment in the first place?
You must write a shell script that puts it in the environment. It may
not be a complex shell script; but it is a shell script.

A main part of maintaining a software project is managing
configuration changes. The best way of managing configuration changes
is store your configuration in a VCS in order to track changes.

So you add your shell script that configures your environment to a VCS¹.

Now your configuration is still "in code", but its not in "your code",
and now it's not even in the same language. About the only good thing
that is achieved is that the configuration is in a separate
repository, but that is orthogonal to sticking your DB credentials in
to the environment - you could do that with any configuration file.

Finally, the environment is a very public place to put things. The
environment is passed to any subprocesses you spawn, and included in
any debug emails. Django goes to some trouble to scrub passwords from
the settings it puts in debug emails; I don't see anything in the
Django docs about it scrubbing the environment..

Cheers

Tom

¹ Now, some wise-ass is going to come along and say "Oh no, thats not
what you do, you put the environment settings in to puppet/chef/etc".
You don't store your puppet configuration in VCS? *How* are you
managing change exactly?

--
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+unsubscribe@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/CAFHbX1L273fSEu1W84LXxmm0%2B_9WkQ0wjtWqrh4c9S0M-ufo-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Custom User

You aren't asking anything.

2014-09-30 11:44 GMT+01:00 Sachin Tiwari <sachin.tiwari50@gmail.com>:
Hi Tundebabzy,

Am I asking something wrong? please help me if possible.


On Tuesday, September 30, 2014 3:20:34 PM UTC+5:30, Sachin Tiwari wrote:
Hi 

I want to display a phone number field at users list page,

Username  emailAddress  FirstName  LastName       staffstatus  PhoneNumber
sachin          abc@g.com     sachin        tiwari              True            00000000000




--
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+unsubscribe@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/8acd0f1e-eb98-46fa-a6b0-3fd0dd7abb4c%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
monoBOT
Visite mi sitio(Visit my site): monobotsoft.es/blog/

--
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+unsubscribe@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/CA%2BxOsGBAbs8uqrVNbutFXvoeZytjp66eQMY-DJCqiBP2R5T8hg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Including JS/CSS in reusable widget library

The way django handles static media works very well for js/css files which are included
in the library.

But if you want to build in external js/css files it gets ugly.

For example nice django-selectable widget. Has a long documentation on how to
include jquery-ui:

http://django-selectable.readthedocs.org/en/latest/quick-start.html#including-jquery-jquery-ui

I came across this, because we use django-selectable in one project with success, but
it failed in an other. The reason was the missing jquery-ui js-files.

Ain't there a better solution for this?

Documentation like the above pages are good. But it is even better if there is
a common way how to handle this in the django world.


Thomas

--
Thomas Güttler
http://thomas-guettler.de/

--
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+unsubscribe@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/542AA3F1.7030403%40tbz-pariv.de.
For more options, visit https://groups.google.com/d/optout.

Re: Custom User

Your question is vague. You need to be specific about what you want to do. Let us see what you have tried and let us see the stack trace of any error.

Otherwise, your question seems like "hi, I want to build a car".

When you put in the details i can assure you that answers will start flying in.

On 30 Sep 2014 11:44, "Sachin Tiwari" <sachin.tiwari50@gmail.com> wrote:
Hi Tundebabzy,

Am I asking something wrong? please help me if possible.


On Tuesday, September 30, 2014 3:20:34 PM UTC+5:30, Sachin Tiwari wrote:
Hi 

I want to display a phone number field at users list page,

Username  emailAddress  FirstName  LastName       staffstatus  PhoneNumber
sachin          abc@g.com     sachin        tiwari              True            00000000000




--
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+unsubscribe@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/8acd0f1e-eb98-46fa-a6b0-3fd0dd7abb4c%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+unsubscribe@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/CA%2BWjgXNfFxNsJSrb2ro3RFRvvvbQkz6orJKdewgQ5R69mxVajw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Need example to implement sql (dictionary) translations

 Person.objects.raw('SELECT * FROM some_other_table', translations=name_map)
That does not work.

Printing out the results from above gives me the following.


<RawQuerySet: 'SELECT id,first_name AS first, last_name AS last FROM rango_person'>

How do I convert this into a sql result, and or a dictionary?

The row above 
On Monday, September 29, 2014 1:11:51 PM UTC-4, robert brook wrote:
From the django project web site, I am trying to implement the following code and have it spit out the dictionary form of the sql.

Does anyone have an example of how this is done.

The code below is from the project web page



When I execute the 2 lines below I retrieve the following
<RawQuerySet: 'SELECT first_name AS first, last_name AS last FROM person'>

Does anyone have an example so that  I can get this into a dictionary format so that I can send it back to the web page for consumption?

>>> name_map = {'first': 'first_name', 'last': 'last_name', 'bd': 'birth_date', 'pk': 'id'}  >>> Person.objects.raw('SELECT * FROM some_other_table', translations=name_map)

--
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+unsubscribe@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/2b6d8cd6-7c0b-41cd-bc95-e54837d6b732%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Custom User

Hi Tundebabzy,

Am I asking something wrong? please help me if possible.


On Tuesday, September 30, 2014 3:20:34 PM UTC+5:30, Sachin Tiwari wrote:
Hi 

I want to display a phone number field at users list page,

Username  emailAddress  FirstName  LastName       staffstatus  PhoneNumber
sachin          abc@g.com     sachin        tiwari              True            00000000000




--
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+unsubscribe@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/8acd0f1e-eb98-46fa-a6b0-3fd0dd7abb4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Which Version of Django

Thank James for the insight about LTS. 

As I am just learning Django and not yet working professionally. Hence I wanted to avoid any outdated version. However, I felt Django 1.4 is good. 

I may use Django 1.4 back after having checked 1.7. :)

Thanks again for your time and valuable opinion. 



On Tuesday, 30 September 2014 13:01:08 UTC+5, James Schneider wrote:
Not to throw a wrench in to this conversation, but it should be noted that Django 1.4 is considered the LTS (long term support) version, and is acceptable for production use if you do not need any of the fancy features in 1.7.

If you are looking at a small project and don't mind upgrading between version releases, or you have need for some new feature in the Django core, 1.7 would be the way to go. If you are looking at a large long standing project, I would consider 1.4 for stability and minimal required security updates. I don't believe that the next LTS version has been announced yet, so I suspect 1.4 will be supported for the next year or so at minimum.


The version of Python to use probably should follow similar guidelines (2.7 being well established while 3.X is the new version with enhancements). The version available on your servers by default will probably also help drive this decision unless you are comfortable installing the version you want (although both 2.7 and 3.X are generally both easily made available on moderately recent versions of the major OS'). Availability of needed libraries is also a key factor, but the major ones shouldn't be an issue.

-James

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@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/64b5c1d2-1446-47bd-a204-44562f278864%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Custom User

Hello Sachin,

On 30 Sep 2014 10:50, "Sachin Tiwari" <sachin.tiwari50@gmail.com> wrote:
>
> Hi 
>
> I want to display a phone number field at users list page,
>
> Username  emailAddress  FirstName  LastName       staffstatus  PhoneNumber
> sachin          abc@g.com     sachin        tiwari              True            00000000000

I don't mean to be rude but Is this a question?

--
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+unsubscribe@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/CA%2BWjgXNE1fMzh4mp1n1bbj14p-ma3vP%3DwgekvgiGS2VP6awbWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Which Version of Django

Thank you Mark! Especially for book link. :) 
 

I agree with other advices to start with Django 1.7.
Django is very stable and the new functionalities are always introduced
in a very sane way. Also the deprecations are done well, and the
documentation is one of the best I have ever seen for a framework.

If I can go a little further, I say that if you are a Django beginner,
you could follow a very good book:
Test-Driven Development with Python using Django, Selenium and
Javascript. The book's website is http://obeythetestinggoat.com/

Happy Django-ing! :-)

--
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+unsubscribe@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/5ac4dbb9-6a04-4f86-a562-6096c205102b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Which Version of Django

Thank you Andreas! 

I started learning Python 3x and later on I used 2.7, hence the minor differences will probably not create problem for me.

Anyways thanks for your guidelines. 



On Tuesday, 30 September 2014 12:35:05 UTC+5, Andréas Kühne wrote:
You should be aware that using python 3 will give you small problems regarding compability with several plugins for django. Python 3 is becoming more adopted, but it is not always easy to find plugins that do what you want in all situations. That being said, we have just rewritten our website in django 1.6 and python 3.4, just to adopt the latest. It is possible, but a bit harder. Also I find that I like the python 3 syntax better than python 2, but that's just me :-)

Regards,

Andréas

2014-09-30 8:27 GMT+02:00 Lachlan Musicman <dat...@gmail.com>:
As to Python, it depends on what is available to you and you feel
comfortable with.

Either python 2.7.x or 3.3 (or 3.4, which ever is newest) should be fine.

cheers
L.

On 30 September 2014 16:26, Lachlan Musicman <dat...@gmail.com> wrote:
> Muhammad,
>
> Yes 1.7 is considered stable and is the best place to start.
>
> Cheers
> L.
>
> On 30 September 2014 16:21, Muhammad Ahmed <pleasur...@gmail.com> wrote:
>> Hi,
>>
>> I am learning Django by using version 1.4 and I have completed first 4
>> introductory lessons.
>>
>> However, I see that newest Django version is 1.7 and I feel that I am using
>> an outdated version.
>>
>> Being a newbie, I would like to ask that should I move to version 1.7 and
>> which Django version is currently being used in "Professional Environments".
>>
>> Please guide which version (of both Python / Django) should I follow?
>>
>>
>> Regards,
>>
>>
>> Muhammad Ahmed
>>
>> --
>> 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/4cc3724d-d6d9-45f4-85d8-34df7d6ecc34%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> You have to be really clever to come up with a genuinely dangerous
> thought. I am disheartened that people can be clever enough to do that
> and not clever enough to do the obvious thing and KEEP THEIR IDIOT
> MOUTHS SHUT about it, because it is much more important to sound
> intelligent when talking to your friends.
> This post was STUPID.
> -----------------------------------------------------------------------------------------------------------
> The Most Terrifying Thought Experiment of All Time
> http://www.slate.com/articles/technology/bitwise/2014/07/roko_s_basilisk_the_most_terrifying_thought_experiment_of_all_time.html



--
You have to be really clever to come up with a genuinely dangerous
thought. I am disheartened that people can be clever enough to do that
and not clever enough to do the obvious thing and KEEP THEIR IDIOT
MOUTHS SHUT about it, because it is much more important to sound
intelligent when talking to your friends.
This post was STUPID.
-----------------------------------------------------------------------------------------------------------
The Most Terrifying Thought Experiment of All Time
http://www.slate.com/articles/technology/bitwise/2014/07/roko_s_basilisk_the_most_terrifying_thought_experiment_of_all_time.html

--
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/CAGBeqiML8y539vQ2TK%2Bwa71pFEPwBKPz5_cN5fUg39h2%2B3KCDw%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+unsubscribe@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/3c2ec3ab-6f93-43ac-995e-dcbf5efc9c83%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Custom User

Hi 

I want to display a phone number field at users list page,

Username  emailAddress  FirstName  LastName       staffstatus  PhoneNumber
sachin          abc@g.com     sachin        tiwari              True            00000000000




--
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+unsubscribe@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/6f661ac1-5125-449d-bb9d-870260ad6749%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Which Version of Django

Not to throw a wrench in to this conversation, but it should be noted that Django 1.4 is considered the LTS (long term support) version, and is acceptable for production use if you do not need any of the fancy features in 1.7.

If you are looking at a small project and don't mind upgrading between version releases, or you have need for some new feature in the Django core, 1.7 would be the way to go. If you are looking at a large long standing project, I would consider 1.4 for stability and minimal required security updates. I don't believe that the next LTS version has been announced yet, so I suspect 1.4 will be supported for the next year or so at minimum.


The version of Python to use probably should follow similar guidelines (2.7 being well established while 3.X is the new version with enhancements). The version available on your servers by default will probably also help drive this decision unless you are comfortable installing the version you want (although both 2.7 and 3.X are generally both easily made available on moderately recent versions of the major OS'). Availability of needed libraries is also a key factor, but the major ones shouldn't be an issue.

-James



On Tuesday, September 30, 2014, Andreas Kuhne <andreas.kuhne@suitopia.com> wrote:
You should be aware that using python 3 will give you small problems regarding compability with several plugins for django. Python 3 is becoming more adopted, but it is not always easy to find plugins that do what you want in all situations. That being said, we have just rewritten our website in django 1.6 and python 3.4, just to adopt the latest. It is possible, but a bit harder. Also I find that I like the python 3 syntax better than python 2, but that's just me :-)

Regards,

Andréas

2014-09-30 8:27 GMT+02:00 Lachlan Musicman <datakid@gmail.com>:
As to Python, it depends on what is available to you and you feel
comfortable with.

Either python 2.7.x or 3.3 (or 3.4, which ever is newest) should be fine.

cheers
L.

On 30 September 2014 16:26, Lachlan Musicman <datakid@gmail.com> wrote:
> Muhammad,
>
> Yes 1.7 is considered stable and is the best place to start.
>
> Cheers
> L.
>
> On 30 September 2014 16:21, Muhammad Ahmed <pleasureinblues@gmail.com> wrote:
>> Hi,
>>
>> I am learning Django by using version 1.4 and I have completed first 4
>> introductory lessons.
>>
>> However, I see that newest Django version is 1.7 and I feel that I am using
>> an outdated version.
>>
>> Being a newbie, I would like to ask that should I move to version 1.7 and
>> which Django version is currently being used in "Professional Environments".
>>
>> Please guide which version (of both Python / Django) should I follow?
>>
>>
>> Regards,
>>
>>
>> Muhammad Ahmed
>>
>> --
>> 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+unsubscribe@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/4cc3724d-d6d9-45f4-85d8-34df7d6ecc34%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> You have to be really clever to come up with a genuinely dangerous
> thought. I am disheartened that people can be clever enough to do that
> and not clever enough to do the obvious thing and KEEP THEIR IDIOT
> MOUTHS SHUT about it, because it is much more important to sound
> intelligent when talking to your friends.
> This post was STUPID.
> -----------------------------------------------------------------------------------------------------------
> The Most Terrifying Thought Experiment of All Time
> http://www.slate.com/articles/technology/bitwise/2014/07/roko_s_basilisk_the_most_terrifying_thought_experiment_of_all_time.html



--
You have to be really clever to come up with a genuinely dangerous
thought. I am disheartened that people can be clever enough to do that
and not clever enough to do the obvious thing and KEEP THEIR IDIOT
MOUTHS SHUT about it, because it is much more important to sound
intelligent when talking to your friends.
This post was STUPID.
-----------------------------------------------------------------------------------------------------------
The Most Terrifying Thought Experiment of All Time
http://www.slate.com/articles/technology/bitwise/2014/07/roko_s_basilisk_the_most_terrifying_thought_experiment_of_all_time.html

--
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+unsubscribe@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/CAGBeqiML8y539vQ2TK%2Bwa71pFEPwBKPz5_cN5fUg39h2%2B3KCDw%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+unsubscribe@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/CALXYUb%3DECRY%2B%2Bd77Z-fnGjbn%2BLMxKYHDQvf-LprBtD4eg8WgbQ%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+unsubscribe@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/CA%2Be%2BciUHXkig7CZVLHX5MqU-_Ws1%3DEkECTODtJgsKDjexadyWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Exceptions in signal handlers pass silently

I just discovered, that exceptions in signal handlers pass silently.

Is there a way to not silently ignore errors?

>>> import this


--
Thomas Güttler
http://thomas-guettler.de/

--
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+unsubscribe@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/542A6149.90309%40tbz-pariv.de.
For more options, visit https://groups.google.com/d/optout.

Re: Which Version of Django

You should be aware that using python 3 will give you small problems regarding compability with several plugins for django. Python 3 is becoming more adopted, but it is not always easy to find plugins that do what you want in all situations. That being said, we have just rewritten our website in django 1.6 and python 3.4, just to adopt the latest. It is possible, but a bit harder. Also I find that I like the python 3 syntax better than python 2, but that's just me :-)

Regards,

Andréas

2014-09-30 8:27 GMT+02:00 Lachlan Musicman <datakid@gmail.com>:
As to Python, it depends on what is available to you and you feel
comfortable with.

Either python 2.7.x or 3.3 (or 3.4, which ever is newest) should be fine.

cheers
L.

On 30 September 2014 16:26, Lachlan Musicman <datakid@gmail.com> wrote:
> Muhammad,
>
> Yes 1.7 is considered stable and is the best place to start.
>
> Cheers
> L.
>
> On 30 September 2014 16:21, Muhammad Ahmed <pleasureinblues@gmail.com> wrote:
>> Hi,
>>
>> I am learning Django by using version 1.4 and I have completed first 4
>> introductory lessons.
>>
>> However, I see that newest Django version is 1.7 and I feel that I am using
>> an outdated version.
>>
>> Being a newbie, I would like to ask that should I move to version 1.7 and
>> which Django version is currently being used in "Professional Environments".
>>
>> Please guide which version (of both Python / Django) should I follow?
>>
>>
>> Regards,
>>
>>
>> Muhammad Ahmed
>>
>> --
>> 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+unsubscribe@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/4cc3724d-d6d9-45f4-85d8-34df7d6ecc34%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> You have to be really clever to come up with a genuinely dangerous
> thought. I am disheartened that people can be clever enough to do that
> and not clever enough to do the obvious thing and KEEP THEIR IDIOT
> MOUTHS SHUT about it, because it is much more important to sound
> intelligent when talking to your friends.
> This post was STUPID.
> -----------------------------------------------------------------------------------------------------------
> The Most Terrifying Thought Experiment of All Time
> http://www.slate.com/articles/technology/bitwise/2014/07/roko_s_basilisk_the_most_terrifying_thought_experiment_of_all_time.html



--
You have to be really clever to come up with a genuinely dangerous
thought. I am disheartened that people can be clever enough to do that
and not clever enough to do the obvious thing and KEEP THEIR IDIOT
MOUTHS SHUT about it, because it is much more important to sound
intelligent when talking to your friends.
This post was STUPID.
-----------------------------------------------------------------------------------------------------------
The Most Terrifying Thought Experiment of All Time
http://www.slate.com/articles/technology/bitwise/2014/07/roko_s_basilisk_the_most_terrifying_thought_experiment_of_all_time.html

--
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+unsubscribe@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/CAGBeqiML8y539vQ2TK%2Bwa71pFEPwBKPz5_cN5fUg39h2%2B3KCDw%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+unsubscribe@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/CALXYUb%3DECRY%2B%2Bd77Z-fnGjbn%2BLMxKYHDQvf-LprBtD4eg8WgbQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.