Re: Graceful Reloading for Schema Changes - UWSGI - Gunicorn?

2015-04-16 Thread Roberto De Ioris

>
>
> Hello Djangonats,
>
> How do you reload Django script changes with UWSGI? I know `touch-reload
> `
> exists with UWSGI however I was looking more into what uwsgi does when the
> schema(s) in the models change? How do you handle database changes without
> affecting or rebooting the server? Rebooting UWSGI does not sound like a
> good idea.
>
> A Load Balancer (HAProxy) ?
>
> *More Questions*
>
> Does something like that exist in Gunicorn?
>
> Regards,
>
> Shapath.
>
>

The topic is huge and there are dozens of approaches, but basically every
WSGI server requires a new (updated) process address space after code
change
(included schema changes if the model is already loaded into memory).

So, even if it may look "extreme", reloading the whole WSGI server is the
only reliable solution (in fact used by everyone).

If you are scared about potential downtimes check this article:

http://uwsgi-docs.readthedocs.org/en/latest/articles/TheArtOfGracefulReloading.html

But take in account that 99% of the times/cases a simple graceful reload
is more than enough.


-- 
Roberto De Ioris
http://unbit.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c444f30b5e1e079782ec3d8b21caaf5b.squirrel%40manage.unbit.it.
For more options, visit https://groups.google.com/d/optout.


Django 1.8 data migrations not able to locate related collections

2015-04-16 Thread A Lee
Hello,

After upgrading to 1.8 from 1.7.7 our tests are now unable to create test 
data via data migrations and complain about related collections not 
existing as attributes for some but not all models (exception stack trace 
at https://travis-ci.org/virtualcommons/vcweb). It appears to succeed at 
creating a model object for the first related collection but then dies when 
attempting to create objects in the second related collection 
(https://github.com/virtualcommons/vcweb/blob/develop/vcweb/experiment/forestry/migrations/0001_initial_forestry.py#L62).
 

Any ideas on what might be causing this? Access to related collections 
through the django shell and via the web interface still seem to be working 
fine on 1.8, it's just the data migrations that are failing.

-- 
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/953aa2e6-9a41-4b56-b551-76babd94488c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How should I develop a web site and mobile apps(iOS/Android) as Facebook(using DRF + Angularjs)?

2015-04-16 Thread Filipe Ximenes
Yes, you can develop a website were some data is processed and presented in
the template by the backend, and some is fetched using AJAX
(Javascript/Angular) from the frontend.

I do not know a specific tutorial to point you, but from a quick search,
this one seems to cover a lot of things:
https://thinkster.io/django-angularjs-tutorial/

On Thu, Apr 16, 2015 at 5:03 PM, 백병화  wrote:

>
>>
> Thank you very much for the professional advice :)
>
> I have more questions..
>
> Is there a way to develop a web site by combining MPA and SPA ?
>
> And..
>
> Can you please recommend a tutorial of django+angularjs that is about
> configuration, building structure, and etc for dividing backend and
> frontend ?
>
>>   --
> 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/61b3252f-679e-4918-9309-4811a6001102%40googlegroups.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-QWB3uqiMy6qWxZRbgKwk92dMT%3DL003tYqPVSgycnezpK44w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How should I develop a web site and mobile apps(iOS/Android) as Facebook(using DRF + Angularjs)?

2015-04-16 Thread 백병화

>
>
>  
Thank you very much for the professional advice :)

I have more questions..

Is there a way to develop a web site by combining MPA and SPA ? 

And..

Can you please recommend a tutorial of django+angularjs that is about 
configuration, building structure, and etc for dividing backend and 
frontend ?

>  

-- 
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/61b3252f-679e-4918-9309-4811a6001102%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: treemenus treemenu or sitetree

2015-04-16 Thread felix

El 16/04/15 15:27, Joris Benschop escribió:

Hi List

I'm currently using django-treemenus to show a site menu, but now that 
Im migrating to 1.8, Im getting imcompatibility bugs. What modules do 
you use to display link menus in your site? I found sitetree and 
treemenu but they are not mentioned at all on this forum.


thanks!


I use Twitter Bootstrap. I don't know wheter it fits your needs.
Cheers.

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


Re: How should I develop a web site and mobile apps(iOS/Android) as Facebook(using DRF + Angularjs)?

2015-04-16 Thread Filipe Ximenes
1) The Facebook WEBSITE is a MPA, but some of it's content is loaded via
ajax (like the newsfeed). The Facebook mobile app is a native application.
The Android one is developed in Java, and the iOS is developed in Objectve-C

2) If you use a cross-paltform framework like Cordova you will be
programming in HTML/CSS and Javascript. The framework will handle the
generation of the apps for each platform from your javascript code.
HTML/CSS will define how the app looks and Javascript will handle fetching
data from the server and presenting it on the app. AngularJS is a
Javascript framework that give you some nice tools, but you are free to
chose between using it or not.

3) There's no such a thing as "the best cross-platform to fit DRF". The
backend (Django/DRF) will handle storing and processing data, and the
mobile app will fetch data from the backend and show it to the user. The
platform you will use and the backend are separated things and do not
interfere within each other.
About using native or cross-platform, I expressed MY OPNION in the second
email of the last message:
https://groups.google.com/forum/#!topic/django-users/B8v9wjR4-M0
But this is a polemic subject, other people may have different opinions
about it.

On Thu, Apr 16, 2015 at 4:12 PM, 백병화  wrote:

> Thank you very much for replying my question.
> I'm a student in Korea, so my english grammar is not good. I'm sorry for
> that.
>
> I'm wondering to create a web site as Facebook.
>
> I have 3 questions.
>
> 1) Is facebook developed as SPA? or Is it developed as SPA+MPA ?
>
> 2) Last time, I understood as when I use DRF with Angularjs, it is not
> needed to make front-end for Android/iOS. Did I misunderstand about it ?
>
> 3) If I need to develop front-end for iOS/Android, I'm curious what
> cross-platform is the best to fit DRF. Also I'm curious whether the
> cross-platform is good when it is compared to Native Apps.
>
> Thank you for replying!
>
> --
> 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/cb9633d6-5571-45c1-91c0-a1118faf7e26%40googlegroups.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-QWB1P4GNcUL5txKUAGGjAtY17uC-Xdb0nzF7onoHa3E%2BRcA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


