AutocompleteSelect and AutocompleteSelectMultiple admin widgets.

2017-11-27 Thread Daniel Gola
Hello,

Where I can find more detailed information about AutocompleteSelect and 
AutocompleteSelectMultiple admin widgets? 

I have not been able to find any information in the documentation.

I will be grateful for your help.


Best regards
Daniel


-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ad8f0676-36da-49e9-9a30-c74a8fabf362%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Skip upload of existing S3 Object

2017-11-27 Thread palansh agarwal
Hi Chris,
Were you able to solve this? I am in a similar situation.

On Sunday, January 1, 2012 at 4:55:07 PM UTC+5:30, Chris Hasenpflug wrote:
>
> I have a model with an ImageField and am using django-storages 
> S3BotoStorage backend. To reduce load on the server, I'm using 
> Amazon's S3 Browser Upload functionality[1] to send images directly to 
> S3. In order to create the model, my plan is have another view take 
> the uploaded key and save a model instance of my image.  Currently my 
> view code looks something like this: 
>
> def add_existing_image(request): 
> ... 
> image_key = request.POST.get('image_key', None) 
> im = default_storage.open(image_key) 
> i = Image(image=im, owner=user) 
>
> However, this seems to re-save the image on S3. I was hoping that 
> since I'm not directly reading the file it would not need to do so 
> behind the scenes, but it is. Since the goal is to not incur that 
> overhead, how should I go about creating model instances of these 
> files that already exist in my storage? 
>
> [1] http://aws.amazon.com/articles/1434

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c7582b55-7175-4dae-8612-a7fd3ab4a949%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to configure NGINX to run Django app in a subpath?

2017-11-27 Thread Etienne Robillard
I have not been able to solve this problem with uWSGI. Apparently, uWSGI 
is not using the same internal routing semantics than FastCGI.


See: https://forum.nginx.org/read.php?2,275684,275706

Etienne

Le 2017-11-26 à 15:41, Matemática A3K a écrit :
I don't know / remember how to do it in Gunicorn, but here is an 
example with uWSGI:

https://stackoverflow.com/questions/35792409/nginx-serving-django-in-a-subdirectory-through-uwsgi

The main thing is that you will have to deal with "/pmapp" prefix in 
your routing / urls. You can deal with this inside Django or have it 
stripped before it gets to Django (by nginx or gunicorn).


HTH :)

On Sun, Nov 26, 2017 at 4:56 PM, Luca Moiana > wrote:


Hi,

Sorry for the slight OT but after days of search I have no clue.


Following this DigitalOcean tutorial


 I
was able to setup Django + Postgres + Gunicorn + NGINX running
Django on my root,

Now I'd like to change and have something like this:

mydomain.com  -> static HTML
mydomain.com/pmapp  -> Django app

I created two server blocks in NGINX, one for my static website:

|

server {


listen 80;


listen [::]:80;




root /var/www/html/officinecartografiche.it;


index index.html index.htm index.nginx-debian.html;




server_name
www.officinecartografiche.it,officinecartografiche.it,207.154.206.172;




location /{


try_files $uri $uri/=404;

}

}

|

 and one for my django app:

|

server {


listen 80;


listen [::]:80;


server_name
www.officinecartografiche.it,officinecartografiche.it,207.154.206.172;


location =/favicon.ico { access_log off; log_not_found off; }


location /static/{


root /home/geouser/pmapp;


}




location /pmapp {


#includeproxy_params;


proxy_pass http://unix:/home/geouser/pmapp/pmapp.sock;


proxy_redirect http://www.officinecartografiche.it:8000/pmapp/
 http://$host/pmapp/;


proxy_set_header SCRIPT_NAME /pmapp;


}


}

|

and added this to settings.py:
|

FORCE_SCRIPT_NAME =*'/pmapp'*

|


WHAT AM I DOING WRONG??

THANKS FOR YOUR HELP!!!

-- 
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 https://groups.google.com/group/django-users
.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/b1ee39d2-fd04-4727-88e1-e130def5dd37%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BFDnhLuJEm4kE1D1FHMApW8nYQv%2BWi1Xt9R7o07bgOwqLGsjw%40mail.gmail.com 
.

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


--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f183b36b-2126-0ed9-ec86-5f7736856450%40yandex.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to configure NGINX to run Django app in a subpath?

2017-11-27 Thread Matemática A3K
That's good to know, I tried to do it some time ago, it was an attempt of a
"sort-of-tennats" which at the didn't go so I stop doing it. At that
moment, I remember trying with gunicorn without success and I was near
success with uWSGi but didn't make it at that time. I supposed that know
would be solved as the s-o question reports success.

Seems that the easiest way to go is to prefix all urls in Django with the
mount point - provided that no url is hardcoded in the django project - and
use a "regular" nginx conf...

On Mon, Nov 27, 2017 at 7:09 AM, Etienne Robillard 
wrote:

> I have not been able to solve this problem with uWSGI. Apparently, uWSGI
> is not using the same internal routing semantics than FastCGI.
>
> See: https://forum.nginx.org/read.php?2,275684,275706
> Etienne
>
>
> Le 2017-11-26 à 15:41, Matemática A3K a écrit :
>
> I don't know / remember how to do it in Gunicorn, but here is an example
> with uWSGI:
> https://stackoverflow.com/questions/35792409/nginx-serving-django-in-a-
> subdirectory-through-uwsgi
>
> The main thing is that you will have to deal with "/pmapp" prefix in your
> routing / urls. You can deal with this inside Django or have it stripped
> before it gets to Django (by nginx or gunicorn).
>
> HTH :)
>
> On Sun, Nov 26, 2017 at 4:56 PM, Luca Moiana 
> wrote:
>
>> Hi,
>>
>> Sorry for the slight OT but after days of search I have no clue.
>>
>>
>> Following this DigitalOcean tutorial
>> 
>>  I
>> was able to setup Django + Postgres + Gunicorn + NGINX running Django on my
>> root,
>>
>> Now I'd like to change and have something like this:
>>
>> mydomain.com -> static HTML
>> mydomain.com/pmapp -> Django app
>>
>> I created two server blocks in NGINX, one for my static website:
>>
>> server {
>>
>> listen 80;
>>
>> listen [::]:80;
>>
>>
>>
>> root /var/www/html/officinecartografiche.it;
>>
>> index index.html index.htm index.nginx-debian.html;
>>
>>
>>
>> server_name www.officinecartografiche.it, officinecartografiche.
>> it, 207.154.206.172;
>>
>>
>>
>> location / {
>>
>> try_files $uri $uri/ =404;
>>
>>}
>>
>> }
>>
>>  and one for my django app:
>>
>> server {
>>
>> listen 80;
>>
>> listen [::]:80;
>>
>> server_name www.officinecartografiche.it, officinecartografiche.it,
>> 207.154.206.172;
>>
>> location = /favicon.ico { access_log off; log_not_found off; }
>>
>> location /static/ {
>>
>> root /home/geouser/pmapp;
>>
>> }
>>
>>
>>
>> location /pmapp {
>>
>> #include proxy_params;
>>
>> proxy_pass http://unix:/home/geouser/pmapp/pmapp.sock;
>>
>> proxy_redirect http://www.officinecartografiche.it:8000/pmapp/
>> http://$host/pmapp/;
>>
>> proxy_set_header SCRIPT_NAME /pmapp;
>>
>> }
>>
>> }
>>
>> and added this to settings.py:
>>
>> FORCE_SCRIPT_NAME = *'/pmapp'*
>>
>>
>> WHAT AM I DOING WRONG??
>>
>> THANKS FOR YOUR HELP!!!
>>
>> --
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/b1ee39d2-fd04-4727-88e1-e130def5dd37%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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CA%2BFDnhLuJEm4kE1D1FHMApW8nYQv%
> 2BWi1Xt9R7o07bgOwqLGsjw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Etienne Robillardtkadm30@yandex.comhttps://www.isotopesoftware.ca/
>
> --
> 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

Re: How to configure NGINX to run Django app in a subpath?

2017-11-27 Thread Luca Moiana
Thanks for your replly, I'll look into the link you suggested.
As for the routing / urls adding FORCE_SCRIPT_NAME = '/pmapp' to 
settings.py isnt' enough?



Il giorno domenica 26 novembre 2017 21:42:41 UTC+1, Matemática A3K ha 
scritto:
>
> I don't know / remember how to do it in Gunicorn, but here is an example 
> with uWSGI:
>
> https://stackoverflow.com/questions/35792409/nginx-serving-django-in-a-subdirectory-through-uwsgi
>
> The main thing is that you will have to deal with "/pmapp" prefix in your 
> routing / urls. You can deal with this inside Django or have it stripped 
> before it gets to Django (by nginx or gunicorn).
>
> HTH :)
>
> On Sun, Nov 26, 2017 at 4:56 PM, Luca Moiana  > wrote:
>
>> Hi,
>>
>> Sorry for the slight OT but after days of search I have no clue.
>>
>>
>> Following this DigitalOcean tutorial 
>> 
>>  I 
>> was able to setup Django + Postgres + Gunicorn + NGINX running Django on my 
>> root,
>>
>> Now I'd like to change and have something like this:
>>
>> mydomain.com -> static HTML
>> mydomain.com/pmapp -> Django app
>>
>> I created two server blocks in NGINX, one for my static website:
>>
>> server {
>>
>> listen 80;
>>
>> listen [::]:80;
>>
>>
>>
>> root /var/www/html/officinecartografiche.it;
>>
>> index index.html index.htm index.nginx-debian.html;
>>
>>
>>
>> server_name www.officinecartografiche.it, officinecartografiche.
>> it, 207.154.206.172;
>>
>>
>>
>> location / {
>>
>> try_files $uri $uri/ =404;
>>
>>}
>>
>> }
>>
>>  and one for my django app:
>>
>> server {
>>
>> listen 80;
>>
>> listen [::]:80;
>>
>> server_name www.officinecartografiche.it, officinecartografiche.it, 
>> 207.154.206.172;
>>
>> location = /favicon.ico { access_log off; log_not_found off; }
>>
>> location /static/ {
>>
>> root /home/geouser/pmapp;
>>
>> }
>>
>>
>>
>> location /pmapp {
>>
>> #include proxy_params;
>>
>> proxy_pass http://unix:/home/geouser/pmapp/pmapp.sock;
>>
>> proxy_redirect http://www.officinecartografiche.it:8000/pmapp/ 
>> http://$host/pmapp/;
>>
>> proxy_set_header SCRIPT_NAME /pmapp;
>>
>> }
>>
>> }
>>
>> and added this to settings.py:
>>
>> FORCE_SCRIPT_NAME = *'/pmapp'*
>>
>>
>> WHAT AM I DOING WRONG??
>>
>> THANKS FOR YOUR HELP!!!
>>
>> -- 
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/b1ee39d2-fd04-4727-88e1-e130def5dd37%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f2799f0e-faba-463d-82f8-308382886006%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to configure NGINX to run Django app in a subpath?