treemenus treemenu or sitetree

2015-04-16 Thread Joris Benschop
Hi List

I'm currently using django-treemenus to show a site menu, but now that Im 
migrating to 1.8, Im getting imcompatibility bugs. What modules do you use 
to display link menus in your site? I found sitetree and treemenu but they 
are not mentioned at all on this forum.

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/62b7b907--4fd4-9337-257ba199f1ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How should I develop a web site and mobile apps(iOS/Android) as Facebook(using DRF + Angularjs)?

2015-04-16 Thread 백병화
Thank you very much for replying my question.
I'm a student in Korea, so my english grammar is not good. I'm sorry for
that.

I'm wondering to create a web site as Facebook.

I have 3 questions.

1) Is facebook developed as SPA? or Is it developed as SPA+MPA ?

2) Last time, I understood as when I use DRF with Angularjs, it is not
needed to make front-end for Android/iOS. Did I misunderstand about it ?

3) If I need to develop front-end for iOS/Android, I'm curious what
cross-platform is the best to fit DRF. Also I'm curious whether the
cross-platform is good when it is compared to Native Apps.

Thank you for replying!

2015-04-17 3:51 GMT+09:00 Filipe Ximenes :

> Hi,
>
> I think I partially answered this to you in your previous question:
> https://groups.google.com/forum/#!topic/django-users/B8v9wjR4-M0
> Can you tell me if you didn't understand something?
>
> Mobile and AngularJS apps don't work exactly the same as a normal web
> page. While in a normal web page, the frontend (what the user sees) is
> processed in the backend (django) and sent to the user, in a Mobile or
> AngularJS app, the frontend is already in the user device and it only
> fetches the data to fill in the frontend.
> The default Django behaviour is to work with "normal web pages", but when
> you use Django REST Framework it makes it easy to develop APIs and return
> JSON data (JSON is one of the most popular data formats).
>
> Now, normal iOS apps are build in Objective-C, normal Android apps are
> developed in Java. But it's possible to built both iOS and Android apps
> using Javascript, some of the frameworks that do this are:
> Cordova/Phonegap, Titanium and Ionic (witch is AngularJS compatible).
>
> There are lots of tutorials in the interned for all this technologies.
> This is pretty much the basics of how this works. Feel free to ask more
> specific questions if you need more detailed response.
>
>
>
> On Thu, Apr 16, 2015 at 1:25 PM, 백병화  wrote:
>
>> I want to develop a web site and mobile apps(iOS/Android) as Facebook.by
>> using Django REST Framework AND Angularjs.
>> I'm confused about what steps should I follow..
>>
>>  --
>> 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/f26fe122-e66f-4760-ad2c-9a74e60d5238%40googlegroups.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 a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/sxQQPGwH2KQ/unsubscribe.
> To unsubscribe from this group and all its topics, 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-QWB3K%3D9vwXVvrHSOezO7yN7MZ1fbrgeq2R3pQdsmpr1BTxA%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/CAJbMFOTy4c6v1txwpFtqx0-rvwVwhQJUQj6osGrQJfYjbQ3KTA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How should I develop a web site and mobile apps(iOS/Android) as Facebook(using DRF + Angularjs)?

2015-04-16 Thread 백병화


Thank you very much for replying my question.
I'm a student in Korea, so my english grammar is not good. I'm sorry for 
that. 

I'm wondering to create a web site as Facebook.

I have 3 questions.

1) Is facebook developed as SPA? or Is it developed as SPA+MPA ?

2) Last time, I understood as when I use DRF with Angularjs, it is not 
needed to make front-end for Android/iOS. Did I misunderstand about it ?

3) If I need to develop front-end for iOS/Android, I'm curious what 
cross-platform is the best to fit DRF. Also I'm curious whether the 
cross-platform is good when it is compared to Native Apps.

Thank you for replying!

-- 
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/cb9633d6-5571-45c1-91c0-a1118faf7e26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How should I develop a web site and mobile apps(iOS/Android) as Facebook(using DRF + Angularjs)?

2015-04-16 Thread Filipe Ximenes
Hi,

I think I partially answered this to you in your previous question:
https://groups.google.com/forum/#!topic/django-users/B8v9wjR4-M0
Can you tell me if you didn't understand something?

Mobile and AngularJS apps don't work exactly the same as a normal web page.
While in a normal web page, the frontend (what the user sees) is processed
in the backend (django) and sent to the user, in a Mobile or AngularJS app,
the frontend is already in the user device and it only fetches the data to
fill in the frontend.
The default Django behaviour is to work with "normal web pages", but when
you use Django REST Framework it makes it easy to develop APIs and return
JSON data (JSON is one of the most popular data formats).

Now, normal iOS apps are build in Objective-C, normal Android apps are
developed in Java. But it's possible to built both iOS and Android apps
using Javascript, some of the frameworks that do this are:
Cordova/Phonegap, Titanium and Ionic (witch is AngularJS compatible).

There are lots of tutorials in the interned for all this technologies.
This is pretty much the basics of how this works. Feel free to ask more
specific questions if you need more detailed response.



On Thu, Apr 16, 2015 at 1:25 PM, 백병화  wrote:

> I want to develop a web site and mobile apps(iOS/Android) as Facebook.by
> using Django REST Framework AND Angularjs.
> I'm confused about what steps should I follow..
>
>  --
> 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/f26fe122-e66f-4760-ad2c-9a74e60d5238%40googlegroups.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-QWB3K%3D9vwXVvrHSOezO7yN7MZ1fbrgeq2R3pQdsmpr1BTxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Can you please suggest a way to make multi page apps and single page apps with django and angularjs ?

2015-04-16 Thread 백병화
I'm a student in Korea, so my english grammar is not good. I'm sorry for 
that. 
I'm confused about how to make an architecture for combining multi page and 
single page with django and angularjs..
Can you please suggest a way?



-- 
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/dc31f370-0136-4228-904a-513a8f1894f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: annotate() questions

2015-04-16 Thread Ramiro Morales
On Wed, Apr 8, 2015 at 3:07 PM, Carsten Fuchs  wrote:

> Dear Django fellows,
>
> at https://docs.djangoproject.com/en/1.8/topics/db/aggregation/#joins-and-
> aggregates the first example is:
>
> >>> from django.db.models import Max, Min
> >>> Store.objects.annotate(min_price=Min('books__price'),
> max_price=Max('books__price'))
>
> which will annotate each Store object in the QuerySet with the minimum and
> maximum prices that its books have.
>
> [...]
>
>   2) Can this annotation be filtered? For example, if for each Store we
> wanted to learn the min and max prices of books published in 2014, can this
> be done?
>

I can help with this one. In fact you cant combine annotations with
filters. See

https://docs.djangoproject.com/en/1.8/topics/db/aggregation/#aggregations-and-other-queryset-clauses

"...When used with an annotate() clause, a filter has the effect of
constraining the objects for which an annotation is calculated. For
example..."

e.g.::


Store.objects.filter(books__pubdate__year=2014).annotate(min_2014_price=Min('books__price'),
max_2014_price=Max('books__price'))

HTH

-- 
Ramiro Morales
@ramiromorales

-- 
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/CAO7PdF8iqNxUpk%2B8-J3H%3D4JPDU6GUBZxdW_M6kOUb0K-8a3DRA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: form detail view using generic view

2015-04-16 Thread Filipe Ximenes
Hi Pradeep,

when data is saved, you want to show it in the form or as "view-only"?
If it is a form you need, Use a CreateView, and the redirect it to a
UpdateView. Otherwise, do a CreateView and redirect to a TemplateView.

CreateView ->
https://docs.djangoproject.com/en/1.8/ref/class-based-views/generic-editing/#django.views.generic.edit.CreateView
UpdateView ->
https://docs.djangoproject.com/en/1.8/ref/class-based-views/generic-editing/#django.views.generic.edit.UpdateView
TemplateView ->
https://docs.djangoproject.com/en/1.8/ref/class-based-views/base/#templateview

On Thu, Apr 16, 2015 at 11:22 AM, Pradeep gopi 
wrote:

> iam new to django.  i want to develop a web page with a form with some
> data to enter after saving the data in the database the data must be shown
> on the same page from where it has been submitted
>
> --
> 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/25de8b0d-a833-4b70-bd71-21cb3f7858ae%40googlegroups.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-QWB0-Piu9GZFGh27WLs24-9LMuN9mCJoGwyhYMgQt6XTY0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: annotate() questions

2015-04-16 Thread Carsten Fuchs

Hello,

Am 08.04.2015 um 20:07 schrieb Carsten Fuchs:

   1) Is there a way to annotate each Store object with the actual Book objects 
related
to the minimum and maximum prices?

   2) Can this annotation be filtered? For example, if for each Store we wanted 
to learn
the min and max prices of books published in 2014, can this be done?



Anyone please?

Best regards,
Carsten

--
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/552FEC57.3020904%40cafu.de.
For more options, visit https://groups.google.com/d/optout.


Re: Graceful Reloading for Schema Changes - UWSGI - Gunicorn?

2015-04-16 Thread Stephen J. Butler
I'm not familiar with uWSGI. On gunicorn you send it SIGHUP (kill -HUP
pid) and it will reload w/o interrupting requests. Looks like uWSGI
supports something similar:

https://uwsgi-docs.readthedocs.org/en/latest/Management.html#signals-for-controlling-uwsgi

On Thu, Apr 16, 2015 at 11:32 AM, Shapath Neupane
 wrote:
> Hello Djangonats,
>
> How do you reload Django script changes with UWSGI? I know `touch-reload`
> exists with UWSGI however I was looking more into what uwsgi does when the
> schema(s) in the models change? How do you handle database changes without
> affecting or rebooting the server? Rebooting UWSGI does not sound like a
> good idea.
>
> A Load Balancer (HAProxy) ?
>
> More Questions
>
> Does something like that exist in Gunicorn?
>
> Regards,
>
> Shapath.
>
> --
> 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/3a98ec4e-d9e2-4bb7-8783-cd97ac7a8acb%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/CAD4ANxWUg%2BXFdpw7S6we%2BDfNfev9SDsDonfXEsh96_mTU2w3kw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Userena 'OrderedDict' object has no attribute 'keyOrder'

2015-04-16 Thread willyhakim
Thank you guys.

On Wednesday, April 15, 2015 at 5:41:47 PM UTC-5, willyhakim wrote:
>
> Hi everyone,
> I am using django-userena and extend the form class to add some of my own 
> fields. I followed
> the demo and still get the above error. Anyone know what I am doing wrong?
>
> class SignupFormExtra(SignupForm):
> """ 
> A form to demonstrate how to add extra fields to the signup form, in 
> this
> case adding the first and last name.
> 
> """
> first_name = forms.CharField(label=_(u'First name'),
>  max_length=30,
>  required=True)
>
> last_name = forms.CharField(label=_(u'Last name'),
> max_length=30,
> required=False)
> industry = forms.CharField(label=_(u'Industry'),
> max_length=50,
> required=False)
> title = forms.CharField(label=_(u'title'),
> max_length=50,
> required=False)
>
> def __init__(self, *args, **kw):
> """
> 
> A bit of hackery to get the first name and last name at the top of 
> the
> form instead at the end.
> 
> """
> super(SignupFormExtra, self).__init__(*args, **kw)
> # Put the first and last name at the top
> new_order = self.fields.keyOrder[-2]
> new_order.insert(0, 'first_name')
> new_order.insert(1, 'last_name')
> new_order.insert(2, 'industry')
> new_order.insert(3, 'title')
> self.fields.keyOrder = new_order
>
> def save(self):
> """ 
> Override the save method to save the first and last name to the 
> user
> field.
> """
> # First save the parent form and get the user.
> new_user = super(SignupFormExtra, self).save()
>
> new_user.first_name = self.cleaned_data['first_name']
> new_user.last_name = self.cleaned_data['last_name']
> new_user.industry = self.cleaned_data['industry']
> new_user.title = self.cleaned_data['title']
> new_user.save()
>
> # Userena expects to get the new user from this form, so return 
> the new
> # user.
> return new_user
>

-- 
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/506fcb1f-4a16-45c4-b4a8-c3d7598585ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Graceful Reloading for Schema Changes - UWSGI - Gunicorn?