2017-11-27 Thread Luca Moiana
Thanks for your reply, although it sounds hard for a noob like me.

Just to understand, the trick should be done on Gunicorn or on NGINX ?

Il giorno lunedì 27 novembre 2017 11:29:01 UTC+1, Matemática A3K ha scritto:
>
> That's good to know, I tried to do it some time ago, it was an attempt of 
> a "sort-of-tennats" which at the didn't go so I stop doing it. At that 
> moment, I remember trying with gunicorn without success and I was near 
> success with uWSGi but didn't make it at that time. I supposed that know 
> would be solved as the s-o question reports success.
>
> Seems that the easiest way to go is to prefix all urls in Django with the 
> mount point - provided that no url is hardcoded in the django project - and 
> use a "regular" nginx conf...
>
> On Mon, Nov 27, 2017 at 7:09 AM, Etienne Robillard  > wrote:
>
>> I have not been able to solve this problem with uWSGI. Apparently, uWSGI 
>> is not using the same internal routing semantics than FastCGI.
>>
>> See: https://forum.nginx.org/read.php?2,275684,275706
>> Etienne
>>
>>
>> Le 2017-11-26 à 15:41, Matemática A3K a écrit :
>>
>> I don't know / remember how to do it in Gunicorn, but here is an example 
>> with uWSGI:
>>
>> https://stackoverflow.com/questions/35792409/nginx-serving-django-in-a-subdirectory-through-uwsgi
>>
>> The main thing is that you will have to deal with "/pmapp" prefix in your 
>> routing / urls. You can deal with this inside Django or have it stripped 
>> before it gets to Django (by nginx or gunicorn).
>>
>> HTH :)
>>
>> On Sun, Nov 26, 2017 at 4:56 PM, Luca Moiana > > wrote:
>>
>>> Hi, 
>>>
>>> Sorry for the slight OT but after days of search I have no clue.
>>>
>>>
>>> Following this DigitalOcean tutorial 
>>> 
>>>  I 
>>> was able to setup Django + Postgres + Gunicorn + NGINX running Django on my 
>>> root,
>>>
>>> Now I'd like to change and have something like this:
>>>
>>> mydomain.com -> static HTML
>>> mydomain.com/pmapp -> Django app
>>>
>>> I created two server blocks in NGINX, one for my static website:
>>>
>>> server {
>>>
>>> listen 80;
>>>
>>> listen [::]:80;
>>>
>>>
>>>
>>> root /var/www/html/officinecartografiche.it;
>>>
>>> index index.html index.htm index.nginx-debian.html;
>>>
>>>
>>>
>>> server_name www.officinecartografiche.it, officinecartografiche.
>>> it, 207.154.206.172;
>>>
>>>
>>>
>>> location / {
>>>
>>> try_files $uri $uri/ =404;
>>>
>>>}
>>>
>>> }
>>>
>>>  and one for my django app:
>>>
>>> server {
>>>
>>> listen 80;
>>>
>>> listen [::]:80;
>>>
>>> server_name www.officinecartografiche.it, officinecartografiche.it, 
>>> 207.154.206.172;
>>>
>>> location = /favicon.ico { access_log off; log_not_found off; }
>>>
>>> location /static/ {
>>>
>>> root /home/geouser/pmapp;
>>>
>>> }
>>>
>>>
>>>
>>> location /pmapp {
>>>
>>> #include proxy_params;
>>>
>>> proxy_pass http://unix:/home/geouser/pmapp/pmapp.sock;
>>>
>>> proxy_redirect http://www.officinecartografiche.it:8000/pmapp/ 
>>> http://$host/pmapp/;
>>>
>>> proxy_set_header SCRIPT_NAME /pmapp;
>>>
>>> }
>>>
>>> }
>>>
>>> and added this to settings.py:
>>>
>>> FORCE_SCRIPT_NAME = *'/pmapp'*
>>>
>>>
>>> WHAT AM I DOING WRONG??
>>>
>>> THANKS FOR YOUR HELP!!!
>>>
>>> -- 
>>> 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 https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/b1ee39d2-fd04-4727-88e1-e130def5dd37%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CA%2BFDnhLuJEm4kE1D1FHMApW8nYQv%2BWi1Xt9R7o07bgOwqLGsjw%40mail.gmail.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> -- 

Re: How to configure NGINX to run Django app in a subpath?

2017-11-27 Thread Luca Moiana
Thanks, I read you tutorial but I don't get where I should set my subpath?

thanks a lot


Il giorno domenica 26 novembre 2017 21:06:56 UTC+1, k2527806 ha scritto:
>
> https://jee-appy.blogspot.com/2017/01/deply-django-with-nginx.html
>
> On Sun, Nov 26, 2017 at 11:26 PM, Luca Moiana  > wrote:
>
>> Hi,
>>
>> Sorry for the slight OT but after days of search I have no clue.
>>
>>
>> Following this DigitalOcean tutorial 
>> 
>>  I 
>> was able to setup Django + Postgres + Gunicorn + NGINX running Django on my 
>> root,
>>
>> Now I'd like to change and have something like this:
>>
>> mydomain.com -> static HTML
>> mydomain.com/pmapp -> Django app
>>
>> I created two server blocks in NGINX, one for my static website:
>>
>> server {
>>
>> listen 80;
>>
>> listen [::]:80;
>>
>>
>>
>> root /var/www/html/officinecartografiche.it;
>>
>> index index.html index.htm index.nginx-debian.html;
>>
>>
>>
>> server_name www.officinecartografiche.it, officinecartografiche.
>> it, 207.154.206.172;
>>
>>
>>
>> location / {
>>
>> try_files $uri $uri/ =404;
>>
>>}
>>
>> }
>>
>>  and one for my django app:
>>
>> server {
>>
>> listen 80;
>>
>> listen [::]:80;
>>
>> server_name www.officinecartografiche.it, officinecartografiche.it, 
>> 207.154.206.172;
>>
>> location = /favicon.ico { access_log off; log_not_found off; }
>>
>> location /static/ {
>>
>> root /home/geouser/pmapp;
>>
>> }
>>
>>
>>
>> location /pmapp {
>>
>> #include proxy_params;
>>
>> proxy_pass http://unix:/home/geouser/pmapp/pmapp.sock;
>>
>> proxy_redirect http://www.officinecartografiche.it:8000/pmapp/ 
>> http://$host/pmapp/;
>>
>> proxy_set_header SCRIPT_NAME /pmapp;
>>
>> }
>>
>> }
>>
>> and added this to settings.py:
>>
>> FORCE_SCRIPT_NAME = *'/pmapp'*
>>
>>
>> WHAT AM I DOING WRONG??
>>
>> THANKS FOR YOUR HELP!!!
>>
>> -- 
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/b1ee39d2-fd04-4727-88e1-e130def5dd37%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eeb0942a-eb58-4399-a3cf-1f978501c660%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to configure NGINX to run Django app in a subpath?

2017-11-27 Thread Luca Moiana
Googling around I found this 
page http://albertoconnor.ca/hosting-django-under-different-locations.html 
but ain't working for me

Il giorno lunedì 27 novembre 2017 11:10:50 UTC+1, Etienne Robillard ha 
scritto:
>
> I have not been able to solve this problem with uWSGI. Apparently, uWSGI 
> is not using the same internal routing semantics than FastCGI.
>
> See: https://forum.nginx.org/read.php?2,275684,275706
> Etienne
>
> Le 2017-11-26 à 15:41, Matemática A3K a écrit :
>
> I don't know / remember how to do it in Gunicorn, but here is an example 
> with uWSGI:
>
> https://stackoverflow.com/questions/35792409/nginx-serving-django-in-a-subdirectory-through-uwsgi
>
> The main thing is that you will have to deal with "/pmapp" prefix in your 
> routing / urls. You can deal with this inside Django or have it stripped 
> before it gets to Django (by nginx or gunicorn).
>
> HTH :)
>
> On Sun, Nov 26, 2017 at 4:56 PM, Luca Moiana  > wrote:
>
>> Hi, 
>>
>> Sorry for the slight OT but after days of search I have no clue.
>>
>>
>> Following this DigitalOcean tutorial 
>> 
>>  I 
>> was able to setup Django + Postgres + Gunicorn + NGINX running Django on my 
>> root,
>>
>> Now I'd like to change and have something like this:
>>
>> mydomain.com -> static HTML
>> mydomain.com/pmapp -> Django app
>>
>> I created two server blocks in NGINX, one for my static website:
>>
>> server {
>>
>> listen 80;
>>
>> listen [::]:80;
>>
>>
>>
>> root /var/www/html/officinecartografiche.it;
>>
>> index index.html index.htm index.nginx-debian.html;
>>
>>
>>
>> server_name www.officinecartografiche.it, officinecartografiche.
>> it, 207.154.206.172;
>>
>>
>>
>> location / {
>>
>> try_files $uri $uri/ =404;
>>
>>}
>>
>> }
>>
>>  and one for my django app:
>>
>> server {
>>
>> listen 80;
>>
>> listen [::]:80;
>>
>> server_name www.officinecartografiche.it, officinecartografiche.it, 
>> 207.154.206.172;
>>
>> location = /favicon.ico { access_log off; log_not_found off; }
>>
>> location /static/ {
>>
>> root /home/geouser/pmapp;
>>
>> }
>>
>>
>>
>> location /pmapp {
>>
>> #include proxy_params;
>>
>> proxy_pass http://unix:/home/geouser/pmapp/pmapp.sock;
>>
>> proxy_redirect http://www.officinecartografiche.it:8000/pmapp/ 
>> http://$host/pmapp/;
>>
>> proxy_set_header SCRIPT_NAME /pmapp;
>>
>> }
>>
>> }
>>
>> and added this to settings.py:
>>
>> FORCE_SCRIPT_NAME = *'/pmapp'*
>>
>>
>> WHAT AM I DOING WRONG??
>>
>> THANKS FOR YOUR HELP!!!
>>
>> -- 
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/b1ee39d2-fd04-4727-88e1-e130def5dd37%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CA%2BFDnhLuJEm4kE1D1FHMApW8nYQv%2BWi1Xt9R7o07bgOwqLGsjw%40mail.gmail.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> -- 
> Etienne robillardtka...@yandex.com 
> https://www.isotopesoftware.ca/
>
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d15cf9a9-9f60-49c4-ad6b-b89ad2f78cde%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Converting any Graphical Chart(pie-chart, gantt chart) into image dynamically.

2017-11-27 Thread pradam programmer
Hi Guys,

I want to convert an graphical chart,for an Ex: pie-chart,gantt chart into
an image in a real time and display it in a PDF Document dynamically.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGGVXBOjunnZUhRmzZNXAZLngA6hD%3DzGwKzGbVv_adPNxB3zYw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to select the proper column when I use ForeignKey?

2017-11-27 Thread Kubilay Yazoğlu
Thanks for your answer. I have one more question. What if there are more 
than one primary keys in that table? I'm talking about the unique_together 
case.

27 Kasım 2017 Pazartesi 08:55:45 UTC+3 tarihinde Matemática A3K yazdı:
>
> What Django shows in that dropdown is the __str__() method of the object, 
> define it to your needs in A :)
>
> On Sun, Nov 26, 2017 at 7:49 PM, Kubilay Yazoğlu  > wrote:
>
>> Hello. I have two models. In one of them, I declared a foreign key to the 
>> other one. Since this is done in Django by only specifying the Class name, 
>> without specifying the field name(column name), when I try to create an 
>> object in admin panel, it pulls the wrong column information.
>>
>> Two models A and B.
>> B has a Foreignkey for accessing A.
>> A has two fields Field1 and Field2.
>> When I try to create an instance of B, in the field of Foreignkey, there 
>> is a drop down menu but the content is not from the right field of A.
>>
>> How to specify it?
>>
>> -- 
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/ad0d40a3-cd7f-4f2f-821d-31cc007657b1%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/60af36a5-7fec-46f7-a348-ae4a8784f01b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Converting any Graphical Chart(pie-chart, gantt chart) into image dynamically.

2017-11-27 Thread Derek
Try reportlab:

https://docs.djangoproject.com/en/1.11/howto/outputting-pdf/#write-your-view
https://www.blog.pythonlibrary.org/2016/02/18/reportlab-how-to-add-charts-graphs/
https://www.reportlab.com/chartgallery/bar/

The actual data generation will of course be specific to your database and 
models.

On Monday, 27 November 2017 13:49:10 UTC+2, pradam.programming wrote:
>
> Hi Guys,
>
> I want to convert an graphical chart,for an Ex: pie-chart,gantt chart into 
> an image in a real time and display it in a PDF Document dynamically.
>
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d48a736b-b739-4159-a174-ed2ad162cc1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Converting any Graphical Chart(pie-chart, gantt chart) into image dynamically.

2017-11-27 Thread pradam programmer
Thanks alot Derek..I will try this package.

On 27-Nov-2017 7:45 PM, "Derek"  wrote:

> Try reportlab:
>
> https://docs.djangoproject.com/en/1.11/howto/outputting-pdf/
> #write-your-view
> https://www.blog.pythonlibrary.org/2016/02/18/reportlab-how-
> to-add-charts-graphs/
> https://www.reportlab.com/chartgallery/bar/
>
> The actual data generation will of course be specific to your database and
> models.
>
> On Monday, 27 November 2017 13:49:10 UTC+2, pradam.programming wrote:
>>
>> Hi Guys,
>>
>> I want to convert an graphical chart,for an Ex: pie-chart,gantt chart
>> into an image in a real time and display it in a PDF Document dynamically.
>>
>> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/ms
> gid/django-users/d48a736b-b739-4159-a174-ed2ad162cc1e%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGGVXBNWNQTAin-ii4vdazdRWinoWnpW7uYkUm7caCd83ws0aw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Seeking design guidance on a Team model where a user sends invitation to other users to join the team

2017-11-27 Thread Jack
Hey Adam.  I took a week to properly learn some JavaScript and jQuery and 
how to make ajax calls.  I just got it working!  It was much simpler than I 
thought.  I created a views to catch the appropriate agent's pk and put 
that in a data-href attribute like this:

Send Invite

Then I passed the button into an ajax call... a few lines of processing in 
the `send_invitation` views and it works nicely.  Took maybe 15 lines of 
code in total?

Thanks for your help, but mainly thanks for leading me into using ajax.  I 
was always too lazy to properly learn javascript but now, I can do a lot 
more with jquery and ajax!

Best regards,

On Friday, November 10, 2017 at 12:37:46 PM UTC-5, Adam wrote:
>
>
>
>
>
>
>
> Weird, I dont see our conversation,
>
> Anyway here is a simple setup:
>
> urls.py:
>
> from django.conf.urls import url
>
> from .views import ajax_comment_send
>
> urlpatterns = [
>
>  url("comment_send", ajax_comment_send, name="comment_send"),
>
> ]
>
>
>
> then a view - this is from my project, you will to make changes to do the 
> calculations. :)
>
> ...
>
> def ajax_comment_send(request):
>  if not request.is_ajax():
>  return HttpResponse('SERVER RESPONSE: ajax_comment_send, Not an ajax 
> call.')
>
>  comment_thread = None
>  recipient = None
>
>  if request.method == "POST":
>  content = request.POST.get("content", "0")
>  recip_id_str = request.POST.get("recip_id", "0") # this is where to make 
> changes
>
>  if scope == 'story':
>  comment_thread = CommentThread.objects.get(story__id=int(recip_id_str))
>  recipient = get_object_or_404(User, pk=comment_thread.first_recipient_id)
>
> ...
>
>  send_message = Comment.objects.create(
>  body=content,
>  comment_thread=comment_thread,
>  recipient=recipient,
>  sender=request.user
>  )
>
>  send_message.save()
>
>  return HttpResponse("SERVER RESPONSE ajax_comment_send; send_message.id: 
> " +
>  str(send_message.id)) # this is a check to help with debugging
>
>  return HttpResponse('SERVER RESPONSE: ajax_comment_send, AJAX fell 
> through.')
>
>
>
>
> this is the key part ; javascript in the front end:
>
>
> function replyThread (scope, recip_id, cntnt) {
>  console.log('replyThread : scope:' + scope + ', recip_id: ' + recip_id + ', 
> content: ' + cntnt);
>  $.ajax({
>  type: 'POST',
>  url: '/jos_comments/comment_send',
>  data: { // this is the part that scoops up the agents and sends it to 
> the backend
>  'scope': scope, // This is unique to me
>  'recip_id': recip_id,
>  'content': cntnt
>  },
>  success: function (serverResponse_data) {
>  console.log('replyThread success: ' + serverResponse_data);
>  $('#message_box').html(
>  "Message sent!");
>  setTimeout(function () {
>  getThreadComments(serverResponse_data.split(':')[1]); // this reloads 
> the messages; you probably don't need
>  }, 1500);
>  },
>  error: function (serverResponse_data) {
>  console.log('error:' + JSON.stringify(serverResponse_data).split(',').
> join('\n')); // helps with debug
>  }
>  });
> }
>
> Hope this helps
>
>
>
>
>
>
>
>
>
>
> On Saturday, November 4, 2017 at 8:27:12 PM UTC-7, Jack wrote:
>>
>> I have a model called *Team*, which has a ForeignKey relationship with 
>> *User* (a team can have many users, but a user can only be part of one 
>> team).
>>
>> A user can create a team, and that user will automatically become a *Team 
>> Leader* (a group, not a model).  The team leader can query the database 
>> for other users and send invitations to other users join his team.  Users 
>> who receive an invitation can either accept or decline the invitation; if a 
>> user accepts an invitation, he joins the team as as a *Team Member*
>>
>> My question is, how do I go about designing the invitation system?  After 
>> the team leader clicks the 'Send Invitation' button, the receiving-user 
>> should see a special invitation message on his dashboard, which he can 
>> either accept or decline.
>>
>> My current thinking tells me I should create a model called *Invitation* 
>> which has a OneToOne relationship with User.  When an invitation is sent, 
>> an instance of Invitation is created which is assigned to the 
>> receiving-user.  The invitation instance will be deleted when the 
>> receiving-user accepts or declines the invitation.
>>
>> Another method I can think of is to send an Email to the receiving-user.  
>> The Email will be like an account activation Email, except the activation 
>> link adds the receiving-user to the team and marks the receiving-user as a 
>> *team 
>> member.*
>>
>> Pointers and guidance welcome.  I feel like both my methods are clumsy 
>> and maybe there is a built-in feature in Django which I missed which could 
>> solve this problem much easier.
>>
>

-- 
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@goog

Re: How to configure NGINX to run Django app in a subpath?

2017-11-27 Thread Matemática A3K
Something like this should work:
https://stackoverflow.com/a/20998131/8930660
and change STATIC_URL and MEDIA_URL

Also, the FORCE_SCRIPT_NAME should also work, but if it doesn't, the first
is the most "manual" thing you can do, I think...

Then you have no need to have 2 nginx confs, just put that the proxy_pass
"starts" in your prefix instead of root

On Mon, Nov 27, 2017 at 8:32 AM, Luca Moiana  wrote:

> Googling around I found this page http://albertoconnor.ca/
> hosting-django-under-different-locations.html but ain't working for me
>
> Il giorno lunedì 27 novembre 2017 11:10:50 UTC+1, Etienne Robillard ha
> scritto:
>>
>> I have not been able to solve this problem with uWSGI. Apparently, uWSGI
>> is not using the same internal routing semantics than FastCGI.
>>
>> See: https://forum.nginx.org/read.php?2,275684,275706
>> Etienne
>>
>> Le 2017-11-26 à 15:41, Matemática A3K a écrit :
>>
>> I don't know / remember how to do it in Gunicorn, but here is an example
>> with uWSGI:
>> https://stackoverflow.com/questions/35792409/nginx-serving-
>> django-in-a-subdirectory-through-uwsgi
>>
>> The main thing is that you will have to deal with "/pmapp" prefix in your
>> routing / urls. You can deal with this inside Django or have it stripped
>> before it gets to Django (by nginx or gunicorn).
>>
>> HTH :)
>>
>> On Sun, Nov 26, 2017 at 4:56 PM, Luca Moiana  wrote:
>>
>>> Hi,
>>>
>>> Sorry for the slight OT but after days of search I have no clue.
>>>
>>>
>>> Following this DigitalOcean tutorial
>>> 
>>>  I
>>> was able to setup Django + Postgres + Gunicorn + NGINX running Django on my
>>> root,
>>>
>>> Now I'd like to change and have something like this:
>>>
>>> mydomain.com -> static HTML
>>> mydomain.com/pmapp -> Django app
>>>
>>> I created two server blocks in NGINX, one for my static website:
>>>
>>> server {
>>>
>>> listen 80;
>>>
>>> listen [::]:80;
>>>
>>>
>>>
>>> root /var/www/html/officinecartografiche.it;
>>>
>>> index index.html index.htm index.nginx-debian.html;
>>>
>>>
>>>
>>> server_name www.officinecartografiche.it, officinecartografiche.
>>> it, 207.154.206.172;
>>>
>>>
>>>
>>> location / {
>>>
>>> try_files $uri $uri/ =404;
>>>
>>>}
>>>
>>> }
>>>
>>>  and one for my django app:
>>>
>>> server {
>>>
>>> listen 80;
>>>
>>> listen [::]:80;
>>>
>>> server_name www.officinecartografiche.it, officinecartografiche.it,
>>> 207.154.206.172;
>>>
>>> location = /favicon.ico { access_log off; log_not_found off; }
>>>
>>> location /static/ {
>>>
>>> root /home/geouser/pmapp;
>>>
>>> }
>>>
>>>
>>>
>>> location /pmapp {
>>>
>>> #include proxy_params;
>>>
>>> proxy_pass http://unix:/home/geouser/pmapp/pmapp.sock;
>>>
>>> proxy_redirect http://www.officinecartografiche.it:8000/pmapp/
>>> http://$host/pmapp/;
>>>
>>> proxy_set_header SCRIPT_NAME /pmapp;
>>>
>>> }
>>>
>>> }
>>>
>>> and added this to settings.py:
>>>
>>> FORCE_SCRIPT_NAME = *'/pmapp'*
>>>
>>>
>>> WHAT AM I DOING WRONG??
>>>
>>> THANKS FOR YOUR HELP!!!
>>>
>>> --
>>> 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 https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/b1ee39d2-fd04-4727-88e1-e130def5dd37%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users...@googlegroups.com.
>> To post to this group, send email to django...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/CA%2BFDnhLuJEm4kE1D1FHMApW8nYQv%2BWi1Xt9R7o
>> 07bgOwqLGsjw%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> Etienne Robillardtka...@yandex.comhttps://www.isotopesoftware.ca/
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails fro

Re: How to select the proper column when I use ForeignKey?

2017-11-27 Thread Matemática A3K
On Mon, Nov 27, 2017 at 10:50 AM, Kubilay Yazoğlu 
wrote:

> Thanks for your answer. I have one more question. What if there are more
> than one primary keys in that table?
>

By definition, that won't happen, a primary key is unique. If you add a
record with the same key Django will raise an IntegrityError.


> I'm talking about the unique_together case.
>

I don't understand you


>
> 27 Kasım 2017 Pazartesi 08:55:45 UTC+3 tarihinde Matemática A3K yazdı:
>>
>> What Django shows in that dropdown is the __str__() method of the object,
>> define it to your needs in A :)
>>
>> On Sun, Nov 26, 2017 at 7:49 PM, Kubilay Yazoğlu 
>> wrote:
>>
>>> Hello. I have two models. In one of them, I declared a foreign key to
>>> the other one. Since this is done in Django by only specifying the Class
>>> name, without specifying the field name(column name), when I try to create
>>> an object in admin panel, it pulls the wrong column information.
>>>
>>> Two models A and B.
>>> B has a Foreignkey for accessing A.
>>> A has two fields Field1 and Field2.
>>> When I try to create an instance of B, in the field of Foreignkey, there
>>> is a drop down menu but the content is not from the right field of A.
>>>
>>> How to specify it?
>>>
>>> --
>>> 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 https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/ad0d40a3-cd7f-4f2f-821d-31cc007657b1%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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/60af36a5-7fec-46f7-a348-ae4a8784f01b%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BFDnhJYq2rsw9BPGVhTSSBsr%2BLnn_DwffbUP4XM0Twon6fy8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to select the proper column when I use ForeignKey?

2017-11-27 Thread Matemática A3K
On Mon, Nov 27, 2017 at 5:30 PM, Matemática A3K 
wrote:

>
>
> On Mon, Nov 27, 2017 at 10:50 AM, Kubilay Yazoğlu 
> wrote:
>
>> Thanks for your answer. I have one more question. What if there are more
>> than one primary keys in that table?
>>
>
> By definition, that won't happen, a primary key is unique. If you add a
> record with the same key Django will raise an IntegrityError.
>
>
>> I'm talking about the unique_together case.
>>
>
> I don't understand you
>

The ForeignKey uses the model's auto primary key to "link", if you define
other keys, np. You should read
https://docs.djangoproject.com/en/1.11/ref/models/fields/#foreignkey

The __str__() representation of the object is independent of the keys you
define on it. If you want to tweak what is displayed in the drop-down, use
this method to show whatever you need :)