2015-04-16 Thread Shapath Neupane
 

Hello Djangonats,

How do you reload Django script changes with UWSGI? I know `touch-reload 
` 
exists with UWSGI however I was looking more into what uwsgi does when the 
schema(s) in the models change? How do you handle database changes without 
affecting or rebooting the server? Rebooting UWSGI does not sound like a 
good idea.

A Load Balancer (HAProxy) ?

*More Questions*

Does something like that exist in Gunicorn?

Regards,

Shapath.

-- 
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/3a98ec4e-d9e2-4bb7-8783-cd97ac7a8acb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How should I develop a web site and mobile apps(iOS/Android) as Facebook(using DRF + Angularjs)?

2015-04-16 Thread 백병화
I want to develop a web site and mobile apps(iOS/Android) as Facebook.by 
using Django REST Framework AND Angularjs.
I'm confused about what steps should I follow..

-- 
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/f26fe122-e66f-4760-ad2c-9a74e60d5238%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Custom lookup running different SQL query than it's displaying in str(query)

2015-04-16 Thread d33tah
(This is basically a copy of http://stackoverflow.com/q/29680060/1091116 - 
I hope that this is allowed here)

Consider the following `urls.py` - for brevity, I decided to put the 
example in one file:

from django.conf.urls import patterns, include, url

from django.http import HttpResponse
from django.db import models

def x(request):
class A(models.Model):
title = models.CharField(max_length=1024)
class RightAnchored(models.Lookup):
lookup_name = 'rightanchored'

def as_sql(self, compiler, connection):
lhs, lhs_params = self.process_lhs(compiler, connection)
rhs, rhs_params = self.process_rhs(compiler, connection)
params = lhs_params + rhs_params
return "REVERSE(%s) LIKE REVERSE(%s)" % (lhs, rhs), params

models.CharField.register_lookup(RightAnchored)
q = A.objects.filter(title__rightanchored='%b')
return HttpResponse(str(q.query))

urlpatterns = patterns('',
url(r'^$', x),
)