>
>
>>
>> 27 Kasım 2017 Pazartesi 08:55:45 UTC+3 tarihinde Matemática A3K yazdı:
>>>
>>> What Django shows in that dropdown is the __str__() method of the
>>> object, define it to your needs in A :)
>>>
>>> On Sun, Nov 26, 2017 at 7:49 PM, Kubilay Yazoğlu 
>>> wrote:
>>>
 Hello. I have two models. In one of them, I declared a foreign key to
 the other one. Since this is done in Django by only specifying the Class
 name, without specifying the field name(column name), when I try to create
 an object in admin panel, it pulls the wrong column information.

 Two models A and B.
 B has a Foreignkey for accessing A.
 A has two fields Field1 and Field2.
 When I try to create an instance of B, in the field of Foreignkey,
 there is a drop down menu but the content is not from the right field of A.

 How to specify it?

 --
 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 https://groups.google.com/group/django-users.
 To view this discussion on the web visit https://groups.google.com/d/ms
 gid/django-users/ad0d40a3-cd7f-4f2f-821d-31cc007657b1%40goog
 legroups.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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/60af36a5-7fec-46f7-a348-ae4a8784f01b%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BFDnhJ4ZxTmTwP1DKc30ACBpOcS6npTJLDSfEKpZ8xRUKGrxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to select the proper column when I use ForeignKey?

2017-11-27 Thread Kubilay Yazoğlu
Thanks. I was talking about the composite primary keys in my second 
question. I've seen that there is a library for it. So, no problem now. 
Thank you.

27 Kasım 2017 Pazartesi 01:49:15 UTC+3 tarihinde Kubilay Yazoğlu yazdı:
>
> Hello. I have two models. In one of them, I declared a foreign key to the 
> other one. Since this is done in Django by only specifying the Class name, 
> without specifying the field name(column name), when I try to create an 
> object in admin panel, it pulls the wrong column information.
>
> Two models A and B.
> B has a Foreignkey for accessing A.
> A has two fields Field1 and Field2.
> When I try to create an instance of B, in the field of Foreignkey, there 
> is a drop down menu but the content is not from the right field of A.
>
> How to specify it?
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6b65ec89-8bd6-4e92-bb01-f539cbae69da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to select the proper column when I use ForeignKey?

2017-11-27 Thread Kubilay Yazoğlu
Thanks. I was talking about the composite primary keys in my second 
question. I've seen that there is a library for it. So, no problem now. 
Thank you.

27 Kasım 2017 Pazartesi 23:31:29 UTC+3 tarihinde Matemática A3K yazdı:
>
>
>
> On Mon, Nov 27, 2017 at 10:50 AM, Kubilay Yazoğlu  > wrote:
>
>> Thanks for your answer. I have one more question. What if there are more 
>> than one primary keys in that table?
>>
>
> By definition, that won't happen, a primary key is unique. If you add a 
> record with the same key Django will raise an IntegrityError.
>  
>
>> I'm talking about the unique_together case.
>>
>
> I don't understand you
>  
>
>>
>> 27 Kasım 2017 Pazartesi 08:55:45 UTC+3 tarihinde Matemática A3K yazdı:
>>>
>>> What Django shows in that dropdown is the __str__() method of the 
>>> object, define it to your needs in A :)
>>>
>>> On Sun, Nov 26, 2017 at 7:49 PM, Kubilay Yazoğlu  
>>> wrote:
>>>
 Hello. I have two models. In one of them, I declared a foreign key to 
 the other one. Since this is done in Django by only specifying the Class 
 name, without specifying the field name(column name), when I try to create 
 an object in admin panel, it pulls the wrong column information.

 Two models A and B.
 B has a Foreignkey for accessing A.
 A has two fields Field1 and Field2.
 When I try to create an instance of B, in the field of Foreignkey, 
 there is a drop down menu but the content is not from the right field of A.

 How to specify it?

 -- 
 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 https://groups.google.com/group/django-users.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/ad0d40a3-cd7f-4f2f-821d-31cc007657b1%40googlegroups.com
  
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/60af36a5-7fec-46f7-a348-ae4a8784f01b%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ff081369-3fca-4c89-a577-35e3c96a8d90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


NOT NULL constraint failed when trying to create form with initial values

2017-11-27 Thread Kubilay Yazoğlu
Hi. I'm trying to create a form to construct an object for my Photo class. 
All of the objects fields except the photo itself will be invisible to the 
user. So, the only thing can be seen in the form is the button to select 
and upload the photo.

There is no problem with creating the form page. The problem is, giving the 
initial values for the rest of the fields. 
This is the relevant code in my view file:

if request.method =='POST':
data = {'photo_id': get_latest_photo_id_plusone(),
'contest_id': get_latest_contest_id_plusone(),
'ownername': 'SUMMERSON',
}
form=PhotoForm(request.POST, initial=data)
if form.is_valid():
Photo = form.save()
else:
form = PhotoForm()

And the relevant functions:

def get_latest_photo_id_plusone():
max_rating = 
Photo.objects.all().aggregate(Max('photo_id'))['photo_id__max']
return max_rating+1


def get_latest_contest_id_plusone():
max_rating 
=Photo.objects.all().aggregate(Max('contest_id'))['contest_id__max']
return max_rating+1

The error arises when I click on the send button after I select the image. 
It says: 

IntegrityError at /photo/create/
NOT NULL constraint failed: photo_photo.contest_id_id

But I've given the contest_id value. Haven't I? Where is the problem and 
how can I fix it?

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ad42fcc2-7c20-48c0-9770-f2408c14a4e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AutocompleteSelect and AutocompleteSelectMultiple admin widgets.

2017-11-27 Thread Tim Graham
They're used when you use ModelAdmin.autocomplete_fields.
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.autocomplete_fields

On Monday, November 27, 2017 at 3:27:30 AM UTC-5, Daniel Gola wrote:
>
> Hello,
>
> Where I can find more detailed information about AutocompleteSelect and 
> AutocompleteSelectMultiple admin widgets? 
>
> I have not been able to find any information in the documentation.
>
> I will be grateful for your help.
>
>
> Best regards
> Daniel
>
>
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c3757af3-976b-4ea4-9ccf-65ac85bfbdc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


NOT NULL constraint failed when trying to create form with initial values

2017-11-27 Thread Kubilay Yazoğlu
Hi. I'm trying to create a form to construct an object for my Photo class. 
All of the objects fields except the photo itself will be invisible to the 
user. So, the only thing can be seen in the form is the button to select 
and upload the photo.

There is no problem with creating the form page. The problem is, giving the 
initial values for the rest of the fields. 
This is the relevant code in my view file:

  

if request.method =='POST':
data = {'photo_id': get_latest_photo_id_plusone(),
'contest_id': get_latest_contest_id_plusone(),
'ownername': 'SUMMERSON',
}
form=PhotoForm(request.POST, initial=data)
if form.is_valid():
Photo = form.save()
else:
form = PhotoForm()


And the relevant functions:

  

def get_latest_photo_id_plusone():
max_rating = 
Photo.objects.all().aggregate(Max('photo_id'))['photo_id__max']
return max_rating+1


def get_latest_contest_id_plusone():
max_rating 
=Photo.objects.all().aggregate(Max('contest_id'))['contest_id__max']
return max_rating+1



The error arises when I click on the send button after I select the image. 
It says: 

IntegrityError at /photo/create/
NOT NULL constraint failed: photo_photo.contest_id_id

But I've given the contest_id value. Haven't I? Where is the problem and 
how can I fix it?

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/57db225c-41bf-43d2-b9d8-ffb3174cddc7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: NOT NULL constraint failed when trying to create form with initial values

2017-11-27 Thread Matemática A3K
You shouldn't give the PK of new objects, leave that to Django. If photo_id
is the PK of Photo, don't set it, Django will on save.

If the same goes for Contest, then do a "contest = Contest()" - create a
new contest - and assign it to the photo "photo.contest = contest", then
"photo.save"

On Mon, Nov 27, 2017 at 5:56 PM, Kubilay Yazoğlu 
wrote:

> Hi. I'm trying to create a form to construct an object for my Photo class.
> All of the objects fields except the photo itself will be invisible to the
> user. So, the only thing can be seen in the form is the button to select
> and upload the photo.
>
> There is no problem with creating the form page. The problem is, giving
> the initial values for the rest of the fields.
> This is the relevant code in my view file:
>
>
>
> if request.method =='POST':
> data = {'photo_id': get_latest_photo_id_plusone(),
> 'contest_id': get_latest_contest_id_plusone(),
> 'ownername': 'SUMMERSON',
> }
> form=PhotoForm(request.POST, initial=data)
> if form.is_valid():
> Photo = form.save()
> else:
> form = PhotoForm()
>
>
> And the relevant functions:
>
>
>
> def get_latest_photo_id_plusone():
> max_rating = 
> Photo.objects.all().aggregate(Max('photo_id'))['photo_id__max']
> return max_rating+1
>
>
> def get_latest_contest_id_plusone():
> max_rating 
> =Photo.objects.all().aggregate(Max('contest_id'))['contest_id__max']
> return max_rating+1
>
>
>
> The error arises when I click on the send button after I select the image.
> It says:
>
> IntegrityError at /photo/create/
> NOT NULL constraint failed: photo_photo.contest_id_id
>
> But I've given the contest_id value. Haven't I? Where is the problem and
> how can I fix it?
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/57db225c-41bf-43d2-b9d8-ffb3174cddc7%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BFDnhJM1k8kk4ZudQsaH9QpsnAAHHHDbMYwLB09oTT0L2bfNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: NOT NULL constraint failed when trying to create form with initial values

2017-11-27 Thread Kubilay Yazoğlu
Yes, photo_id is PK. So I shouldn't even give its value to the form in 
initial values I guess? 

Contest_id isn't PK, I want to select a random contest id from contest 
objects. (I decided to do this just now, my former code does not include 
this :) )
By the way, contest_id is foreign key in Photo. It is a PK in Contest. What 
am I doing wrong now? It gives the exact same error.

items = Contest.objects.all()
random_item = random.choice(items)

if request.method =='POST':
data = {'contest_id': random_item.contest_id,
'ownername': 'SUMMERSON',
}
form=PhotoForm(request.POST, initial=data)
if form.is_valid():
Photo = form.save()
else:
form = PhotoForm()




28 Kasım 2017 Salı 00:04:25 UTC+3 tarihinde Matemática A3K yazdı:
>
> You shouldn't give the PK of new objects, leave that to Django. If 
> photo_id is the PK of Photo, don't set it, Django will on save.
>
> If the same goes for Contest, then do a "contest = Contest()" - create a 
> new contest - and assign it to the photo "photo.contest = contest", then 
> "photo.save" 
>
> On Mon, Nov 27, 2017 at 5:56 PM, Kubilay Yazoğlu  > wrote:
>
>> Hi. I'm trying to create a form to construct an object for my Photo 
>> class. All of the objects fields except the photo itself will be invisible 
>> to the user. So, the only thing can be seen in the form is the button to 
>> select and upload the photo.
>>
>> There is no problem with creating the form page. The problem is, giving 
>> the initial values for the rest of the fields. 
>> This is the relevant code in my view file:
>>
>>   
>>
>> if request.method =='POST':
>> data = {'photo_id': get_latest_photo_id_plusone(),
>> 'contest_id': get_latest_contest_id_plusone(),
>> 'ownername': 'SUMMERSON',
>> }
>> form=PhotoForm(request.POST, initial=data)
>> if form.is_valid():
>> Photo = form.save()
>> else:
>> form = PhotoForm()
>>
>>
>> And the relevant functions:
>>
>>   
>>
>> def get_latest_photo_id_plusone():
>> max_rating = 
>> Photo.objects.all().aggregate(Max('photo_id'))['photo_id__max']
>> return max_rating+1
>>
>>
>> def get_latest_contest_id_plusone():
>> max_rating 
>> =Photo.objects.all().aggregate(Max('contest_id'))['contest_id__max']
>> return max_rating+1
>>
>>
>>
>> The error arises when I click on the send button after I select the 
>> image. It says: 
>>
>> IntegrityError at /photo/create/
>> NOT NULL constraint failed: photo_photo.contest_id_id
>>
>> But I've given the contest_id value. Haven't I? Where is the problem and 
>> how can I fix it?
>>
>> -- 
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/57db225c-41bf-43d2-b9d8-ffb3174cddc7%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/abb4fb48-2c9f-4453-823a-c9def3053b59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: NOT NULL constraint failed when trying to create form with initial values

2017-11-27 Thread Matemática A3K
> items = Contest.objects.all()
> random_item = random.choice(items)
>
> if request.method =='POST':
> data = {'contest': random_item,
> 'ownername': 'SUMMERSON',
> }
> form=PhotoForm(request.POST, initial=data)
> if form.is_valid():
> photo = form.save()  # Instances go in lowercase, otherwise you are 
> doing it to the class
> else:
> form = PhotoForm()
>
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BFDnhLDx6Dih_N%3DLWBZPJiumNYvWAmm6Qt4psUTpCrYP1ykUA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: NOT NULL constraint failed when trying to create form with initial values

2017-11-27 Thread Kubilay Yazoğlu
Nice try but I'm still getting this error: IntegrityError at /photo/create/

NOT NULL constraint failed: photo_photo.contest_id_id


I tried with both 'contest': random_item  and 'contest_id': 
random_item.contest_id. (I don't know why you wrote contest instead of 
contest_id. Field name is contest_id)


28 Kasım 2017 Salı 01:03:50 UTC+3 tarihinde Matemática A3K yazdı:
>
>
> items = Contest.objects.all()
>> random_item = random.choice(items)
>>
>> if request.method =='POST':
>> data = {'contest': random_item,
>> 'ownername': 'SUMMERSON',
>> }
>> form=PhotoForm(request.POST, initial=data)
>> if form.is_valid():
>> photo = form.save()  # Instances go in lowercase, otherwise you are 
>> doing it to the class
>> else:
>> form = PhotoForm()
>>
>>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/87731060-75a6-44c6-8d1f-56cba6d22278%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: NOT NULL constraint failed when trying to create form with initial values

2017-11-27 Thread Matemática A3K
On Mon, Nov 27, 2017 at 7:18 PM, Kubilay Yazoğlu 
wrote:

> Nice try but I'm still getting this error: IntegrityError at
> /photo/create/
>
> NOT NULL constraint failed: photo_photo.contest_id_id
>
>
> I tried with both 'contest': random_item  and 'contest_id': 
> random_item.contest_id. (I don't know why you wrote contest instead of 
> contest_id. Field name is contest_id)
>
> That's because what you are passing is empty and the field is required.
Are you sure that you have Contest objects?

There is a convention in Django (models and ORM), "object.foreign_key"
gives you the object, while "object.foreign_key_id" gives you the id of
that object (and is what it is stored in the database). You should name
your field only "contest" for avoiding confusions.



>
> 28 Kasım 2017 Salı 01:03:50 UTC+3 tarihinde Matemática A3K yazdı:
>
>>
>> items = Contest.objects.all()
>>> random_item = random.choice(items)
>>>
>>> if request.method =='POST':
>>> data = {'contest': random_item,
>>> 'ownername': 'SUMMERSON',
>>> }
>>> form=PhotoForm(request.POST, initial=data)
>>> if form.is_valid():
>>> photo = form.save()  # Instances go in lowercase, otherwise you are 
>>> doing it to the class
>>> else:
>>> form = PhotoForm()
>>>
>>> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/87731060-75a6-44c6-8d1f-56cba6d22278%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BFDnhK%3Dkkjra0nXZ380%3D667xT0JwD8a2rmaPy0g%3DXEPU9Rx9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: NOT NULL constraint failed when trying to create form with initial values

2017-11-27 Thread Matemática A3K
On Mon, Nov 27, 2017 at 7:30 PM, Matemática A3K 
wrote:

>
>
> On Mon, Nov 27, 2017 at 7:18 PM, Kubilay Yazoğlu 
> wrote:
>
>> Nice try but I'm still getting this error: IntegrityError at
>> /photo/create/
>>
>> NOT NULL constraint failed: photo_photo.contest_id_id
>>
>>
>> I tried with both 'contest': random_item  and 'contest_id': 
>> random_item.contest_id. (I don't know why you wrote contest instead of 
>> contest_id. Field name is contest_id)
>>
>> That's because what you are passing is empty and the field is required.
> Are you sure that you have Contest objects?
>
> There is a convention in Django (models and ORM), "object.foreign_key"
> gives you the object, while "object.foreign_key_id" gives you the id of
> that object (and is what it is stored in the database). You should name
> your field only "contest" for avoiding confusions.
>

Try "contest_id": random_object



>
>
>
>>
>> 28 Kasım 2017 Salı 01:03:50 UTC+3 tarihinde Matemática A3K yazdı:
>>
>>>
>>> items = Contest.objects.all()
 random_item = random.choice(items)

 if request.method =='POST':
 data = {'contest': random_item,
 'ownername': 'SUMMERSON',
 }
 form=PhotoForm(request.POST, initial=data)
 if form.is_valid():
 photo = form.save()  # Instances go in lowercase, otherwise you 
 are doing it to the class
 else:
 form = PhotoForm()

 --
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/87731060-75a6-44c6-8d1f-56cba6d22278%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BFDnhLFdpf0Z%3DwSgtd3b7HTW_5xru7m963W%2Bo-g653RdX4w3Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: NOT NULL constraint failed when trying to create form with initial values

2017-11-27 Thread Kubilay Yazoğlu .
Oh, that's a life saver information. Thanks. I edited my code.
Unfortunately, only thing that has changed is the name of the error which
looks like this right now: NOT NULL constraint failed:
photo_photo.contest_id

I'm going to take a break and try to solve the problem tomorrow. I
appreciate your help.

On Tue, Nov 28, 2017 at 1:32 AM, Matemática A3K 
wrote:

>
>
> On Mon, Nov 27, 2017 at 7:30 PM, Matemática A3K 
> wrote:
>
>>
>>
>> On Mon, Nov 27, 2017 at 7:18 PM, Kubilay Yazoğlu 
>> wrote:
>>
>>> Nice try but I'm still getting this error: IntegrityError at
>>> /photo/create/
>>>
>>> NOT NULL constraint failed: photo_photo.contest_id_id
>>>
>>>
>>> I tried with both 'contest': random_item  and 'contest_id': 
>>> random_item.contest_id. (I don't know why you wrote contest instead of 
>>> contest_id. Field name is contest_id)
>>>
>>> That's because what you are passing is empty and the field is required.
>> Are you sure that you have Contest objects?
>>
>> There is a convention in Django (models and ORM), "object.foreign_key"
>> gives you the object, while "object.foreign_key_id" gives you the id of
>> that object (and is what it is stored in the database). You should name
>> your field only "contest" for avoiding confusions.
>>
>
> Try "contest_id": random_object
>
>
>
>>
>>
>>
>>>
>>> 28 Kasım 2017 Salı 01:03:50 UTC+3 tarihinde Matemática A3K yazdı:
>>>

 items = Contest.objects.all()
> random_item = random.choice(items)
>
> if request.method =='POST':
> data = {'contest': random_item,
> 'ownername': 'SUMMERSON',
> }
> form=PhotoForm(request.POST, initial=data)
> if form.is_valid():
> photo = form.save()  # Instances go in lowercase, otherwise you 
> are doing it to the class
> else:
> form = PhotoForm()
>
> --
>>> 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 https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/87731060-75a6-44c6-8d1f-56cba6d22278%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/EUOXhT4V9Is/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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CA%2BFDnhLFdpf0Z%3DwSgtd3b7HTW_
> 5xru7m963W%2Bo-g653RdX4w3Q%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALz%3DsVGYzWbk0%3DzoyMDa_3MB3co7CNiez00aX4kSfFOiyN2Mmw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels and multi-tenant will this be a world of hurt?

2017-11-27 Thread Filbert
Thanks again. One last question, in order to "multi-tenant-ify" Channels I 
think the challenge will be trickle the websocket "orgin" into the consumer 
from Daphne somehow as it seems there is no way to know in a consumer which 
tenant (unique domain) the message originated from. Without the domain you 
can't establish the Postgres schema, without the schema you have no tenant 
:-)

Please confirm this would be the approach or whether I am wrong-headed here.
Thanks.

On Sunday, November 26, 2017 at 9:58:58 AM UTC-5, Andrew Godwin wrote:
>
> I've never used attach-daemon so I can't help you there I'm afraid. As 
> long as it does sensible process-management things it's probably alright?
>
> Andrew
>
> On Sat, Nov 25, 2017 at 5:17 PM, Filbert > 
> wrote:
>
>> Andrew,
>> Thanks for the response. Seeing that I am keeping uWSGI for the 
>> non-websocket paths, any heartache with me starting daphne and the 
>> consumers using uWSGI's attach-daemon? I do this with celery and it is a 
>> convenient way to have everything for the App managed as a unit via a 
>> single /etc/init (upstart) conf file.
>> Thanks. 
>>
>> On Friday, November 24, 2017 at 7:10:29 PM UTC-5, Andrew Godwin wrote:
>>>
>>> Your assumptions all seem correct. Also consider that the security model 
>>> of WebSockets is... interesting, so securing a multi-tenant setup is going 
>>> to require a bit more work than you would merely doing the same for HTTP 
>>> requests.
>>>
>>> There are other non-Channels options around if you want to look into 
>>> them, but I suspect they'll all have similar architectural challenges.
>>>
>>> Andrew
>>>
>>> On Fri, Nov 24, 2017 at 3:09 PM, Filbert  wrote:
>>>
 Running multi-tenant site using a fork of Django tenant schemas with 
 tens of web servers and thousands of tenants

 Piloting a project to implement Channels for real-time notifications, 
 etc.

 I want to confirm these assumptions:

 1. Channels really has no support for multi-tenant, I will have to roll 
 my own.
 2. Since uWSGI is serving us well and (at this point) I wouldn't trust 
 Daphne to serve HTTP, I've got split paths in NGinx for uWSGI and ASGI.
 3. We are running RabbitMQ, so we have to cluster it and implement 
 channels using asgi_rabbitmq (Redis would just add yet another moving part)
 4. Plan on significant additional resource requirements on the web 
 server and serious scaling challenges.

 Are their any other non-Channels options, or is it the really the only 
 game in town?

 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...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/aae2725b-d873-40fd-ae09-d1668ab9e727%40googlegroups.com
  
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/d4906dc8-040b-4ee0-b11d-a7cc918b9e5d%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4d7c94f1-81ad-4949-a987-35f45b188c2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels and multi-tenant will this be a world of hurt?

2017-11-27 Thread Andrew Godwin
That would be correct (though please be aware Origin can be faked like host
headers, so don't use it as the sole point of security).

Is it not available via the headers list in the connect message?

Andrew

On Mon, Nov 27, 2017 at 2:58 PM, Filbert  wrote:

> Thanks again. One last question, in order to "multi-tenant-ify" Channels I
> think the challenge will be trickle the websocket "orgin" into the consumer
> from Daphne somehow as it seems there is no way to know in a consumer which
> tenant (unique domain) the message originated from. Without the domain you
> can't establish the Postgres schema, without the schema you have no tenant
> :-)
>
> Please confirm this would be the approach or whether I am wrong-headed
> here.
> Thanks.
>
> On Sunday, November 26, 2017 at 9:58:58 AM UTC-5, Andrew Godwin wrote:
>>
>> I've never used attach-daemon so I can't help you there I'm afraid. As
>> long as it does sensible process-management things it's probably alright?
>>
>> Andrew
>>
>> On Sat, Nov 25, 2017 at 5:17 PM, Filbert  wrote:
>>
>>> Andrew,
>>> Thanks for the response. Seeing that I am keeping uWSGI for the
>>> non-websocket paths, any heartache with me starting daphne and the
>>> consumers using uWSGI's attach-daemon? I do this with celery and it is a
>>> convenient way to have everything for the App managed as a unit via a
>>> single /etc/init (upstart) conf file.
>>> Thanks.
>>>
>>> On Friday, November 24, 2017 at 7:10:29 PM UTC-5, Andrew Godwin wrote:

 Your assumptions all seem correct. Also consider that the security
 model of WebSockets is... interesting, so securing a multi-tenant setup is
 going to require a bit more work than you would merely doing the same for
 HTTP requests.

 There are other non-Channels options around if you want to look into
 them, but I suspect they'll all have similar architectural challenges.

 Andrew

 On Fri, Nov 24, 2017 at 3:09 PM, Filbert  wrote:

> Running multi-tenant site using a fork of Django tenant schemas with
> tens of web servers and thousands of tenants
>
> Piloting a project to implement Channels for real-time notifications,
> etc.
>
> I want to confirm these assumptions:
>
> 1. Channels really has no support for multi-tenant, I will have to
> roll my own.
> 2. Since uWSGI is serving us well and (at this point) I wouldn't trust
> Daphne to serve HTTP, I've got split paths in NGinx for uWSGI and ASGI.
> 3. We are running RabbitMQ, so we have to cluster it and implement
> channels using asgi_rabbitmq (Redis would just add yet another moving 
> part)
> 4. Plan on significant additional resource requirements on the web
> server and serious scaling challenges.
>
> Are their any other non-Channels options, or is it the really the only
> game in town?
>
> 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...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/aae2725b-d873
> -40fd-ae09-d1668ab9e727%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

 --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/d4906dc8-040b-4ee0-b11d-a7cc918b9e5d%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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/4d7c94f1-81ad-4949-a987-35f45b188c2f%40googlegroups.com
> 

Does django work with bootstrap 4

2017-11-27 Thread Gordon Neal
Looking to start a web design projects and as a python programmer I would like 
to use django but it seems difficult. I am planning on using bs v 4 with Sass. 
This is a new project. Any solution so I don't have to learn the whole ruby stuf

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f71c4a1a-8cad-4927-b826-15aebc9bf58c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: NOT NULL constraint failed when trying to create form with initial values

2017-11-27 Thread Matemática A3K
On Mon, Nov 27, 2017 at 7:58 PM, Kubilay Yazoğlu . 
wrote:

> Oh, that's a life saver information. Thanks. I edited my code.
> Unfortunately, only thing that has changed is the name of the error which
> looks like this right now: NOT NULL constraint failed:
> photo_photo.contest_id
>
> I'm going to take a break and try to solve the problem tomorrow. I
> appreciate your help.
>

Alright, for tomorrow then:

I don't usually use "initial" but if you are excluding (or not including)
the field in the form, "initial" would not be useful. A workaround would be:


if form.is_valid():
photo = form.save(commit=False)

photo.contest = random_item

photo.owner = 'SUMMERSON'

photo.save()



>
> On Tue, Nov 28, 2017 at 1:32 AM, Matemática A3K 
> wrote:
>
>>
>>
>> On Mon, Nov 27, 2017 at 7:30 PM, Matemática A3K > > wrote:
>>
>>>
>>>
>>> On Mon, Nov 27, 2017 at 7:18 PM, Kubilay Yazoğlu 
>>> wrote:
>>>
 Nice try but I'm still getting this error: IntegrityError at
 /photo/create/

 NOT NULL constraint failed: photo_photo.contest_id_id


 I tried with both 'contest': random_item  and 'contest_id': 
 random_item.contest_id. (I don't know why you wrote contest instead of 
 contest_id. Field name is contest_id)

 That's because what you are passing is empty and the field is required.
>>> Are you sure that you have Contest objects?
>>>
>>> There is a convention in Django (models and ORM), "object.foreign_key"
>>> gives you the object, while "object.foreign_key_id" gives you the id of
>>> that object (and is what it is stored in the database). You should name
>>> your field only "contest" for avoiding confusions.
>>>
>>
>> Try "contest_id": random_object
>>
>>
>>
>>>
>>>
>>>

 28 Kasım 2017 Salı 01:03:50 UTC+3 tarihinde Matemática A3K yazdı:

>
> items = Contest.objects.all()
>> random_item = random.choice(items)
>>
>> if request.method =='POST':
>> data = {'contest': random_item,
>> 'ownername': 'SUMMERSON',
>> }
>> form=PhotoForm(request.POST, initial=data)
>> if form.is_valid():
>> photo = form.save()  # Instances go in lowercase, otherwise you 
>> are doing it to the class
>> else:
>> form = PhotoForm()
>>
>> --
 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 https://groups.google.com/group/django-users.
 To view this discussion on the web visit https://groups.google.com/d/ms
 gid/django-users/87731060-75a6-44c6-8d1f-56cba6d22278%40goog
 legroups.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/to
>> pic/django-users/EUOXhT4V9Is/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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/CA%2BFDnhLFdpf0Z%3DwSgtd3b7HTW_5xru7m963W%
>> 2Bo-g653RdX4w3Q%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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CALz%3DsVGYzWbk0%3DzoyMDa_
> 3MB3co7CNiez00aX4kSfFOiyN2Mmw%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+unsubsc