For some reason, visiting http://localhost:8000 gives me: `SELECT 
"w_a"."id", "w_a"."title" FROM "w_a" WHERE REVERSE("w_a"."title") LIKE 
REVERSE(%b)`, while running the command would result in `SELECT "w_a"."id", 
"w_a"."title" FROM "w_a" WHERE REVERSE("w_a"."title") LIKE REVERSE('%b')` 
(note the extra `''` inside `LIKE REVERSE`). This means that the displayed 
query is different  than one that is being run. How can I make my Lookup 
behave properly when `str(q.query)` is called?

-- 
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/72bdf52f-723e-4c5a-aeb3-f9824f615fb4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Queryset/order_by option sort keys string manipulation

2015-04-16 Thread Henry Versemann
I have a string of sort keys which I've generated dynamically using the 
name of the table (model) that I'm trying to retrieve elements from, while 
putting them in a pre-determined sort order. The original sort key string 
looks like this:

domain_code,request_url,request_description,id,request_method,response_type

Then I do some string manipulation of the "sort_keys" string object to 
produce this second version of the string:


'domain_code','request_url','request_description','id','request_method','response_type'

to be used for the "sort_keys" of the Queryset "order_by" option. 

I'm coding the Queryset with the "order_by" option like this:

tblEntryLst = table_class.objects.order_by(sort_keys)

which fails with a django.core.exceptions.FieldError.
But if I code it the exact same way and hard-code the "sort_keys" like this:

tblEntryLst = 
table_class.objects.order_by('domain_code','request_url','request_description','id','request_method','response_type')

Then everything works. 

I'm thinking the reason it fails in the first instance is because the 
sort_keys object is maybe being evaluated before the Queryset command is 
actually run and so at that point the "sort_keys" are no longer in the 
proper comma-separated string object format to work within the confines of 
the command. 

And in the second case the Queryset command does work because the sort-keys 
aren't evaluated before the command is actually run.

I hope this makes sense, and would appreciate any help in getting this to 
work without having to resort to hard-coding my sort keys, instead of using 
the dynamic ones.

Thanks for the help.

Henry


-- 
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/d5721e7f-9525-428c-a4cc-d76d5577189c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django, JavaScript, Python, HTML : Print on html a variable running on python file

2015-04-16 Thread Beatrice Galvani
Hi, I'm using Django 1.7.2, Python 3.4.

My trouble is: I have a simple function in some directory written in python 
(e.g. a counter since 0 to 10); I would like to see these numbers on my 
monitor on the HTML page.. I know how start the function but I am not able 
to print the variables!  

My formatted question is *HERE on Stack Overflow 
.*


I hope someone can help me , I do not know how to proceed.

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/9a528aa3-85bb-45ff-80ce-e9e78d4cce1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


form detail view using generic view

2015-04-16 Thread Pradeep gopi
iam new to django.  i want to develop a web page with a form with some data 
to enter after saving the data in the database the data must be shown on 
the same page from where it has been submitted

-- 
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/25de8b0d-a833-4b70-bd71-21cb3f7858ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Admin should really support Twitter Bootsrap

2015-04-16 Thread Scot Hacker


On Monday, April 13, 2015 at 3:16:40 PM UTC-7, Patrick Lemiuex wrote:
>
> It's about time, the django admin tool should support twitter bootstrap 
> markups and styling. This is the third django project where I've had to 
> deal with custom form widgets because the admin tool supports kind of an 
> outdated layout scheme in the admin template.
>
> This also affects a lot of third party apps as well. It would be something 
> worth contributing to the community by me.
>

Have a look at this thread on the django-developers mailing list - a lot of 
work is going into the appearance of the admin right now:

https://groups.google.com/forum/#!topic/django-developers/HJAikaEBqJ4 

./s

-- 
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/fc5c8a93-8fb2-4296-a9ed-2c0fdf2310c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Userena 'OrderedDict' object has no attribute 'keyOrder'

2015-04-16 Thread Pavel Kuchin
Yeah, sorry:)

2015-04-16 16:04 GMT+03:00 Vijay Khemlani :
> Why are you talking to me? I'm not OP xD
>
> On Thu, Apr 16, 2015 at 9:57 AM, Pavel Kuchin 
> wrote:
>>
>> Hi Vijay,
>>
>> Looks like Django does not use SortedDict anymore
>>
>> (https://github.com/django/django/commit/07876cf02b6db453ca0397c29c225668872fa96d#django/forms/forms.py)
>> The self.fields.keyOrder does not work anymore, django-userena has an
>> obsolete documentation.
>> Try to remove def __init__(self, *args, **kw): from your class,
>> ordering should be based on fields definition order.
>>
>> Best regards,
>> Pavel
>>
>> 2015-04-16 15:31 GMT+03:00 Vijay Khemlani :
>> > In the title: "'OrderedDict' object has no attribute 'keyOrder'"
>> >
>> > On Thu, Apr 16, 2015 at 6:13 AM, Pavel Kuchin 
>> > wrote:
>> >>
>> >> Hi Willy,
>> >>
>> >> Can you send an error, because I see only the SignupFormExtra class.
>> >>
>> >> Yours sincerely,
>> >> Pavel
>> >>
>> >> четверг, 16 апреля 2015 г., 1:41:47 UTC+3 пользователь willyhakim
>> >> написал:
>> >>>
>> >>> Hi everyone,
>> >>> I am using django-userena and extend the form class to add some of my
>> >>> own
>> >>> fields. I followed
>> >>> the demo and still get the above error. Anyone know what I am doing
>> >>> wrong?
>> >>>
>> >>> class SignupFormExtra(SignupForm):
>> >>> """
>> >>> A form to demonstrate how to add extra fields to the signup form,
>> >>> in
>> >>> this
>> >>> case adding the first and last name.
>> >>>
>> >>> """
>> >>> first_name = forms.CharField(label=_(u'First name'),
>> >>>  max_length=30,
>> >>>  required=True)
>> >>>
>> >>> last_name = forms.CharField(label=_(u'Last name'),
>> >>> max_length=30,
>> >>> required=False)
>> >>> industry = forms.CharField(label=_(u'Industry'),
>> >>> max_length=50,
>> >>> required=False)
>> >>> title = forms.CharField(label=_(u'title'),
>> >>> max_length=50,
>> >>> required=False)
>> >>>
>> >>> def __init__(self, *args, **kw):
>> >>> """
>> >>>
>> >>> A bit of hackery to get the first name and last name at the
>> >>> top
>> >>> of the
>> >>> form instead at the end.
>> >>>
>> >>> """
>> >>> super(SignupFormExtra, self).__init__(*args, **kw)
>> >>> # Put the first and last name at the top
>> >>> new_order = self.fields.keyOrder[-2]
>> >>> new_order.insert(0, 'first_name')
>> >>> new_order.insert(1, 'last_name')
>> >>> new_order.insert(2, 'industry')
>> >>> new_order.insert(3, 'title')
>> >>> self.fields.keyOrder = new_order
>> >>>
>> >>> def save(self):
>> >>> """
>> >>> Override the save method to save the first and last name to
>> >>> the
>> >>> user
>> >>> field.
>> >>> """
>> >>> # First save the parent form and get the user.
>> >>> new_user = super(SignupFormExtra, self).save()
>> >>>
>> >>> new_user.first_name = self.cleaned_data['first_name']
>> >>> new_user.last_name = self.cleaned_data['last_name']
>> >>> new_user.industry = self.cleaned_data['industry']
>> >>> new_user.title = self.cleaned_data['title']
>> >>> new_user.save()
>> >>>
>> >>> # Userena expects to get the new user from this form, so
>> >>> return
>> >>> the new
>> >>> # user.
>> >>> return new_user
>> >>
>> >> --
>> >> 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/a4c2a9d4-b9f2-43bc-b7bc-537e9e17c88b%40googlegroups.com.
>> >>
>> >> For more options, visit https://groups.google.com/d/optout.
>> >
>> >
>> > --
>> > You received this message because you are subscribed to a topic in the
>> > Google Groups "Django users" group.
>> > To unsubscribe from this topic, visit
>> > https://groups.google.com/d/topic/django-users/5HxEahhNuSo/unsubscribe.
>> > To unsubscribe from this group and all its topics, 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
>> >
>> > 

Re: Django Userena 'OrderedDict' object has no attribute 'keyOrder'

2015-04-16 Thread Vijay Khemlani
Why are you talking to me? I'm not OP xD

On Thu, Apr 16, 2015 at 9:57 AM, Pavel Kuchin 
wrote:

> Hi Vijay,
>
> Looks like Django does not use SortedDict anymore
> (
> https://github.com/django/django/commit/07876cf02b6db453ca0397c29c225668872fa96d#django/forms/forms.py
> )
> The self.fields.keyOrder does not work anymore, django-userena has an
> obsolete documentation.
> Try to remove def __init__(self, *args, **kw): from your class,
> ordering should be based on fields definition order.
>
> Best regards,
> Pavel
>
> 2015-04-16 15:31 GMT+03:00 Vijay Khemlani :
> > In the title: "'OrderedDict' object has no attribute 'keyOrder'"
> >
> > On Thu, Apr 16, 2015 at 6:13 AM, Pavel Kuchin 
> > wrote:
> >>
> >> Hi Willy,
> >>
> >> Can you send an error, because I see only the SignupFormExtra class.
> >>
> >> Yours sincerely,
> >> Pavel
> >>
> >> четверг, 16 апреля 2015 г., 1:41:47 UTC+3 пользователь willyhakim
> написал:
> >>>
> >>> Hi everyone,
> >>> I am using django-userena and extend the form class to add some of my
> own
> >>> fields. I followed
> >>> the demo and still get the above error. Anyone know what I am doing
> >>> wrong?
> >>>
> >>> class SignupFormExtra(SignupForm):
> >>> """
> >>> A form to demonstrate how to add extra fields to the signup form,
> in
> >>> this
> >>> case adding the first and last name.
> >>>
> >>> """
> >>> first_name = forms.CharField(label=_(u'First name'),
> >>>  max_length=30,
> >>>  required=True)
> >>>
> >>> last_name = forms.CharField(label=_(u'Last name'),
> >>> max_length=30,
> >>> required=False)
> >>> industry = forms.CharField(label=_(u'Industry'),
> >>> max_length=50,
> >>> required=False)
> >>> title = forms.CharField(label=_(u'title'),
> >>> max_length=50,
> >>> required=False)
> >>>
> >>> def __init__(self, *args, **kw):
> >>> """
> >>>
> >>> A bit of hackery to get the first name and last name at the top
> >>> of the
> >>> form instead at the end.
> >>>
> >>> """
> >>> super(SignupFormExtra, self).__init__(*args, **kw)
> >>> # Put the first and last name at the top
> >>> new_order = self.fields.keyOrder[-2]
> >>> new_order.insert(0, 'first_name')
> >>> new_order.insert(1, 'last_name')
> >>> new_order.insert(2, 'industry')
> >>> new_order.insert(3, 'title')
> >>> self.fields.keyOrder = new_order
> >>>
> >>> def save(self):
> >>> """
> >>> Override the save method to save the first and last name to the
> >>> user
> >>> field.
> >>> """
> >>> # First save the parent form and get the user.
> >>> new_user = super(SignupFormExtra, self).save()
> >>>
> >>> new_user.first_name = self.cleaned_data['first_name']
> >>> new_user.last_name = self.cleaned_data['last_name']
> >>> new_user.industry = self.cleaned_data['industry']
> >>> new_user.title = self.cleaned_data['title']
> >>> new_user.save()
> >>>
> >>> # Userena expects to get the new user from this form, so return
> >>> the new
> >>> # user.
> >>> return new_user
> >>
> >> --
> >> 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/a4c2a9d4-b9f2-43bc-b7bc-537e9e17c88b%40googlegroups.com
> .
> >>
> >> For more options, visit https://groups.google.com/d/optout.
> >
> >
> > --
> > You received this message because you are subscribed to a topic in the
> > Google Groups "Django users" group.
> > To unsubscribe from this topic, visit
> > https://groups.google.com/d/topic/django-users/5HxEahhNuSo/unsubscribe.
> > To unsubscribe from this group and all its topics, 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/CALn3ei0YPZWLO7wZH7sxw98xQ_vLxpARBUmUUz0-eR8sXkiUjQ%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 

Re: Django Userena 'OrderedDict' object has no attribute 'keyOrder'

2015-04-16 Thread Pavel Kuchin
Hi Vijay,

Looks like Django does not use SortedDict anymore
(https://github.com/django/django/commit/07876cf02b6db453ca0397c29c225668872fa96d#django/forms/forms.py)
The self.fields.keyOrder does not work anymore, django-userena has an
obsolete documentation.
Try to remove def __init__(self, *args, **kw): from your class,
ordering should be based on fields definition order.

Best regards,
Pavel

2015-04-16 15:31 GMT+03:00 Vijay Khemlani :
> In the title: "'OrderedDict' object has no attribute 'keyOrder'"
>
> On Thu, Apr 16, 2015 at 6:13 AM, Pavel Kuchin 
> wrote:
>>
>> Hi Willy,
>>
>> Can you send an error, because I see only the SignupFormExtra class.
>>
>> Yours sincerely,
>> Pavel
>>
>> четверг, 16 апреля 2015 г., 1:41:47 UTC+3 пользователь willyhakim написал:
>>>
>>> Hi everyone,
>>> I am using django-userena and extend the form class to add some of my own
>>> fields. I followed
>>> the demo and still get the above error. Anyone know what I am doing
>>> wrong?
>>>
>>> class SignupFormExtra(SignupForm):
>>> """
>>> A form to demonstrate how to add extra fields to the signup form, in
>>> this
>>> case adding the first and last name.
>>>
>>> """
>>> first_name = forms.CharField(label=_(u'First name'),
>>>  max_length=30,
>>>  required=True)
>>>
>>> last_name = forms.CharField(label=_(u'Last name'),
>>> max_length=30,
>>> required=False)
>>> industry = forms.CharField(label=_(u'Industry'),
>>> max_length=50,
>>> required=False)
>>> title = forms.CharField(label=_(u'title'),
>>> max_length=50,
>>> required=False)
>>>
>>> def __init__(self, *args, **kw):
>>> """
>>>
>>> A bit of hackery to get the first name and last name at the top
>>> of the
>>> form instead at the end.
>>>
>>> """
>>> super(SignupFormExtra, self).__init__(*args, **kw)
>>> # Put the first and last name at the top
>>> new_order = self.fields.keyOrder[-2]
>>> new_order.insert(0, 'first_name')
>>> new_order.insert(1, 'last_name')
>>> new_order.insert(2, 'industry')
>>> new_order.insert(3, 'title')
>>> self.fields.keyOrder = new_order
>>>
>>> def save(self):
>>> """
>>> Override the save method to save the first and last name to the
>>> user
>>> field.
>>> """
>>> # First save the parent form and get the user.
>>> new_user = super(SignupFormExtra, self).save()
>>>
>>> new_user.first_name = self.cleaned_data['first_name']
>>> new_user.last_name = self.cleaned_data['last_name']
>>> new_user.industry = self.cleaned_data['industry']
>>> new_user.title = self.cleaned_data['title']
>>> new_user.save()
>>>
>>> # Userena expects to get the new user from this form, so return
>>> the new
>>> # user.
>>> return new_user
>>
>> --
>> 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/a4c2a9d4-b9f2-43bc-b7bc-537e9e17c88b%40googlegroups.com.
>>
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/5HxEahhNuSo/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CALn3ei0YPZWLO7wZH7sxw98xQ_vLxpARBUmUUz0-eR8sXkiUjQ%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 

Re: Django Userena 'OrderedDict' object has no attribute 'keyOrder'

2015-04-16 Thread Vijay Khemlani
In the title: "'OrderedDict' object has no attribute 'keyOrder'"

On Thu, Apr 16, 2015 at 6:13 AM, Pavel Kuchin 
wrote:

> Hi Willy,
>
> Can you send an error, because I see only the SignupFormExtra class.
>
> Yours sincerely,
> Pavel
>
> четверг, 16 апреля 2015 г., 1:41:47 UTC+3 пользователь willyhakim написал:
>
>> Hi everyone,
>> I am using django-userena and extend the form class to add some of my own
>> fields. I followed
>> the demo and still get the above error. Anyone know what I am doing wrong?
>>
>> class SignupFormExtra(SignupForm):
>> """
>> A form to demonstrate how to add extra fields to the signup form, in
>> this
>> case adding the first and last name.
>>
>> """
>> first_name = forms.CharField(label=_(u'First name'),
>>  max_length=30,
>>  required=True)
>>
>> last_name = forms.CharField(label=_(u'Last name'),
>> max_length=30,
>> required=False)
>> industry = forms.CharField(label=_(u'Industry'),
>> max_length=50,
>> required=False)
>> title = forms.CharField(label=_(u'title'),
>> max_length=50,
>> required=False)
>>
>> def __init__(self, *args, **kw):
>> """
>>
>> A bit of hackery to get the first name and last name at the top
>> of the
>> form instead at the end.
>>
>> """
>> super(SignupFormExtra, self).__init__(*args, **kw)
>> # Put the first and last name at the top
>> new_order = self.fields.keyOrder[-2]
>> new_order.insert(0, 'first_name')
>> new_order.insert(1, 'last_name')
>> new_order.insert(2, 'industry')
>> new_order.insert(3, 'title')
>> self.fields.keyOrder = new_order
>>
>> def save(self):
>> """
>> Override the save method to save the first and last name to the
>> user
>> field.
>> """
>> # First save the parent form and get the user.
>> new_user = super(SignupFormExtra, self).save()
>>
>> new_user.first_name = self.cleaned_data['first_name']
>> new_user.last_name = self.cleaned_data['last_name']
>> new_user.industry = self.cleaned_data['industry']
>> new_user.title = self.cleaned_data['title']
>> new_user.save()
>>
>> # Userena expects to get the new user from this form, so return
>> the new
>> # user.
>> return new_user
>>
>  --
> 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/a4c2a9d4-b9f2-43bc-b7bc-537e9e17c88b%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/CALn3ei0YPZWLO7wZH7sxw98xQ_vLxpARBUmUUz0-eR8sXkiUjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Transform all Django exceptions to JSON?

2015-04-16 Thread jack
Hello, 

I use django rest framework to make API server. DRF catches some Django 
exceptions and transforms them in JSON. However some exceptions, like 404, 
are still returned as Django pages (at least it works that way on my 
machine). How can I wrap all exceptions in JSON from any library? I'm 
working on mobile app and I can't debug html dumps from Django in console 
:( 

Am I missing something important?

-- 
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/d40d4630-e01b-4416-83bd-16a20ac1c161%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django keep variable in memory, even if i refresh the page

2015-04-16 Thread Silvio Benvegnù
But I need to do it:

**ok I try to explain better my situation**:

- I've got a class that is a "javascript repository". Its role is to 
respond with a string of javascript functions.  
Javascript functions are organized in indipendent modules (list of 
functions), so I can attach to my page just needed functions.  
Different modules can share same functions.
- In my view I specify the url of a function (it is in the same view), 
get_js_code, whose rule is to return javascript code (with: `return 
HttpResponse(code,content_type="application/x-javascript")` )
- get_js_code initiate that "javascript repository class", asking one or 
more modules (list of functions), and my class returns functions just one 
time, even if a function belongs to more than one module.  
- in my template I specify get_js_code url as a javascript resource, and 
javascript code is downloaded with the page from Django

It works well _BUT_:

- a module is needed from every app, so I specify in a Middleware an url 
that brings to another app/function that initiate that class in order to 
attach as javascript resource the common javascript module.

**Here is the problem**:

- my "javascript repository class" has a list that contains returned 
javascript functions list in order to return a function just one time. It 
works well but just one time: infact if I reload the page the list does not 
expire and no javascript funtions are returned.

Very hard to explain, I hope its clear now.

PS: I was wrong, I don't initiate the class inside a Middleware.

PPS: I know that is unusual to put javascript code inside Python code, but 
I'm testing this solution.


Il giorno giovedì 16 aprile 2015 12:36:39 UTC+2, Avraham Serour ha scritto:
>
> you are instantiating the variable on class definition, try doing on 
> function execution instead
>
> On Thu, Apr 16, 2015 at 12:43 PM, Silvio Benvegnù  > wrote:
>
>> I'm using Django Framework 1.7 with its webserver.
>>
>> I have a custom class where I declare a static variable, a list, where I 
>> append some values:
>>
>> class my_class:
>>
>> list = [] 
>>
>> def __init__( self, *args, **kwargs ): 
>> [...]
>>
>> def append_value(self,value):
>> self.list.append( value )
>>
>> I use a static variable because I call this function different times. 
>> During a single page load my class works well but I noticed that 
>> my_class.list never expire.
>>
>> To reset the list I have to restart the webserver.
>>
>> I come from PHP and Perl where every time you refresh a page all yor 
>> variables are cleared if you don't save them in some way.
>>
>> I use session, sure, but I don't save that list into session, at least 
>> not voluntarily.
>>
>> NOTE: I don't know, during script execution, the first or the last time I 
>> call my_class().
>>
>> How can I reset the list every time I reload/change page?
>>
>>  -- 
>> 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/f7f81ae7-8c33-49e8-8781-86c4c5cd2edb%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/7e80cb8e-55dc-4123-9839-ee692ce340c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django keep variable in memory, even if i refresh the page

2015-04-16 Thread Avraham Serour
you are instantiating the variable on class definition, try doing on
function execution instead

On Thu, Apr 16, 2015 at 12:43 PM, Silvio Benvegnù 
wrote:

> I'm using Django Framework 1.7 with its webserver.
>
> I have a custom class where I declare a static variable, a list, where I
> append some values:
>
> class my_class:
>
> list = []
>
> def __init__( self, *args, **kwargs ):
> [...]
>
> def append_value(self,value):
> self.list.append( value )
>
> I use a static variable because I call this function different times.
> During a single page load my class works well but I noticed that
> my_class.list never expire.
>
> To reset the list I have to restart the webserver.
>
> I come from PHP and Perl where every time you refresh a page all yor
> variables are cleared if you don't save them in some way.
>
> I use session, sure, but I don't save that list into session, at least not
> voluntarily.
>
> NOTE: I don't know, during script execution, the first or the last time I
> call my_class().
>
> How can I reset the list every time I reload/change page?
>
>  --
> 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/f7f81ae7-8c33-49e8-8781-86c4c5cd2edb%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/CAFWa6tJEim8p58amRV_wu1qWkGq8cTRiCzpoGp8wQBbZo2-ZYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Checking for foreign key in clean method - Django 1.77 vs 1.8

2015-04-16 Thread Graham Oliver
Hi guys 
I have some code in a clean() method that works ok on Django 1.77 but stops 
working in 1.8 

The scenario 

class Span(models.Model): 

happening = models.ForeignKey('Happening', blank = True, null = True) 
soul_class = models.ForeignKey('SoulClass', blank = True, null = True) 


In the clean() method of the Span class I have a check as follows 
if self.happening: 
foo 

if self.soul_class: 
bar 

This was working fine in Django up to 1.77 but when I upgrade to Django 1.8 
both self.happening **and** self.soul_class are None. 

The primary difference appears to be the value of _soul_class_cache as 
follows. 

The Span object in 1.77 looks like 
{'end_date': None, 'id': None, '_state': , 'start_date': datetime.date(2015, 4, 16), 
'soul_class_id': None, 'end_time': datetime.time(14, 12), 'happening_id': 
None, '_happening_cache': None, 'start_time': datetime.time(14, 12), 
'_soul_class_cache': } 

In 1.8 
{'start_time': datetime.time(14, 0), 'end_date': None, 'soul_class_id': 
None, '_state': , 'happening_id': None, '_happening_cache': None, 
'_soul_class_cache': None, 'end_time': datetime.time(15, 0), 'id': None, 
'start_date': datetime.date(2015, 4, 16)} 

Any ideas? 
Cheers 
g 

-- 
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/602df646-9328-496d-b35b-1a0e2c5aaaee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django keep variable in memory, even if i refresh the page

2015-04-16 Thread Silvio Benvegnù


I'm using Django Framework 1.7 with its webserver.

I have a custom class where I declare a static variable, a list, where I 
append some values:

class my_class:

list = [] 

def __init__( self, *args, **kwargs ): 
[...]

def append_value(self,value):
self.list.append( value )

I use a static variable because I call this function different times. 
During a single page load my class works well but I noticed that 
my_class.list never expire.

To reset the list I have to restart the webserver.

I come from PHP and Perl where every time you refresh a page all yor 
variables are cleared if you don't save them in some way.

I use session, sure, but I don't save that list into session, at least not 
voluntarily.

NOTE: I don't know, during script execution, the first or the last time I 
call my_class().

How can I reset the list every time I reload/change page?

-- 
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/f7f81ae7-8c33-49e8-8781-86c4c5cd2edb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Userena 'OrderedDict' object has no attribute 'keyOrder'

2015-04-16 Thread Pavel Kuchin
Hi Willy, 

Can you send an error, because I see only the SignupFormExtra class.

Yours sincerely,
Pavel

четверг, 16 апреля 2015 г., 1:41:47 UTC+3 пользователь willyhakim написал:
>
> Hi everyone,
> I am using django-userena and extend the form class to add some of my own 
> fields. I followed
> the demo and still get the above error. Anyone know what I am doing wrong?
>
> class SignupFormExtra(SignupForm):
> """ 
> A form to demonstrate how to add extra fields to the signup form, in 
> this
> case adding the first and last name.
> 
> """
> first_name = forms.CharField(label=_(u'First name'),
>  max_length=30,
>  required=True)
>
> last_name = forms.CharField(label=_(u'Last name'),
> max_length=30,
> required=False)
> industry = forms.CharField(label=_(u'Industry'),
> max_length=50,
> required=False)
> title = forms.CharField(label=_(u'title'),
> max_length=50,
> required=False)
>
> def __init__(self, *args, **kw):
> """
> 
> A bit of hackery to get the first name and last name at the top of 
> the
> form instead at the end.
> 
> """
> super(SignupFormExtra, self).__init__(*args, **kw)
> # Put the first and last name at the top
> new_order = self.fields.keyOrder[-2]
> new_order.insert(0, 'first_name')
> new_order.insert(1, 'last_name')
> new_order.insert(2, 'industry')
> new_order.insert(3, 'title')
> self.fields.keyOrder = new_order
>
> def save(self):
> """ 
> Override the save method to save the first and last name to the 
> user
> field.
> """
> # First save the parent form and get the user.
> new_user = super(SignupFormExtra, self).save()
>
> new_user.first_name = self.cleaned_data['first_name']
> new_user.last_name = self.cleaned_data['last_name']
> new_user.industry = self.cleaned_data['industry']
> new_user.title = self.cleaned_data['title']
> new_user.save()
>
> # Userena expects to get the new user from this form, so return 
> the new
> # user.
> return new_user
>

-- 
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/a4c2a9d4-b9f2-43bc-b7bc-537e9e17c88b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: saving data using cleaned data method

2015-04-16 Thread Pavel Kuchin
Hi Sekkizhar,

I think django.forms.ModelForm is exactly what you are looking for. 
(https://docs.djangoproject.com/en/1.8/topics/forms/modelforms/#modelform)

Yours sincerely,
Pavel.

Good Morning,
> I am trying to save data in the table using cleaned data by get and post 
> method in the view.
> How will I trace step by step the movement of data which is  to be saved 
> in the database? 
>
> My problem is there is know error while running the program. But i did not 
> see any data saved in the table in postgres. Where is the data? where can i 
> find the data? [ i Used IPDP() ]
>
> *View*
>
> def post(self,request,**kwargs):
> if request.method == 'POST':
>
>
> form=dms_school_gis_info_form(request.POST)
> 
> if form.is_valid():
> form.process()
>
> cd = dms_school_gis_info(
> tempid_id = form.cleaned_data['tempid'],
> latitude=form.cleaned_data['latitude'],
> longitude=form.cleaned_data['longitude'],
> )
> cd.save() 
>
> *Form*   
>
> class dms_school_gis_info_form(forms.Form):
> tempid = forms.CharField()
> latitude=forms.CharField()
> longitude=forms.CharField()
>
> def process(self):
> cd = self.cleaned_data 
>
>
>
> Please help me 
>
> Sekkizhar
>

-- 
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/01955af7-a900-4f8d-863a-c82fe62316e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.