Re: Does django work with bootstrap 4

2017-11-27 Thread Andréas Kühne
Hi,

You don't have to learn any ruby to use sass. I prefer sass when I create
my css files. You do however need to know howto compile scss files into
css. You should be able to find howtos on google. You could also try:
https://github.com/jrief/django-sass-processor, then you don't even have to
learn howto compile them. However you need to understand the format of the
files and also install the dependencies to compile the scss files.

Regarding using bootstrap 4, a quick google got me the following package:
https://github.com/zostera/django-bootstrap4, I haven't tried it myself
though. I have used the bootstrap 3 plugins and they are great because you
can easily get your forms correctly styled.

If you find using django itself difficult, I would recommend that you do
one (or several) of the online tutorials that are available:
https://docs.djangoproject.com/en/1.11/intro/tutorial01/
https://tutorial.djangogirls.org/en/

The main thing to learn is how the different components in django are
connected.

Good luck!

Regards,

Andréas

2017-11-27 23:11 GMT+01:00 Gordon Neal :

> Looking to start a web design projects and as a python programmer I would
> like to use django but it seems difficult. I am planning on using bs v 4
> with Sass. This is a new project. Any solution so I don't have to learn the
> whole ruby stuf
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/f71c4a1a-8cad-4927-b826-15aebc9bf58c%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCd71Fn5m7UrehW%2BqcVQZ0nFEUWaiEbedVn1f3A42Des1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels and multi-tenant will this be a world of hurt?

2017-11-27 Thread Filbert
Sorry, yeah dig before I post :-|  Can create a class-based consumer and 
use the message->headers->host. I'll get chest deep before ask another 
question.

On Monday, November 27, 2017 at 6:04:48 PM UTC-5, Andrew Godwin wrote:
>
> That would be correct (though please be aware Origin can be faked like 
> host headers, so don't use it as the sole point of security).
>
> Is it not available via the headers list in the connect message?
>
> Andrew
>
> On Mon, Nov 27, 2017 at 2:58 PM, Filbert > 
> wrote:
>
>> Thanks again. One last question, in order to "multi-tenant-ify" Channels 
>> I think the challenge will be trickle the websocket "orgin" into the 
>> consumer from Daphne somehow as it seems there is no way to know in a 
>> consumer which tenant (unique domain) the message originated from. Without 
>> the domain you can't establish the Postgres schema, without the schema you 
>> have no tenant :-)
>>
>> Please confirm this would be the approach or whether I am wrong-headed 
>> here.
>> Thanks.
>>
>> On Sunday, November 26, 2017 at 9:58:58 AM UTC-5, Andrew Godwin wrote:
>>>
>>> I've never used attach-daemon so I can't help you there I'm afraid. As 
>>> long as it does sensible process-management things it's probably alright?
>>>
>>> Andrew
>>>
>>> On Sat, Nov 25, 2017 at 5:17 PM, Filbert  wrote:
>>>
 Andrew,
 Thanks for the response. Seeing that I am keeping uWSGI for the 
 non-websocket paths, any heartache with me starting daphne and the 
 consumers using uWSGI's attach-daemon? I do this with celery and it is a 
 convenient way to have everything for the App managed as a unit via a 
 single /etc/init (upstart) conf file.
 Thanks. 

 On Friday, November 24, 2017 at 7:10:29 PM UTC-5, Andrew Godwin wrote:
>
> Your assumptions all seem correct. Also consider that the security 
> model of WebSockets is... interesting, so securing a multi-tenant setup 
> is 
> going to require a bit more work than you would merely doing the same for 
> HTTP requests.
>
> There are other non-Channels options around if you want to look into 
> them, but I suspect they'll all have similar architectural challenges.
>
> Andrew
>
> On Fri, Nov 24, 2017 at 3:09 PM, Filbert  wrote:
>
>> Running multi-tenant site using a fork of Django tenant schemas with 
>> tens of web servers and thousands of tenants
>>
>> Piloting a project to implement Channels for real-time notifications, 
>> etc.
>>
>> I want to confirm these assumptions:
>>
>> 1. Channels really has no support for multi-tenant, I will have to 
>> roll my own.
>> 2. Since uWSGI is serving us well and (at this point) I wouldn't 
>> trust Daphne to serve HTTP, I've got split paths in NGinx for uWSGI and 
>> ASGI.
>> 3. We are running RabbitMQ, so we have to cluster it and implement 
>> channels using asgi_rabbitmq (Redis would just add yet another moving 
>> part)
>> 4. Plan on significant additional resource requirements on the web 
>> server and serious scaling challenges.
>>
>> Are their any other non-Channels options, or is it the really the 
>> only game in town?
>>
>> 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...@googlegroups.com.
>> To post to this group, send email to django...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/aae2725b-d873-40fd-ae09-d1668ab9e727%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> -- 
 You received this message because you are subscribed to the Google 
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to django-users...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/d4906dc8-040b-4ee0-b11d-a7cc918b9e5d%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 a

Re: django-allauth facebook doesn't collect more information other than "name" and "id"

2017-11-27 Thread Shahab Emami
hello 

i have the same problem but for the google.

this is my settings:
SOCIALACCOUNT_PROVIDERS = { 'google':
 { 'SCOPE': ['email',

 'https://www.googleapis.com/auth/user.birthday.read',

 'https://www.googleapis.com/auth/user.phonenumbers.read',
 'https://www.googleapis.com/auth/contacts',
 'https://www.googleapis.com/auth/plus.me',
 ],
   'AUTH_PARAMS': { 'access_type': 'online' },
   'FIELDS': [
'birthday',
'phonenumbers'
],
 },


  }

but i don't get phone number  and birthday in extra_data
i'm am sure google is sending them because he asked about sending phone 
number and birthday 
can you heop me in this?plz

my environment is
ubunto 16
python 3.5
django 1.11
django-allauth 0.34.0

On Monday, November 2, 2015 at 3:57:32 PM UTC+3:30, Saleem Jaffer wrote:
>
> I tried adding facebook login to my application using django-allauth. 
> Unfortunately the only fields that get captured are "name" and "id". All 
> the other information is not captured.
>
> This issue has already been addressed here: 
> https://github.com/pennersr/django-allauth/issues/1061.
>
> Supposedly, using django-allauth version 0.22 and higher should solve 
> this. But I am using 0.23 and still the issue persists. 
>
> Any help will be appreciated!
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7a4202b7-17c8-439e-9234-0b1e61dce632%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Help login() session always expire on new migrated apache server

2017-11-27 Thread dk . dannykurniawan
Hello,

I used django login() in some code and it worked now in current server.

Odd enough that in new server (migrated), the login session gone when i check 
with @login_required. Keep asking to login.

The server have the same apache config with old server. Please help. Thank you

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


Error on execute migration (create index) when set db_name with quoted string

2017-11-27 Thread Carlos Leite
I was making some introspections on meta attributes from a Model class
jsut to check what changes when we set some attributes on Meta class and 
etc...


TO check the Meta.db_name
I read the docs and saw that I could use quoted strings as told ..


"
... o prevent such transformations, use a quoted name as the value for 
db_table:

> db_table = '"name_left_in_lowercase"' 

 Such quoted names can also be used with Django’s other supported database 
backends; except for Oracle, however, the quotes have no effect. See the Oracle 
notes  
for more details.
"
at https://docs.djangoproject.com/en/1.8/ref/models/options/#db-table


Well, when I tried to *migrate* I got the error, during the index creation, 
described below.
Is it a bug ? or I miss soething ?
I just tried to set a custom name for a table, with quotes and hyphens 8P


'"big_name-with-hyphen-left_in_lowercase"'

the error hapends when PostgreSQL tries to create an index and Django named 
with part of the tables name. 


### The Model Class


class Publisher(models.Model):
"""
Book's Author - author is a Book's model supplement.
"""
name = models.CharField(verbose_name='publisher name', max_length=50, 
null=False)


class Meta:
db_table = '"big_name-with-hyphen-left_in_lowercase"'
get_latest_by = "name"
ordering = ['name', ]
verbose_name = 'Publiser'
verbose_name_plural = 'Publishers'
indexes = [
models.Index(fields=['name', ]),
]




### The Migration 0007


# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-11-28 03:15
from __future__ import unicode_literals


from django.db import migrations, models




class Migration(migrations.Migration):


dependencies = [
('testapp', '0006_auto_20171127_1927'),
]


operations = [
migrations.RemoveIndex(
model_name='publisher',
name='testapp_pub_name_88e073_idx',
),
migrations.AddIndex(
model_name='publisher',
index=models.Index(fields=['name'], name='"big_name-w_name_cd0539_idx'),
),
migrations.AlterModelTable(
name='publisher',
table='"big_name-with-hyphen-left_in_lowercase"',
),
]




### traceback


$python manage.py makemigrations
System check identified some issues:


Migrations for 'testapp':
testproject/testapp/migrations/0007_auto_20171128_0315.py
- Remove index testapp_pub_name_88e073_idx from publisher
- Create index "big_name-w_name_cd0539_idx on field(s) name of model 
publisher
- Rename table for publisher to "big_name-with-hyphen-left_in_lowercase"
(dj_datadictionary) 
20171125.Sat01:15:52cadu>/Volumes/p10G/prj/dj_datadictionary_testproject/testproject>




$python manage.py migrate
System check identified some issues:


Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions, testapp
Running migrations:
Applying testapp.0007_auto_20171128_0315...Traceback (most recent call 
last):
File "manage.py", line 22, in 
execute_from_command_line(sys.argv)
File 
"/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 363, in execute_from_command_line
utility.execute()
File 
"/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File 
"/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/core/management/base.py",
 
line 283, in run_from_argv
self.execute(*args, **cmd_options)
File 
"/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/core/management/base.py",
 
line 330, in execute
output = self.handle(*args, **options)
File 
"/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
 
line 204, in handle
fake_initial=fake_initial,
File 
"/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/db/migrations/executor.py",
 
line 115, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, 
fake_initial=fake_initial)
File 
"/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/db/migrations/executor.py",
 
line 145, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, 
fake_initial=fake_initial)
File 
"/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/db/migrations/executor.py",
 
line 244, in apply_migration
state = migration.apply(state, schema_editor)
File 
"/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/db/migrations/migration.py",
 
line 129, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, 
project_state)
File 
"/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/db/migrations/operations/models.py",
 
line 785, in database_forwards
schema_editor.add_index(model, self.index)
File 
"/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/db/backends/base/schema.py",
 
line 330, in add_index
self.execute(index.create_sql(model, self))
File 
"/Users/cadu/Envs/dj_d

Re: Error on execute migration (create index) when set db_name with quoted string

2017-11-27 Thread Carlos Leite
ooops 


in the migration 0007 the index name seems badly formed 

```python 
   ...
migrations.AddIndex(
model_name='publisher',
index=models.Index(fields=['name'], 
name='"big_name-w_name_cd0539_idx'),   # <<<  there is a " in plus. and 
its never closed. 
),
```

On Tuesday, November 28, 2017 at 2:01:56 AM UTC-2, Carlos Leite wrote:
>
> I was making some introspections on meta attributes from a Model class
> jsut to check what changes when we set some attributes on Meta class and 
> etc...
>
>
> TO check the Meta.db_name
> I read the docs and saw that I could use quoted strings as told ..
>
>
> "
> ... o prevent such transformations, use a quoted name as the value for 
> db_table:
>
> > db_table = '"name_left_in_lowercase"' 
>
>  Such quoted names can also be used with Django’s other supported database 
> backends; except for Oracle, however, the quotes have no effect. See the 
> Oracle 
> notes  
> for more details.
> "
> at https://docs.djangoproject.com/en/1.8/ref/models/options/#db-table
>
>
> Well, when I tried to *migrate* I got the error, during the index 
> creation, described below.
> Is it a bug ? or I miss soething ?
> I just tried to set a custom name for a table, with quotes and hyphens 8P
>
>
> '"big_name-with-hyphen-left_in_lowercase"'
>
> the error hapends when PostgreSQL tries to create an index and Django 
> named with part of the tables name. 
>
>
> ### The Model Class
>
>
> class Publisher(models.Model):
> """
> Book's Author - author is a Book's model supplement.
> """
> name = models.CharField(verbose_name='publisher name', max_length=50, 
> null=False)
>
>
> class Meta:
> db_table = '"big_name-with-hyphen-left_in_lowercase"'
> get_latest_by = "name"
> ordering = ['name', ]
> verbose_name = 'Publiser'
> verbose_name_plural = 'Publishers'
> indexes = [
> models.Index(fields=['name', ]),
> ]
>
>
>
>
> ### The Migration 0007
>
>
> # -*- coding: utf-8 -*-
> # Generated by Django 1.11 on 2017-11-28 03:15
> from __future__ import unicode_literals
>
>
> from django.db import migrations, models
>
>
>
>
> class Migration(migrations.Migration):
>
>
> dependencies = [
> ('testapp', '0006_auto_20171127_1927'),
> ]
>
>
> operations = [
> migrations.RemoveIndex(
> model_name='publisher',
> name='testapp_pub_name_88e073_idx',
> ),
> migrations.AddIndex(
> model_name='publisher',
> index=models.Index(fields=['name'], name='"big_name-w_name_cd0539_idx'),
> ),
> migrations.AlterModelTable(
> name='publisher',
> table='"big_name-with-hyphen-left_in_lowercase"',
> ),
> ]
>
>
>
>
> ### traceback
>
>
> $python manage.py makemigrations
> System check identified some issues:
>
>
> Migrations for 'testapp':
> testproject/testapp/migrations/0007_auto_20171128_0315.py
> - Remove index testapp_pub_name_88e073_idx from publisher
> - Create index "big_name-w_name_cd0539_idx on field(s) name of model 
> publisher
> - Rename table for publisher to "big_name-with-hyphen-left_in_lowercase"
> (dj_datadictionary) 
> 20171125.Sat01:15:52cadu>/Volumes/p10G/prj/dj_datadictionary_testproject/testproject>
>
>
>
>
> $python manage.py migrate
> System check identified some issues:
>
>
> Operations to perform:
> Apply all migrations: admin, auth, contenttypes, sessions, testapp
> Running migrations:
> Applying testapp.0007_auto_20171128_0315...Traceback (most recent call 
> last):
> File "manage.py", line 22, in 
> execute_from_command_line(sys.argv)
> File 
> "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/core/management/__init__.py",
>  
> line 363, in execute_from_command_line
> utility.execute()
> File 
> "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/core/management/__init__.py",
>  
> line 355, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
> File 
> "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/core/management/base.py",
>  
> line 283, in run_from_argv
> self.execute(*args, **cmd_options)
> File 
> "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/core/management/base.py",
>  
> line 330, in execute
> output = self.handle(*args, **options)
> File 
> "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
>  
> line 204, in handle
> fake_initial=fake_initial,
> File 
> "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/db/migrations/executor.py",
>  
> line 115, in migrate
> state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, 
> fake_initial=fake_initial)
> File 
> "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/db/migrations/executor.py",
>  
> line 145, in _migrate_all_forwards
> state = self.apply_migration(state, migration, fake=fake, 
> fake_initial=fake_initial)
> File 
> "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/db/migrations/executor.py",
>  
> line 244, in apply_migration
> 

Re: Error on execute migration (create index) when set db_name with quoted string

2017-11-27 Thread Simon Charette
Hey Carlos,

I believe the trailing quote truncation issue might be solved in the yet to 
be released
1.11.8[0][1] version.

Could you confirm whether or not it's the case? You'll have to regenerate 
your migration.

Best,
Simon

[0] 
https://github.com/django/django/commit/a35ab95ed4eec5c62fa19bdc69ecfe0eff3e1fca
[1] https://code.djangoproject.com/ticket/28792

Le lundi 27 novembre 2017 23:24:59 UTC-5, Carlos Leite a écrit :
>
> ooops 
>
>
> in the migration 0007 the index name seems badly formed 
>
> ```python 
>...
> migrations.AddIndex(
> model_name='publisher',
> index=models.Index(fields=['name'], 
> name='"big_name-w_name_cd0539_idx'),   # <<<  there is a " in plus. and 
> its never closed. 
> ),
> ```
>
> On Tuesday, November 28, 2017 at 2:01:56 AM UTC-2, Carlos Leite wrote:
>>
>> I was making some introspections on meta attributes from a Model class
>> jsut to check what changes when we set some attributes on Meta class and 
>> etc...
>>
>>
>> TO check the Meta.db_name
>> I read the docs and saw that I could use quoted strings as told ..
>>
>>
>> "
>> ... o prevent such transformations, use a quoted name as the value for 
>> db_table:
>>
>> > db_table = '"name_left_in_lowercase"' 
>>
>>  Such quoted names can also be used with Django’s other supported 
>> database backends; except for Oracle, however, the quotes have no effect. 
>> See the Oracle notes 
>>  for 
>> more details.
>> "
>> at https://docs.djangoproject.com/en/1.8/ref/models/options/#db-table
>>
>>
>> Well, when I tried to *migrate* I got the error, during the index 
>> creation, described below.
>> Is it a bug ? or I miss soething ?
>> I just tried to set a custom name for a table, with quotes and hyphens 8P
>>
>>
>> '"big_name-with-hyphen-left_in_lowercase"'
>>
>> the error hapends when PostgreSQL tries to create an index and Django 
>> named with part of the tables name. 
>>
>>
>> ### The Model Class
>>
>>
>> class Publisher(models.Model):
>> """
>> Book's Author - author is a Book's model supplement.
>> """
>> name = models.CharField(verbose_name='publisher name', max_length=50, 
>> null=False)
>>
>>
>> class Meta:
>> db_table = '"big_name-with-hyphen-left_in_lowercase"'
>> get_latest_by = "name"
>> ordering = ['name', ]
>> verbose_name = 'Publiser'
>> verbose_name_plural = 'Publishers'
>> indexes = [
>> models.Index(fields=['name', ]),
>> ]
>>
>>
>>
>>
>> ### The Migration 0007
>>
>>
>> # -*- coding: utf-8 -*-
>> # Generated by Django 1.11 on 2017-11-28 03:15
>> from __future__ import unicode_literals
>>
>>
>> from django.db import migrations, models
>>
>>
>>
>>
>> class Migration(migrations.Migration):
>>
>>
>> dependencies = [
>> ('testapp', '0006_auto_20171127_1927'),
>> ]
>>
>>
>> operations = [
>> migrations.RemoveIndex(
>> model_name='publisher',
>> name='testapp_pub_name_88e073_idx',
>> ),
>> migrations.AddIndex(
>> model_name='publisher',
>> index=models.Index(fields=['name'], name='"big_name-w_name_cd0539_idx'),
>> ),
>> migrations.AlterModelTable(
>> name='publisher',
>> table='"big_name-with-hyphen-left_in_lowercase"',
>> ),
>> ]
>>
>>
>>
>>
>> ### traceback
>>
>>
>> $python manage.py makemigrations
>> System check identified some issues:
>>
>>
>> Migrations for 'testapp':
>> testproject/testapp/migrations/0007_auto_20171128_0315.py
>> - Remove index testapp_pub_name_88e073_idx from publisher
>> - Create index "big_name-w_name_cd0539_idx on field(s) name of model 
>> publisher
>> - Rename table for publisher to "big_name-with-hyphen-left_in_lowercase"
>> (dj_datadictionary) 
>> 20171125.Sat01:15:52cadu>/Volumes/p10G/prj/dj_datadictionary_testproject/testproject>
>>
>>
>>
>>
>> $python manage.py migrate
>> System check identified some issues:
>>
>>
>> Operations to perform:
>> Apply all migrations: admin, auth, contenttypes, sessions, testapp
>> Running migrations:
>> Applying testapp.0007_auto_20171128_0315...Traceback (most recent call 
>> last):
>> File "manage.py", line 22, in 
>> execute_from_command_line(sys.argv)
>> File 
>> "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/core/management/__init__.py",
>>  
>> line 363, in execute_from_command_line
>> utility.execute()
>> File 
>> "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/core/management/__init__.py",
>>  
>> line 355, in execute
>> self.fetch_command(subcommand).run_from_argv(self.argv)
>> File 
>> "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/core/management/base.py",
>>  
>> line 283, in run_from_argv
>> self.execute(*args, **cmd_options)
>> File 
>> "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/core/management/base.py",
>>  
>> line 330, in execute
>> output = self.handle(*args, **options)
>> File 
>> "/Users/cadu/Envs/dj_datadictionary/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
>>  
>> line 204, in handle
>> fake_initial=fake_initial,
>> File 

FileField - not stored to disk when using mod_wsgi?

2017-11-27 Thread Joakim Hove
 I ave django file upload application. I have a model looking like this:

class BaseFile(Model):
input_name = CharField( max_length = 132 )
content = FileField( upload_to = "%Y/%m/%d" )
upload_time = DateTimeField( auto_now_add=True )
owner_group = CharField( max_length = 32 , default = None )


In the settings.py file I have set:


MEDIA_ROOT = "/tmp/storage"


When I use this with the development server things seem to work, I can 
upload files and if I go to the /tmp/storage directory I can see the 
%Y/%m/%d directories created and populated with my files.

When I try this using Apache and mod_wsgi things also seem to work:

   1. The HTTP POST returns status 200.
   2. A subsequent GET will return the files in question.

But - when I go the /tmp/storage directory there are no directories/files 
to be found and if I stop and start Apache the GET will fail with:


IOError: No such file: /tmp/storage/2017/11/27/FILEX_Z1OZMf8 


So - it seems to me that Django keeps the files in memory when using 
mod_wsgi? I am using 100% default Django settings when it comes to storage 
backend. I see no errors in the Apache log.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6ed264e4-144f-4943-aa28-a155da21366c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.