How To Set Up Django with Postgres, Nginx, and Gunicorn on DIGITAL OCEAN

2019-01-15 Thread Shareef 617
How To Set Up Django with Postgres, Nginx, and Gunicorn on digital ocean

-- 
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/bd457ccd-184e-4648-be54-4dab20c88a35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to use oauth2client in django 2.0 for google login new user and exiting user

2019-01-15 Thread Manas Nikam
Create a view to accept the auth token from Google and pass it to your
authentication backend (Register the GoogleAuthBackend in settings first)
verify the token in the backend and return the user from db if email exists
else create a new user and return the token and pass this user object to
login function from django.contrib.auth.login function and start his
session in there

On Wed, Jan 16, 2019, 12:18 PM arvind yadav  how to use google  oauth2client for new user and exiting user  in django
> help help me any share any link
>
> --
> 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/501631fa-85bc-4364-8a11-23ce519be57c%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/CAF%2BYYc5J8U9nxk4u%3D1zn2d9TugByT3Xw9TXZR%2BPg7obPn4O8aQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin problem launching a non-Admin page

2019-01-15 Thread Mike Dewhirst

Many thanks Derek - I have started reading ...

Mike

On 16/01/2019 4:39 pm, Derek wrote:

Hi Mike

Normally I have just used the functionality in a third-party admin 
"wrapper", for example, Django Suit 
(https://django-suit.readthedocs.io/en/develop/configuration.html#id1).


I see others such as Jet 
(https://jet.readthedocs.io/en/latest/dashboard_custom_module.html) 
allow you to do the same.


Maybe you can get some ideas from them?  Basically you can create your 
own view and use that to display data in a template that inherits 
from, for example, the Django admin form template. A bit tricky first 
time but then it seems straightforward.


Derek

On Tuesday, 15 January 2019 11:02:30 UTC+2, Mike Dewhirst wrote:

I'm studying the Admin docs trying to figure out how to launch a
non-Admin page when required.

Django 1.11 and Pythons 2.7/3.6

The parts which look promising are ...
[1]    ModelAdmin.response_add()
[2] ModelAdmin.response_change()
[3]    ModelAdmin.add_view()
[4]    ModelAdmin.change_view()
and
[5]    admin.ModelAdmin.form

The use-case is ...after saving, detect whether a token (from a
payment
gateway) exists in a subscription record and if not, launch a
non-Admin
Django page/form to interface with the payment gateway.

I have tried unsuccessfully to launch any of a form, view or template
from the model save() method.

Has anyone had a similar Admin use-case and found a good way of
tackling it?

Thanks for any suggestions

Mike

[1]

https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.response_add



[2]

https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.response_change



[3]

https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.add_view



[4]

https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.change_view



[5]

https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#adding-custom-validation-to-the-admin




--
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/9648a8b7-994d-41fe-9d3e-77f83f61c600%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/81f1fe0a-7b9d-af95-8d31-ddc5b4d8414e%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Problem with testing on Travis CI

2019-01-15 Thread אורי
Hi,

I recently have problems with testing my project on Travis CI. Tests
started to fail 2 days ago. The error message is
`psycopg2.OperationalError: FATAL:  database "speedy" does not exist` and I
don't know why. It seems to me that the first test which fail for this
reason is https://travis-ci.org/speedy-net/speedy-net/builds/479248003 and
the commit is
https://github.com/speedy-net/speedy-net/commit/04c4c891f64c4eee3accc393e59b5d18f0c8bbcc,
but I don't know what in this commit causes the tests to fail. When I run
the tests locally they run without problems. Do you know why our tests fail
on Travis CI?

Thanks,
אורי (Uri)
u...@speedy.net

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


how to use oauth2client in django 2.0 for google login new user and exiting user

2019-01-15 Thread arvind yadav
how to use google  oauth2client for new user and exiting user  in django 
help help me any share any link

-- 
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/501631fa-85bc-4364-8a11-23ce519be57c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin problem launching a non-Admin page

2019-01-15 Thread Derek
Hi Mike

Normally I have just used the functionality in a third-party admin 
"wrapper", for example, Django Suit  
(https://django-suit.readthedocs.io/en/develop/configuration.html#id1).

I see others such as Jet 
(https://jet.readthedocs.io/en/latest/dashboard_custom_module.html) allow 
you to do the same.

Maybe you can get some ideas from them?  Basically you can create your own 
view and use that to display data in a template that inherits from, for 
example, the Django admin form template. A bit tricky first time but then 
it seems straightforward.

Derek

On Tuesday, 15 January 2019 11:02:30 UTC+2, Mike Dewhirst wrote:
>
> I'm studying the Admin docs trying to figure out how to launch a 
> non-Admin page when required. 
>
> Django 1.11 and Pythons 2.7/3.6 
>
> The parts which look promising are ... 
> [1]ModelAdmin.response_add() 
> [2] ModelAdmin.response_change() 
> [3]ModelAdmin.add_view() 
> [4]ModelAdmin.change_view() 
> and 
> [5]admin.ModelAdmin.form 
>
> The use-case is ...after saving, detect whether a token (from a payment 
> gateway) exists in a subscription record and if not, launch a non-Admin 
> Django page/form to interface with the payment gateway. 
>
> I have tried unsuccessfully to launch any of a form, view or template 
> from the model save() method. 
>
> Has anyone had a similar Admin use-case and found a good way of tackling 
> it? 
>
> Thanks for any suggestions 
>
> Mike 
>
> [1] 
>
> https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.response_add
>  
> [2] 
>
> https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.response_change
>  
> [3] 
>
> https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.add_view
>  
> [4] 
>
> https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.change_view
>  
> [5] 
>
> https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#adding-custom-validation-to-the-admin
>  
>

-- 
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/9648a8b7-994d-41fe-9d3e-77f83f61c600%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Single Sign On (SSO) across multiple django projects

2019-01-15 Thread Manas Nikam
Check Json Web Token.
jwt.io

On Wed, Jan 16, 2019, 9:43 AM Dennis Sepeur  Hi, I've developed an monolithic django project over the last 5 years. My
> team and I now want to add a new component to the software.
> The new component will be mostly independent, but need to share
> authentication and authorization at the least. For the end-user both the
> existing and the new component shall appear as one software, where a shared
> navigation moves the user from one component to another without the
> end-user noticing.
> I was researching for a while and came across django-oauth-toolkit,
> django-simple-sso, django-mama-cas and python-saml.
> As I see it,
> - OAuth2 is the standard nowadays for authorization via API. But doesn't
> seem to be the right solution for SSO across multiple django projects (or
> apps. We haven't decided yet, if projects or apps)
> - CAS seems to lose traction in in the market and I do not want to bet on
> a dying horse, but it kinda seems like the right solution for my challenge.
> - SAML seems to lose traction as well and I'm not even sure if it's the
> right approach. Also i can only find a "python" package, not a "django"
> package.
> - simple-sso seems to to what I want, but I can't find any relation to
> open standards that are being further developed, which would give me the
> confidence, that is it secure
>
> Do you have an opinion or do you know the preferred/common approach to
> have single-sign-on across multiple django projects/apps.
> Thanks in advance. Any help is appreciated
>
> armadarama
>
> --
> 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/90fe9d94-3057-4d48-9b3b-b1d5fb89dd59%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/CAF%2BYYc5geQ-ttiZjUaqcQaXnjgdiU1pWmz4sfgxNh5t%3DQ0-jHA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Single Sign On (SSO) across multiple django projects

2019-01-15 Thread Dennis Sepeur
Hi, I've developed an monolithic django project over the last 5 years. My 
team and I now want to add a new component to the software.
The new component will be mostly independent, but need to share 
authentication and authorization at the least. For the end-user both the 
existing and the new component shall appear as one software, where a shared 
navigation moves the user from one component to another without the 
end-user noticing. 
I was researching for a while and came across django-oauth-toolkit, 
django-simple-sso, django-mama-cas and python-saml. 
As I see it,
- OAuth2 is the standard nowadays for authorization via API. But doesn't 
seem to be the right solution for SSO across multiple django projects (or 
apps. We haven't decided yet, if projects or apps)
- CAS seems to lose traction in in the market and I do not want to bet on a 
dying horse, but it kinda seems like the right solution for my challenge.
- SAML seems to lose traction as well and I'm not even sure if it's the 
right approach. Also i can only find a "python" package, not a "django" 
package.
- simple-sso seems to to what I want, but I can't find any relation to open 
standards that are being further developed, which would give me the 
confidence, that is it secure

Do you have an opinion or do you know the preferred/common approach to have 
single-sign-on across multiple django projects/apps.
Thanks in advance. Any help is appreciated

armadarama

-- 
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/90fe9d94-3057-4d48-9b3b-b1d5fb89dd59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


No module named django.core.wsgi, Apache+ CentOS

2019-01-15 Thread ANi
Hey guys.
I am trying to deploy my Django project on CentOS 7 with Apache.
and I got an error of  *ImportError: No module named django.core.wsgi*
I think it is because the Apache did not use the python version inside the 
virtualenv
However I dont know where the problem is.

this is my httpd.conf 
WSGIProcessGroup project
WSGIDaemonProcess project python-path=/var/www/html/project:/var/www/html/
inv/Lib/python3.7/site-packages
WSGIPythonPath /var/www/html/project:/var/www/html/inv/Lib/python3.7/site-
packages

Alias /static "/var/www/html/project/static-files"

Require all granted





Require all granted


I install wsgi_mod by *yum install mod_wsgi*
[mpm_prefork:notice] [pid 25884] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.
2k-fips mod_fcgid/2.3.9 mod_wsgi/3.4 Python/2.7.5 configured -- resuming 
normal operations



Thank you in advance.

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


Re: Log into existing Django site

2019-01-15 Thread Alex Heyden
The server that is hosting the site. The one you're trying to FTP onto.
Your quality of life will be greatly improved if you can SSH onto the
machine rather than using FTP, because the actual server software that
hosts Python processes usually needs to be restarted. It's unlikely (but
not unheard of) that you have anything like CPanel controlling a Django
instance. It's *probably* going to be GUnicorn or uWSGI, but there's a half
dozen options on that front too.

I know that all sounds really wishy-washy, but I don't want to mislead you
accidentally. The overall architecture isn't that different from a PHP app,
but you might not recognize the configuration and file server technologies
being used. The further along you get, the easier it'll be for people to
figure out what's going on and help you at least figure out what files need
to be changed.

On Tue, Jan 15, 2019 at 6:39 PM TheShoff  wrote:

> Thank you for your response! By host machine, do you mean the machine
> (computer) the site was created on or the server that is hosting the site?
> I have always worked in PHP and HTML and am used to downloading/uploading
> files to the server to make changes.
>
> On Tuesday, January 15, 2019 at 2:30:44 PM UTC-7, Alex Heyden wrote:
>>
>> Assuming you're familiar with web technologies in general, you'd make
>> these changes on the host machine itself, ideally through the same
>> mechanism that handles deployments of source code. Code for application
>> logic is often in files called "views.py" or similar, and the HTML will be
>> in a folder called "templates" by convention, either near the top of the
>> code or contained within the directories (called "applications" in Django)
>> that hold server code.
>>
>> The FTP client is probably the closest you've gotten so far, but "denied
>> access" can mean anything from permissions to authentication issues. You
>> might want to start there.
>>
>> On Tue, Jan 15, 2019 at 3:04 PM TheShoff  wrote:
>>
>>> I am trying to add reCaptcha to an existing Django website that was
>>> created by a company we no longer work with. I have server access to the
>>> website, but cannot figure out how to edit the files or add the reCaptcha
>>> form (I tried to manually add the code into the HTML and .py files and
>>> uploading it on my FTP client and was denied access). Do I need to login to
>>> the website using Python to add the reCaptcha form? If so, can someone tell
>>> me how? I am not looking to make any other changes at this time.
>>>
>>> ***Please note I am new to Django and trying to figure out how it
>>> works.***
>>>
>>> --
>>> 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/da98679f-180b-4433-9c94-faa13e27ec3d%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/ce4b4cc7-0082-4474-a6c3-d393665f6e32%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%2Bv0ZYWmL5FYdhAi63Jx_RKNevEU6CySJWD3SsEZwMnbni14pg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: tasks queues - why a broker and not the DB?

2019-01-15 Thread Ira Abbott
I went with celery/rabbitmq behind a load balancer running on the same image as 
my server.  I haven’t done any corner case testing, but so far it seems to 
scale up and down well after some tweaking on thresholds.  Doing this, rules 
out some of the smallest instances, as more memory is needed for each worker 
queue.  

Sent from my iPhone

> On Jan 15, 2019, at 8:29 PM, Jason  wrote:
> 
> primarily because writes to db are expensive, and reads are less so but do 
> add load to an existing db.
> 
> besides, why not use the best tool for the job?  redis is much better at 
> read/write IO than dbs and functions perfectly well as a key-value store.  
> Rabbit is the gold standard for high availbility queue.
> 
> not saying you shouldn't use the db, but but when there are better options 
> that don't add extra load to an existing db infra that's already under 
> somewhat serious load
> 
> for example, my company regularly does full reindexes of all their content in 
> a solr search engine.  that can encompass somewhere in the neighborhood of 
> about 250k tasks and take 2.5-3 days to execute.  Do you _really_ want to 
> dump 250k records in your db in one go?  And another place I was at indexed 
> somewhere around 25M mirrored web pages, one page per task.  I would 
> definitely not wanted to have dumped all that in a db
> -- 
> 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/df99c32a-139a-4bbb-bc8f-2156474a7e3d%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/BB76932C-547E-4F2A-8C8B-840E4D35D27A%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: tasks queues - why a broker and not the DB?

2019-01-15 Thread Jason
primarily because writes to db are expensive, and reads are less so but do 
add load to an existing db.

besides, why not use the best tool for the job?  redis is much better at 
read/write IO than dbs and functions perfectly well as a key-value store.  
Rabbit is the gold standard for high availbility queue.

not saying you shouldn't use the db, but but when there are better options 
that don't add extra load to an existing db infra that's already under 
somewhat serious load

for example, my company regularly does full reindexes of all their content 
in a solr search engine.  that can encompass somewhere in the neighborhood 
of about 250k tasks and take 2.5-3 days to execute.  Do you _really_ want 
to dump 250k records in your db in one go?  And another place I was at 
indexed somewhere around 25M mirrored web pages, one page per task.  I 
would definitely not wanted to have dumped all that in a db

-- 
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/df99c32a-139a-4bbb-bc8f-2156474a7e3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Log into existing Django site

2019-01-15 Thread TheShoff
Thank you for your response! By host machine, do you mean the machine 
(computer) the site was created on or the server that is hosting the site? 
I have always worked in PHP and HTML and am used to downloading/uploading 
files to the server to make changes. 

On Tuesday, January 15, 2019 at 2:30:44 PM UTC-7, Alex Heyden wrote:
>
> Assuming you're familiar with web technologies in general, you'd make 
> these changes on the host machine itself, ideally through the same 
> mechanism that handles deployments of source code. Code for application 
> logic is often in files called "views.py" or similar, and the HTML will be 
> in a folder called "templates" by convention, either near the top of the 
> code or contained within the directories (called "applications" in Django) 
> that hold server code.
>
> The FTP client is probably the closest you've gotten so far, but "denied 
> access" can mean anything from permissions to authentication issues. You 
> might want to start there.
>
> On Tue, Jan 15, 2019 at 3:04 PM TheShoff  > wrote:
>
>> I am trying to add reCaptcha to an existing Django website that was 
>> created by a company we no longer work with. I have server access to the 
>> website, but cannot figure out how to edit the files or add the reCaptcha 
>> form (I tried to manually add the code into the HTML and .py files and 
>> uploading it on my FTP client and was denied access). Do I need to login to 
>> the website using Python to add the reCaptcha form? If so, can someone tell 
>> me how? I am not looking to make any other changes at this time. 
>>
>> ***Please note I am new to Django and trying to figure out how it 
>> works.***
>>
>> -- 
>> 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/da98679f-180b-4433-9c94-faa13e27ec3d%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/ce4b4cc7-0082-4474-a6c3-d393665f6e32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


tasks queues - why a broker and not the DB?

2019-01-15 Thread Olivier Dalang
Hi !

I'm currently comparing task queues solutions for Django, and was wondering
why all of them seem to require a broker (rabbitmq, redis...), including
the ones that are supposedly lightweight/not full featured (huey...), and
including the ones that are made for Django exclusively (django-carrot...).

How come none uses the default database ? It seems to me tasks could simply
be enqueued/dequeued in a tasks table, so that it doesn't require any other
service/dependencies. Most of the time, the workers need access to the
database anyways. To me it would seem more robust, as by using the db,
queued task would simply resume after a reboot and could be migrated. It
also seems easier in terms of UI, as django-admin could be used to monitor
the tasks.

I'd be very interested in understanding the reason behind this, as I feel
like I'm missing some important point.

Thanks !!

Olivier

-- 
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/CAExk7p1jZ7jn5aPE6Hu9uX4%2BfdF3HPB6fpm0vqSOAtr%3DaT%3DQ1g%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?

2019-01-15 Thread Lorenzo Peña

>
>
>
Hi Filbert, everyone!

django-tenant-schemas has a way to infer the tenant from the request, and 
you could apply the same logic to extend Channel's scope with the tenant. 
With the tenant on the scope you can incrementally add in-channels 
multi-tenant logic. Not sure if this helps as you mention other multiple 
elements in your setup.
 

 

-- 
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/f1091e87-96b6-469a-9a92-46a82f0107f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Help regarding query.

2019-01-15 Thread Mohit Solanki
Can someone explain why group by after annotations yield wrong result.
More details at 
https://stackoverflow.com/questions/54205761/django-group-by-yield-wrong-result-after-filtering-by-annotated-field

-- 
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/a127c835-acf4-4a79-bc5f-5a2977df9b4e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Log into existing Django site

2019-01-15 Thread Alex Heyden
Assuming you're familiar with web technologies in general, you'd make these
changes on the host machine itself, ideally through the same mechanism that
handles deployments of source code. Code for application logic is often in
files called "views.py" or similar, and the HTML will be in a folder called
"templates" by convention, either near the top of the code or contained
within the directories (called "applications" in Django) that hold server
code.

The FTP client is probably the closest you've gotten so far, but "denied
access" can mean anything from permissions to authentication issues. You
might want to start there.

On Tue, Jan 15, 2019 at 3:04 PM TheShoff  wrote:

> I am trying to add reCaptcha to an existing Django website that was
> created by a company we no longer work with. I have server access to the
> website, but cannot figure out how to edit the files or add the reCaptcha
> form (I tried to manually add the code into the HTML and .py files and
> uploading it on my FTP client and was denied access). Do I need to login to
> the website using Python to add the reCaptcha form? If so, can someone tell
> me how? I am not looking to make any other changes at this time.
>
> ***Please note I am new to Django and trying to figure out how it works.***
>
> --
> 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/da98679f-180b-4433-9c94-faa13e27ec3d%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%2Bv0ZYV_QbGojTrmAZ3qfh6MY_cUtBbvXmyQiOStK-Gfnn8i5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Log into existing Django site

2019-01-15 Thread TheShoff
I am trying to add reCaptcha to an existing Django website that was created 
by a company we no longer work with. I have server access to the website, 
but cannot figure out how to edit the files or add the reCaptcha form (I 
tried to manually add the code into the HTML and .py files and uploading it 
on my FTP client and was denied access). Do I need to login to the website 
using Python to add the reCaptcha form? If so, can someone tell me how? I 
am not looking to make any other changes at this time. 

***Please note I am new to Django and trying to figure out how it works.***

-- 
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/da98679f-180b-4433-9c94-faa13e27ec3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Lot into existing Django site

2019-01-15 Thread TheShoff
I am trying to add reCaptcha to an existing Django website that was created 
by a company we no longer work with. I have server access to the website, 
but cannot figure out how to edit the files or add the reCaptcha form (I 
tried to manually add the code into the HTML and .py files and uploading it 
on my FTP client and was denied access). Do I need to login to the website 
using Python to add the reCaptcha form? If so, can someone tell me how? I 
am not looking to make any other changes at this time. 

***Please note I am new to Django and trying to figure out how it works.***

-- 
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/bc358bef-40b7-41e2-8faf-39cd89b1f339%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: To learn proper project based Django .

2019-01-15 Thread Devender Kumar
Hi,
I have different set of mind set there are lot of different type of
projects out there.
First think what you wanna build then take out small part of that project
get some UI* and start coding it don't think about as a whole just a part.
Make some similar parts and collect or join them together and put some
finishing stepups and host the dam thing. And start showcasing it. This is
what I do and I have just 6 month exp in django and I already did three of
the projects with it and doing one more if you wanna be part of it I am
happy to have you in.
Regards
Dev

On Tue 15 Jan, 2019, 7:18 PM PASCUAL Eric  Hi,
>
>
> The Django official website includes an extensive reference documentation
> and a detailed tutorial. This is the preferred start point.
>
>
> Afterwards, you can grab complements from resources such as  :
>
>
>- Django Girls site
>- Two Scoops of Django book
>
>
> These are those which came out of my mind, but there are plenty others.
>
>
> BTW Two Scoops is a great book which goes beyond Django itself, and
> provides advice about how to structure a Django project, which extensions
> and tools are useful,... It's a very valuable source of inspiration to
> build your own experience. Just be warned that it refers to Django 1.11
> (and not yet Django 2.x), but this should not be a real problem for now.
>
>
> Once you'll have assimilated the content of theses sources, you'll be very
> well prepared for Django coding ;)
>
>
> Regards
>
>
> Eric
> --
> *From:* django-users@googlegroups.com  on
> behalf of Nikhil kanamadi 
> *Sent:* Tuesday, January 15, 2019 10:38:09 AM
> *To:* django-users@googlegroups.com
> *Subject:* To learn proper project based Django .
>
> Hi all,
>
> I am one year experienced software professional.
> Worked on python and flask.
> But now I need to learn And build hands-on Django projects.
> Which is best source for project based understanding  and learning.
>
> Please provide me any free hands-on  bootcamps  or sources.
>
> --
> 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/CAJruv46usXAMXUXukt7%2BsGuMSib1JMdTVL_04zd7EQt0tQ3CZA%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/AM0P193MB0308D44E73EE3A85D2ADC7F08C810%40AM0P193MB0308.EURP193.PROD.OUTLOOK.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%3DbE%2B6xiLrQbz%2B2aNmrkEx%2BVFJ%3DkagesQxhSRjQxcqZYz18g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: channnels -- communication with redis

2019-01-15 Thread Yuval Bachrach
Thank you

I have installed docker on my PC and I run it locally.
At setting.py I have:

CHANNEL_LAYERS = {
'default': {
'BACKEND': 'channels_redis.core.RedisChannelLayer',
'CONFIG': {
# "hosts": [('172.17.0.1', 6379)],
"hosts": [('127.0.0.1', 6379)],
},
},
}


I am running a windows os, With docker installation I got a "Docker
Quickstart Terminal". This terminal looks like a unix shell - So I am using
unix commands there. I run the docker commands on this shell (as you have
seen) and also run the "python manage.py shell" on the same shell.
So I have the docker running on windows representing a unix shell... This
is the exact configuration that is presented for this tutorial
The interface between the native windows stack and the docker which is unix
oriented can be tricky but is supported officially by MSFT.
My windows version is "home"which may contribute to the problem I see (and
is 64 bits, which is a requirement of docker. I have installed the 32 bit
python, which I hope and assume is not the problem).

I have stopped "windows defender firewall" and executed the commands inside
the python shell again: I still have the problem

You say: "It looks network/local environment related rather than something
redis/docker specific" which I think is correct. Note, however, that when
running runserver the comments I get are:
[Deprecation] chrome.loadTimes() is deprecated, instead use standardized
API: nextHopProtocol in Navigation Timing 2.
https://www.chromestatus.com/features/5637885046816768.
(anonymous) @ content.js:4
content.js:5 [Deprecation] chrome.loadTimes() is deprecated, instead use
standardized API: nextHopProtocol in Navigation Timing 2.
https://www.chromestatus.com/features/5637885046816768.
(anonymous) @ content.js:5
(index):28 Chat socket closed unexpectedly
chatSocket.onclose @ (index):28
Since the problem happens when firewall is inactivated, I am not sure what
else I can do
Since redis is running inside a docker container, I am not sure how to test
the connection with telnet (or ping): How do I test it?


On Tue, Jan 15, 2019 at 7:32 PM Roger Gammans 
wrote:

>
> Hi Yuval
>
> Are you using docker machine ? If so the redis server is on the docker
> machine's IP not on the localhost so you would need to update the docker
> host in the CHANNEL_LAYERS portion of settings.py.
>
> You show a unix-like shell like for controlling docker; but the connect
> failed error looks very windowssy; so I'm not sure that the docker engine
> (daemon) and the python is running on the TCP stack (or kernel/VM) which
> you would need for the local host connection to work. Also it might be
> sensible to ensure the connection is being block by a local firewall if you
> have one.
>
> It looks network/local environment related rather than something
> redis/docker specific. The error show the TCP connection (which you can
> test with telnet if you have it install) not be made between python and the
> redis deamon the most likely reason for that is a local firewall or a more
> complex environment.
>
>
> --
>
> Roger Gammans 
> Gamma Science
>
>
> On Tue, 2019-01-15 at 18:49 +0200, Yuval Bachrach wrote:
>
> I did not configure anything, which is probably the problem..
> I am following the tutorial. I just did what the tutorial instructed to
> do: So I have installed docker as instructed but haven't configured
> anything. The tutorial calls installing docker and does not state any
> action to take after installing)
> as I am not familiar with docker, could not tell if there is a need to
> configure anything to make django channels work.  I still need to do
> whatever is required to make the tutorial work.Do I need to learn basics of
> docker first, or are there some simple things I can do to enable the
> environment and keep going with the channels tutorial?
>
> On Tue, Jan 15, 2019 at 6:38 PM PASCUAL Eric  wrote:
>
> Hi,
>
>
> How is configured your Docker stack exactly ? You should have several
> containers in it, at least one for the Redis server, another one for the
> Django app.
>
>
> Do you use docker-compose to run the stack ? If yes, could you provide the
> YAML descriptor of the stack ?
>
>
> Best
>
>
> Eric
>
>
> --
> *From:* django-users@googlegroups.com  on
> behalf of Yuval Bachrach 
> *Sent:* Tuesday, January 15, 2019 5:31:18 PM
> *To:* django-users@googlegroups.com
> *Subject:* channnels -- communication with redis
>
>
> I fail to have django channels communication with redis running at docker
> container: I am running the channels tutorial and I get an error when just
> following the tutorial instructions.
>
>
> I am quite new with Django (designed a simple site) and have no knowledge
> on redis nor docker
>
>
> I am trying to lean channels using the tutorial:
> https://channels.readthedocs.io/en/latest/tutorial/
>
> It uses redis over docker
>
>
>
> At tutorial part 2 there is a test for “channel layer can communicate
> with 

Re: channnels -- communication with redis

2019-01-15 Thread Roger Gammans
Hi Yuval 

Are you using docker machine ? If so  the redis server is on the docker
machine's IP not on the localhost so you would need to update the
docker host in the CHANNEL_LAYERS portion of settings.py.

You show a unix-like shell like for controlling docker; but the connect
failed error looks very windowssy; so I'm not sure that the docker
engine (daemon) and the python is running on the TCP stack (or
kernel/VM) which you would need for the local host connection to work.
Also it might be sensible to ensure the connection is being block by a
local firewall if you have one.

It looks  network/local environment related rather than something
redis/docker specific. The error show the TCP connection (which you can
test with telnet if you have it install) not be made between python and
the redis deamon the most likely reason for that is a local firewall or
a more complex environment.

-- 
Roger Gammans 
Gamma Science



On Tue, 2019-01-15 at 18:49 +0200, Yuval Bachrach wrote:
> I did not configure anything, which is probably the problem..I am
> following the tutorial. I just did what the tutorial instructed to
> do: So I have installed docker as instructed but haven't configured
> anything. The tutorial calls installing docker and does not state any
> action to take after installing) 
> as I am not familiar with docker, could not tell if there is a need
> to configure anything to make django channels work.  I still need to
> do whatever is required to make the tutorial work.Do I need to learn
> basics of docker first, or are there some simple things I can do to
> enable the environment and keep going with the channels tutorial? 
> 
> On Tue, Jan 15, 2019 at 6:38 PM PASCUAL Eric 
> wrote:
> > 
> > 
> > 
> > 
> > 
> > Hi,
> > 
> > 
> > 
> > How is configured your Docker stack exactly ? You should have
> > several containers in it, at least one for the Redis server,
> > another one for the Django app.
> > 
> > 
> > 
> > Do you use docker-compose to run the stack ? If yes, could you
> > provide the YAML descriptor of the stack ?
> > 
> > 
> > 
> > Best
> > 
> > 
> > 
> > Eric
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > From: django-users@googlegroups.com 
> > on behalf of Yuval Bachrach 
> > 
> > Sent: Tuesday, January 15, 2019 5:31:18 PM
> > 
> > To: django-users@googlegroups.com
> > 
> > Subject: channnels -- communication with redis
> >  
> > 
> > 
> > 
> > 
> > I fail to have django channels communication with redis running at
> > docker container: I am running the channels tutorial and I get an
> > error when just following the tutorial instructions.
> > 
> > 
> > 
> > 
> > 
> > I am quite new with Django (designed a simple site) and have no
> > knowledge on redis nor docker
> > 
> > 
> > 
> > 
> > 
> > I am trying to lean channels using the tutorial: 
> > https://channels.readthedocs.io/en/latest/tutorial/
> > 
> > It uses redis over docker
> > 
> >  
> > 
> > At tutorial part 2 there is a test for “channel layer can
> > communicate with Redis”.
> > 
> > 
> > I fails this test. I was looking over the web for solving this
> > communication problem with no luck.
> > 
> > As I am not familiar with redis nor docker, I have hard time
> > analyzing the reasons for the communication problems. I can see
> > that redis is running inside a docker container.
> > 
> > 
> >  
> > 
> > $ docker ps
> > 
> > CONTAINER IDIMAGE   COMMAND 
> > CREATED STATUS  PORTS
> > 
> >  NAMES
> > 
> > 2bdabc272ec3redis   "docker-entrypoint.s…"  
> > About an hour ago   Up About an hour0.0.0.0:6379->6379/tcp
> > 
> >  quizzical_panini
> > 
> > $ docker inspect quizzical_panini > redisimage.log
> > 
> >   (YB: will paste the logfile at the end of this  message)
> > 
> > 
> >  
> > 
> > 
> >  
> > 
> > python manage.py shell
> > 
> > import channels.layers
> > 
> > channel_layer = channels.layers.get_channel_layer()
> > 
> > from asgiref.sync import async_to_sync
> > 
> > async_to_sync(channel_layer.send)('test_channel', {'type':
> > 'hello'})
> > 
> > Error begins with:
> > 
> > In [4]: async_to_sync(channel_layer.send)('test_channel',
> > {'type': 'hello'})
> > 
> > -
> > --
> > 
> > ConnectionRefusedErrorTraceback (most
> > recent call last)
> > 
> >  in 
> > 
> > > 1 async_to_sync(channel_layer.send)('test_channel',
> > {'type': 'hello'})
> > 
> > A lot of other details. Ends up with:
> > 
> > 504 # Jump to any except clause below.
> > 
> > --> 505 raise OSError(err, f'Connect call failed
> > {address}')
> > 
> > 506 except (BlockingIOError, InterruptedError):
> > 
> > 507 # socket is still registered, the callback will
> > be retried later
> > 
> >  
> > 
> > 
> > ConnectionRefusedError: [Errno 10061] Connect call failed
> > 

Re: channnels -- communication with redis

2019-01-15 Thread Yuval Bachrach
I did not configure anything, which is probably the problem..
I am following the tutorial. I just did what the tutorial instructed to do:
So I have installed docker as instructed but haven't configured anything.
The tutorial calls installing docker and does not state any action to take
after installing)
as I am not familiar with docker, could not tell if there is a need to
configure anything to make django channels work.  I still need to do
whatever is required to make the tutorial work.Do I need to learn basics of
docker first, or are there some simple things I can do to enable the
environment and keep going with the channels tutorial?

On Tue, Jan 15, 2019 at 6:38 PM PASCUAL Eric  wrote:

> Hi,
>
>
> How is configured your Docker stack exactly ? You should have several
> containers in it, at least one for the Redis server, another one for the
> Django app.
>
>
> Do you use docker-compose to run the stack ? If yes, could you provide the
> YAML descriptor of the stack ?
>
>
> Best
>
>
> Eric
>
>
> --
> *From:* django-users@googlegroups.com  on
> behalf of Yuval Bachrach 
> *Sent:* Tuesday, January 15, 2019 5:31:18 PM
> *To:* django-users@googlegroups.com
> *Subject:* channnels -- communication with redis
>
>
> I fail to have django channels communication with redis running at docker
> container: I am running the channels tutorial and I get an error when just
> following the tutorial instructions.
>
>
> I am quite new with Django (designed a simple site) and have no knowledge
> on redis nor docker
>
>
> I am trying to lean channels using the tutorial:
> https://channels.readthedocs.io/en/latest/tutorial/
>
> It uses redis over docker
>
>
>
> At tutorial part 2 there is a test for “channel layer can communicate
> with Redis”.
>
> I fails this test. I was looking over the web for solving this
> communication problem with no luck.
>
> As I am not familiar with redis nor docker, I have hard time analyzing the
> reasons for the communication problems. I can see that redis is running
> inside a docker container.
>
>
>
> $ docker ps
>
> CONTAINER IDIMAGE   COMMAND
> CREATED STATUS  PORTS
>
>  NAMES
>
> 2bdabc272ec3redis   "docker-entrypoint.s…"   About an
> hour ago   Up About an hour0.0.0.0:6379->6379/tcp
>
>  quizzical_panini
>
> $ docker inspect quizzical_panini > redisimage.log
>
>   (YB: will paste the logfile at the end of this  message)
>
>
>
>
>
> python manage.py shell
>
> import channels.layers
>
> channel_layer = channels.layers.get_channel_layer()
>
> from asgiref.sync import async_to_sync
>
> async_to_sync(channel_layer.send)('test_channel', {'type': 'hello'})
>
> Error begins with:
>
> In [4]: async_to_sync(channel_layer.send)('test_channel', {'type':
> 'hello'})
>
>
> ---
>
> ConnectionRefusedErrorTraceback (most recent call
> last)
>
>  in 
>
> > 1 async_to_sync(channel_layer.send)('test_channel', {'type':
> 'hello'})
>
> A lot of other details. Ends up with:
>
> 504 # Jump to any except clause below.
>
> --> 505 raise OSError(err, f'Connect call failed
> {address}')
>
> 506 except (BlockingIOError, InterruptedError):
>
> 507 # socket is still registered, the callback will be
> retried later
>
>
>
> ConnectionRefusedError: [Errno 10061] Connect call failed ('127.0.0.1',
> 6379)
>
>
>
> Some version details:
>
> installing shell command:
>
> $ docker run redis --version
>
> Redis server v=5.0.3 sha=:0 malloc=jemalloc-5.1.0 bits=64
> build=9f27eb593282148b
>
> $ pip install channels_redis
>
> *A lot of details: ends up with:*
>
> > Successfully installed channels-redis-2.3.3
>
> $ python --version
>
> Python 3.7.1
>
> (note that it is a 32 bit python while docker requires 64 bits. I assumed
> it should not be the reason for the problems I do experience
>
>
>
>  redisimage.log generated by docker inspect as shown above <<
>
>  It is long. I can’t tell id/what is relevant
>
> [
>
> {
>
> "Id":
> "2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479",
>
> "Created": "2019-01-15T14:02:36.679774957Z",
>
> "Path": "docker-entrypoint.sh",
>
> "Args": [
>
> "redis-server"
>
> ],
>
> "State": {
>
> "Status": "running",
>
> "Running": true,
>
> "Paused": false,
>
> "Restarting": false,
>
> "OOMKilled": false,
>
> "Dead": false,
>
> "Pid": 8731,
>
> "ExitCode": 0,
>
> "Error": "",
>
> "StartedAt": "2019-01-15T14:02:37.086931139Z",
>
> "FinishedAt": "0001-01-01T00:00:00Z"
>
> },
>
> "Image":
> "sha256:5d2989ac9711b6c7a96dfca3110041d6259294f5ccd343491ecfffe3d14757cc",
>
> 

Re: channnels -- communication with redis

2019-01-15 Thread PASCUAL Eric
Hi,


How is configured your Docker stack exactly ? You should have several 
containers in it, at least one for the Redis server, another one for the Django 
app.


Do you use docker-compose to run the stack ? If yes, could you provide the YAML 
descriptor of the stack ?


Best


Eric



From: django-users@googlegroups.com  on behalf 
of Yuval Bachrach 
Sent: Tuesday, January 15, 2019 5:31:18 PM
To: django-users@googlegroups.com
Subject: channnels -- communication with redis


I fail to have django channels communication with redis running at docker 
container: I am running the channels tutorial and I get an error when just 
following the tutorial instructions.


I am quite new with Django (designed a simple site) and have no knowledge on 
redis nor docker


I am trying to lean channels using the tutorial: 
https://channels.readthedocs.io/en/latest/tutorial/

It uses redis over docker



At tutorial part 2 there is a test for “channel layer can communicate with 
Redis”.

I fails this test. I was looking over the web for solving this communication 
problem with no luck.

As I am not familiar with redis nor docker, I have hard time analyzing the 
reasons for the communication problems. I can see that redis is running inside 
a docker container.



$ docker ps

CONTAINER IDIMAGE   COMMAND  CREATED
 STATUS  PORTS

 NAMES

2bdabc272ec3redis   "docker-entrypoint.s…"   About an hour 
ago   Up About an hour0.0.0.0:6379->6379/tcp

 quizzical_panini

$ docker inspect quizzical_panini > redisimage.log

  (YB: will paste the logfile at the end of this  message)





python manage.py shell

import channels.layers

channel_layer = channels.layers.get_channel_layer()

from asgiref.sync import async_to_sync

async_to_sync(channel_layer.send)('test_channel', {'type': 'hello'})

Error begins with:

In [4]: async_to_sync(channel_layer.send)('test_channel', {'type': 'hello'})

---

ConnectionRefusedErrorTraceback (most recent call last)

 in 

> 1 async_to_sync(channel_layer.send)('test_channel', {'type': 'hello'})

A lot of other details. Ends up with:

504 # Jump to any except clause below.

--> 505 raise OSError(err, f'Connect call failed {address}')

506 except (BlockingIOError, InterruptedError):

507 # socket is still registered, the callback will be retried 
later



ConnectionRefusedError: [Errno 10061] Connect call failed ('127.0.0.1', 6379)



Some version details:

installing shell command:

$ docker run redis --version

Redis server v=5.0.3 sha=:0 malloc=jemalloc-5.1.0 bits=64 
build=9f27eb593282148b

$ pip install channels_redis

A lot of details: ends up with:

> Successfully installed channels-redis-2.3.3

$ python --version

Python 3.7.1

(note that it is a 32 bit python while docker requires 64 bits. I assumed it 
should not be the reason for the problems I do experience



 redisimage.log generated by docker inspect as shown above <<

 It is long. I can’t tell id/what is relevant

[

{

"Id": 
"2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479",

"Created": "2019-01-15T14:02:36.679774957Z",

"Path": "docker-entrypoint.sh",

"Args": [

"redis-server"

],

"State": {

"Status": "running",

"Running": true,

"Paused": false,

"Restarting": false,

"OOMKilled": false,

"Dead": false,

"Pid": 8731,

"ExitCode": 0,

"Error": "",

"StartedAt": "2019-01-15T14:02:37.086931139Z",

"FinishedAt": "0001-01-01T00:00:00Z"

},

"Image": 
"sha256:5d2989ac9711b6c7a96dfca3110041d6259294f5ccd343491ecfffe3d14757cc",

"ResolvConfPath": 
"/mnt/sda1/var/lib/docker/containers/2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479/resolv.conf",

"HostnamePath": 
"/mnt/sda1/var/lib/docker/containers/2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479/hostname",

"HostsPath": 
"/mnt/sda1/var/lib/docker/containers/2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479/hosts",

"LogPath": 
"/mnt/sda1/var/lib/docker/containers/2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479/2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479-json.log",

"Name": "/quizzical_panini",

"RestartCount": 0,

"Driver": "overlay2",

"Platform": "linux",

"MountLabel": "",

"ProcessLabel": "",

"AppArmorProfile": "",

"ExecIDs": null,

"HostConfig": {

"Binds": null,

"ContainerIDFile": "",

"LogConfig": {

 

channnels -- communication with redis

2019-01-15 Thread Yuval Bachrach
I fail to have django channels communication with redis running at docker
container: I am running the channels tutorial and I get an error when just
following the tutorial instructions.


I am quite new with Django (designed a simple site) and have no knowledge
on redis nor docker


I am trying to lean channels using the tutorial:
https://channels.readthedocs.io/en/latest/tutorial/

It uses redis over docker



At tutorial part 2 there is a test for “channel layer can communicate with
Redis”.

I fails this test. I was looking over the web for solving this
communication problem with no luck.

As I am not familiar with redis nor docker, I have hard time analyzing the
reasons for the communication problems. I can see that redis is running
inside a docker container.



$ docker ps

CONTAINER IDIMAGE   COMMAND
CREATED STATUS  PORTS

 NAMES

2bdabc272ec3redis   "docker-entrypoint.s…"   About an
hour ago   Up About an hour0.0.0.0:6379->6379/tcp

 quizzical_panini

$ docker inspect quizzical_panini > redisimage.log

  (YB: will paste the logfile at the end of this  message)





python manage.py shell

import channels.layers

channel_layer = channels.layers.get_channel_layer()

from asgiref.sync import async_to_sync

async_to_sync(channel_layer.send)('test_channel', {'type': 'hello'})

Error begins with:

In [4]: async_to_sync(channel_layer.send)('test_channel', {'type':
'hello'})


---

ConnectionRefusedErrorTraceback (most recent call
last)

 in 

> 1 async_to_sync(channel_layer.send)('test_channel', {'type':
'hello'})

A lot of other details. Ends up with:

504 # Jump to any except clause below.

--> 505 raise OSError(err, f'Connect call failed {address}')

506 except (BlockingIOError, InterruptedError):

507 # socket is still registered, the callback will be
retried later



ConnectionRefusedError: [Errno 10061] Connect call failed ('127.0.0.1',
6379)



Some version details:

installing shell command:

$ docker run redis --version

Redis server v=5.0.3 sha=:0 malloc=jemalloc-5.1.0 bits=64
build=9f27eb593282148b

$ pip install channels_redis

*A lot of details: ends up with:*

> Successfully installed channels-redis-2.3.3

$ python --version

Python 3.7.1

(note that it is a 32 bit python while docker requires 64 bits. I assumed
it should not be the reason for the problems I do experience



 redisimage.log generated by docker inspect as shown above <<

 It is long. I can’t tell id/what is relevant

[

{

"Id":
"2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479",

"Created": "2019-01-15T14:02:36.679774957Z",

"Path": "docker-entrypoint.sh",

"Args": [

"redis-server"

],

"State": {

"Status": "running",

"Running": true,

"Paused": false,

"Restarting": false,

"OOMKilled": false,

"Dead": false,

"Pid": 8731,

"ExitCode": 0,

"Error": "",

"StartedAt": "2019-01-15T14:02:37.086931139Z",

"FinishedAt": "0001-01-01T00:00:00Z"

},

"Image":
"sha256:5d2989ac9711b6c7a96dfca3110041d6259294f5ccd343491ecfffe3d14757cc",

"ResolvConfPath":
"/mnt/sda1/var/lib/docker/containers/2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479/resolv.conf",

"HostnamePath":
"/mnt/sda1/var/lib/docker/containers/2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479/hostname",

"HostsPath":
"/mnt/sda1/var/lib/docker/containers/2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479/hosts",

"LogPath":
"/mnt/sda1/var/lib/docker/containers/2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479/2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479-json.log",

"Name": "/quizzical_panini",

"RestartCount": 0,

"Driver": "overlay2",

"Platform": "linux",

"MountLabel": "",

"ProcessLabel": "",

"AppArmorProfile": "",

"ExecIDs": null,

"HostConfig": {

"Binds": null,

"ContainerIDFile": "",

"LogConfig": {

"Type": "json-file",

"Config": {}

},

"NetworkMode": "default",

"PortBindings": {

"6379/tcp": [

{

"HostIp": "",

"HostPort": "6379"

}

]

},

"RestartPolicy": {

"Name": "no",

"MaximumRetryCount": 0

},

"AutoRemove": false,

"VolumeDriver": "",

"VolumesFrom": 

error with deploy django / digitalocean

2019-01-15 Thread Thiago Brito
Hi,

I'm trying to make deploy my first django website in digitalocean but
doesn't works.

I got this error

connect() to unix:/run/uwsgi/project.sock failed (2: No such file or
directory)

Anyone can help me?

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


Re: how handle high incoming data and sending throttled data to web sockets in django-channels

2019-01-15 Thread Ken Whitesell
We deal with a similar rate of data acquisition, and have taken a different 
approach. (We get, on average, about 10,000,000 UDP messages / day)

We have a very small UDP listener (about 50 lines of Python 3 code), and 
_all_ it does is receive the message and dump it into a Celery queue. We 
then run multiple Celery worker tasks to process that data and write it to 
the database.

There are some times during peak period in the day where the queue might 
get backed up 1,000,000 messages or so, but we never have any problems 
getting them all processed that day. (UDP packets effectively stops around 
9 PM.)

We may be losing some packets - with UDP, how can you tell? But the numbers 
of packets processed are well within 95% of projections, and so for our 
purposes it's quite satisfactory.
(There is absolutely no way for us to determine if some upstream device is 
being saturated and dropping packets that we should otherwise be receiving. 
Or more accurately, how many packets are being dropped upstream from our 
collection point. UDP is definitely not the protocol to be using if you 
absolutely need to receive 100% of your data.)

On Monday, January 14, 2019 at 9:31:21 AM UTC-5, Sahil Mangotra wrote:
>
> I am facing a problem in my django web server.
>
> We are using python3, django2, django-rest-framework3.8 and channels2.x
>
> Scenario is we are receiving DATA from a UDP connection at very fast rate 
> (~100 messages per second). The data revived is in proto format (you can 
> say we are receiving byte data). some data gets starved in this process as 
> *Rate 
> of production >>> rate of consumption* we are implementing throttling but 
> still at 100 concurrent users data starves again. Can anyone help us in 
> this scenario.
>
> If anyone has any new architecture idea please share.
>
> *This is surely an interesting problem. This is about stock market feed*
>
> PS :- I cannot post any code as it is my companies. but i can help any 
> time you need clarification on any point.
>

-- 
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/55ca74e0-1164-40cc-90a0-7e1e1b0baad3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: hi, How can I deploy my first Django website ?

2019-01-15 Thread Siddharth Tamang
I hosted my django website in apache with ssl hosted in Ubuntu 18.04 with 
Postgre sql db. Learning curve is there but you will be satisfied with final 
output. Digital ocean has good notes on it. You can refer to it. By the way 
what OS are you preferring?



> On 15-Jan-2019, at 8:51 PM, Thiago Brito  wrote:
> 
> https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-uwsgi-and-nginx-on-ubuntu-16-04
> 
>> Em ter, 15 de jan de 2019 às 13:00,  escreveu:
>> what is the best web hosting provider for Django websites?
>> 
>> What should I learn to deploy my first Django website?
>> 
>> what is the process?
>> 
>> -- 
>> 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/9c4d2241-5660-4ee7-9dd3-08401fa57099%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/CALvrLTtUiXBbTarbtTU4m-orZPtDnGHkXryxBD7ZqEM3P9wBBg%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/FF67FC6F-3B87-455C-A28D-110539F4C153%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: hi, How can I deploy my first Django website ?

2019-01-15 Thread Thiago Brito
https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-uwsgi-and-nginx-on-ubuntu-16-04

Em ter, 15 de jan de 2019 às 13:00,  escreveu:

> what is the best web hosting provider for Django websites?
>
> What should I learn to deploy my first Django website?
>
> what is the process?
>
> --
> 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/9c4d2241-5660-4ee7-9dd3-08401fa57099%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/CALvrLTtUiXBbTarbtTU4m-orZPtDnGHkXryxBD7ZqEM3P9wBBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: hi, How can I deploy my first Django website ?

2019-01-15 Thread Nitin Kumar
Here is a tutorial :
https://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html

On Tue, Jan 15, 2019 at 8:37 PM  wrote:

> i can not understand
>
>
> On Tuesday, January 15, 2019 at 5:03:58 PM UTC+2, Nitin Kumar wrote:
>>
>> uwsgi/gunicorn
>> Nginx
>>
>>
>> On Tue 15 Jan, 2019, 8:30 PM >
>>> what is the best web hosting provider for Django websites?
>>>
>>> What should I learn to deploy my first Django website?
>>>
>>> what is the process?
>>>
>>> --
>>> 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/9c4d2241-5660-4ee7-9dd3-08401fa57099%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/93c2dbd5-041a-4c97-8183-5b733a3ffe9a%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/CAKzNicETeqzUo1SyS19zHBKtZjPm6a0Him0%3Df9e0Ntmj353UZg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: hi, How can I deploy my first Django website ?

2019-01-15 Thread mw5301758
i can not understand


On Tuesday, January 15, 2019 at 5:03:58 PM UTC+2, Nitin Kumar wrote:
>
> uwsgi/gunicorn
> Nginx
>
>
> On Tue 15 Jan, 2019, 8:30 PM  wrote:
>
>> what is the best web hosting provider for Django websites?
>>
>> What should I learn to deploy my first Django website?
>>
>> what is the process?
>>
>> -- 
>> 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/9c4d2241-5660-4ee7-9dd3-08401fa57099%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/93c2dbd5-041a-4c97-8183-5b733a3ffe9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: hi, How can I deploy my first Django website ?

2019-01-15 Thread Nitin Kumar
uwsgi/gunicorn
Nginx


On Tue 15 Jan, 2019, 8:30 PM  what is the best web hosting provider for Django websites?
>
> What should I learn to deploy my first Django website?
>
> what is the process?
>
> --
> 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/9c4d2241-5660-4ee7-9dd3-08401fa57099%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/CAKzNicGHL4Sn%3Dv3Xher%2BmTALo4G5U8KpS8h_7KrMOqCfJ7hC6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


hi, How can I deploy my first Django website ?

2019-01-15 Thread mw5301758
what is the best web hosting provider for Django websites?

What should I learn to deploy my first Django website?

what is the process?

-- 
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/9c4d2241-5660-4ee7-9dd3-08401fa57099%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Populate modelform field with username

2019-01-15 Thread Ivan Martić
hvala Nebojša, to je to!!!
Kralj si

uto, 15. sij 2019. u 15:34 Nebojsa Hajdukovic 
napisao je:

> e izvini kao što sam ti rekao bio sam u gužvi, pa sam napamet pisao i
> zaboravio glupost da dodam. Evo ga.
>
> def prepoznaj(request):
> prepoznaj_form = PrepoznajForm(request.POST or None, 
> initial={'supplier_name':request.user})
> if prepoznaj_form.is_valid():
> prepoznaj_form.save()
>
> context = {
> 'prepoznaj_form': prepoznaj_form
> }
>
> return render(request, 'prepoznaj/forma.html', context)
>
>
> уто, 15. јан 2019. у 13:03 Ivan Martić  је
> написао/ла:
>
>> Nema greški ali save ne prolazi..
>>
>> System check identified no issues (0 silenced).
>> January 15, 2019 - 13:01:29
>> Django version 2.1.4, using settings 'qif.settings'
>> Starting development server at http://127.0.0.1:8000/
>> Quit the server with CTRL-BREAK.
>> [15/Jan/2019 13:01:31] "GET / HTTP/1.1" 200 8939
>> [15/Jan/2019 13:01:33] "GET /performance/ HTTP/1.1" 200 14799
>> [15/Jan/2019 13:01:39] "POST /performance/ HTTP/1.1" 200 14811
>>
>> Da li ovi podaci mogu što pomoći?
>>
>> uto, 15. sij 2019. u 12:54 Ivan Martić  napisao
>> je:
>>
>>> Nažalost, iz nekog razloga ne prolazi save ni poruka nakog save...
>>>
>>>
>>> uto, 15. sij 2019. u 12:52 Nebojsa Hajdukovic 
>>> napisao je:
>>>
 view:
 def performance_view(request):
 form = PerformanceForm( {'supplier_name':request.user}  )
 if request.method == "POST":
 form = PerformanceForm[request.POST]
 if form.is_valid():
 form.save()
 return render(request, 'qif/performance.html', {"form" : form})

 ovako nekako bi trebalo da radi

 уто, 15. јан 2019. у 12:49 Ivan Martić  је
 написао/ла:

> Ej hvala ti, puno mi je jasnije.. razumijem da si u gužvi, idem dalje
> sam pa ako zapnem javim se...
>
> 5 Star for support!!
>
> uto, 15. sij 2019. u 12:45 Nebojsa Hajdukovic <
> nebojsa.zero...@gmail.com> napisao je:
>
>> moras da dodas
>> if request.method == "POST"
>> form = PerformanceForm[request.POST]
>> izvini sad sam u nekoj bas velikoj guzvi, evo ti otprilike kako sam
>> ja na drugoj formi uradio, ako ne uspes ispisacu ti malo kasnije
>> [image: image.png]
>>
>> уто, 15. јан 2019. у 12:26 Ivan Martić  је
>> написао/ла:
>>
>>> Bravo! radi!
>>> Samo što sad neradi spremanje (request.POST)...kako da to sad
>>> implementiram, jel može savjet?
>>>
>>> uto, 15. sij 2019. u 12:22 Nebojsa Hajdukovic <
>>> nebojsa.zero...@gmail.com> napisao je:
>>>
 Obrisi ovo request.post or none

 uto, 15. jan 2019. 12:19 Ivan Martić  je
 napisao/la:

> Bok Nebojsa,
>
> hvala ti na brzom odgovoru.
> napravio sam ovako i nema promjene
>
> def performance_view(request):
> * form = PerformanceForm(request.POST or None,
> {'supplier_name':request.user})*
> if form.is_valid():
> form.save()
> messages.success(request, 'Your entry has been saved. Relevant
> persons will be informed of this change.')
> #(nevezano za populate) i ovaj message.success mi se isto  javlja
> kao problem.. na performance appu mi bilježi login/logout umjesto samo
> poruka nakon uspješnog spremanja.
> return render(request, 'qif/performance.html', {"form" : form})
>
> Možda mi nešto na formi nedostaje?
>
> uto, 15. sij 2019. u 11:59 Nebojsa Hajdukovic <
> nebojsa.zero...@gmail.com> napisao je:
>
>> Hey, based on your name I believe u speak our language, so will
>> switch to that : )
>>
>> Ako hoces da na primer supplier_name bude automatski popunjeno
>> kao koristik samo dodaj ovako u views.py:
>> view:
>> def performance_view(request):
>> form = PerformanceForm({'supplier_name':request.user})
>> if form.is_valid():
>> form.save()
>> return render(request, 'qif/performance.html', {"form" : form})
>>
>> уто, 15. јан 2019. у 09:51 Ivan Martić 
>> је написао/ла:
>>
>>> Hi all,
>>>
>>> can someone assist me.
>>> I cant get the modelform field get populated with active
>>> username.
>>>
>>> Does any one have a good advice?
>>>
>>> view:
>>> def performance_view(request):
>>> form = PerformanceForm(request.POST or None)
>>> if form.is_valid():
>>> form.save()
>>> return render(request, 'qif/performance.html', {"form" : form})
>>>
>>> forms:
>>> from django import forms
>>> from .models import Performance
>>>
>>>
>>> class PerformanceForm(forms.ModelForm):
>>> class Meta:
>>> model = Performance
>>> fields = [
>>> 'supplier_name',

Re: Populate modelform field with username

2019-01-15 Thread Nebojsa Hajdukovic
e izvini kao što sam ti rekao bio sam u gužvi, pa sam napamet pisao i
zaboravio glupost da dodam. Evo ga.

def prepoznaj(request):
prepoznaj_form = PrepoznajForm(request.POST or None,
initial={'supplier_name':request.user})
if prepoznaj_form.is_valid():
prepoznaj_form.save()

context = {
'prepoznaj_form': prepoznaj_form
}

return render(request, 'prepoznaj/forma.html', context)


уто, 15. јан 2019. у 13:03 Ivan Martić  је
написао/ла:

> Nema greški ali save ne prolazi..
>
> System check identified no issues (0 silenced).
> January 15, 2019 - 13:01:29
> Django version 2.1.4, using settings 'qif.settings'
> Starting development server at http://127.0.0.1:8000/
> Quit the server with CTRL-BREAK.
> [15/Jan/2019 13:01:31] "GET / HTTP/1.1" 200 8939
> [15/Jan/2019 13:01:33] "GET /performance/ HTTP/1.1" 200 14799
> [15/Jan/2019 13:01:39] "POST /performance/ HTTP/1.1" 200 14811
>
> Da li ovi podaci mogu što pomoći?
>
> uto, 15. sij 2019. u 12:54 Ivan Martić  napisao je:
>
>> Nažalost, iz nekog razloga ne prolazi save ni poruka nakog save...
>>
>>
>> uto, 15. sij 2019. u 12:52 Nebojsa Hajdukovic 
>> napisao je:
>>
>>> view:
>>> def performance_view(request):
>>> form = PerformanceForm( {'supplier_name':request.user}  )
>>> if request.method == "POST":
>>> form = PerformanceForm[request.POST]
>>> if form.is_valid():
>>> form.save()
>>> return render(request, 'qif/performance.html', {"form" : form})
>>>
>>> ovako nekako bi trebalo da radi
>>>
>>> уто, 15. јан 2019. у 12:49 Ivan Martić  је
>>> написао/ла:
>>>
 Ej hvala ti, puno mi je jasnije.. razumijem da si u gužvi, idem dalje
 sam pa ako zapnem javim se...

 5 Star for support!!

 uto, 15. sij 2019. u 12:45 Nebojsa Hajdukovic <
 nebojsa.zero...@gmail.com> napisao je:

> moras da dodas
> if request.method == "POST"
> form = PerformanceForm[request.POST]
> izvini sad sam u nekoj bas velikoj guzvi, evo ti otprilike kako sam ja
> na drugoj formi uradio, ako ne uspes ispisacu ti malo kasnije
> [image: image.png]
>
> уто, 15. јан 2019. у 12:26 Ivan Martić  је
> написао/ла:
>
>> Bravo! radi!
>> Samo što sad neradi spremanje (request.POST)...kako da to sad
>> implementiram, jel može savjet?
>>
>> uto, 15. sij 2019. u 12:22 Nebojsa Hajdukovic <
>> nebojsa.zero...@gmail.com> napisao je:
>>
>>> Obrisi ovo request.post or none
>>>
>>> uto, 15. jan 2019. 12:19 Ivan Martić  je
>>> napisao/la:
>>>
 Bok Nebojsa,

 hvala ti na brzom odgovoru.
 napravio sam ovako i nema promjene

 def performance_view(request):
 * form = PerformanceForm(request.POST or None,
 {'supplier_name':request.user})*
 if form.is_valid():
 form.save()
 messages.success(request, 'Your entry has been saved. Relevant
 persons will be informed of this change.')
 #(nevezano za populate) i ovaj message.success mi se isto  javlja
 kao problem.. na performance appu mi bilježi login/logout umjesto samo
 poruka nakon uspješnog spremanja.
 return render(request, 'qif/performance.html', {"form" : form})

 Možda mi nešto na formi nedostaje?

 uto, 15. sij 2019. u 11:59 Nebojsa Hajdukovic <
 nebojsa.zero...@gmail.com> napisao je:

> Hey, based on your name I believe u speak our language, so will
> switch to that : )
>
> Ako hoces da na primer supplier_name bude automatski popunjeno kao
> koristik samo dodaj ovako u views.py:
> view:
> def performance_view(request):
> form = PerformanceForm({'supplier_name':request.user})
> if form.is_valid():
> form.save()
> return render(request, 'qif/performance.html', {"form" : form})
>
> уто, 15. јан 2019. у 09:51 Ivan Martić  је
> написао/ла:
>
>> Hi all,
>>
>> can someone assist me.
>> I cant get the modelform field get populated with active username.
>>
>> Does any one have a good advice?
>>
>> view:
>> def performance_view(request):
>> form = PerformanceForm(request.POST or None)
>> if form.is_valid():
>> form.save()
>> return render(request, 'qif/performance.html', {"form" : form})
>>
>> forms:
>> from django import forms
>> from .models import Performance
>>
>>
>> class PerformanceForm(forms.ModelForm):
>> class Meta:
>> model = Performance
>> fields = [
>> 'supplier_name',
>> 'deliverability',
>> 'rating',
>> 'rated_by',
>> 'date_of_entry'
>> ]
>>
>> def __init__(self, rated_by, *args, **kwargs):
>> super(PerformanceForm, self).__init__(*args, **kwargs)
>> 

Re: To learn proper project based Django .

2019-01-15 Thread PASCUAL Eric
Hi,


The Django official website includes an extensive reference documentation and a 
detailed tutorial. This is the preferred start point.


Afterwards, you can grab complements from resources such as  :

  *   Django Girls site
  *   Two Scoops of Django book


These are those which came out of my mind, but there are plenty others.


BTW Two Scoops is a great book which goes beyond Django itself, and provides 
advice about how to structure a Django project, which extensions and tools are 
useful,... It's a very valuable source of inspiration to build your own 
experience. Just be warned that it refers to Django 1.11 (and not yet Django 
2.x), but this should not be a real problem for now.


Once you'll have assimilated the content of theses sources, you'll be very well 
prepared for Django coding ;)


Regards


Eric


From: django-users@googlegroups.com  on behalf 
of Nikhil kanamadi 
Sent: Tuesday, January 15, 2019 10:38:09 AM
To: django-users@googlegroups.com
Subject: To learn proper project based Django .

Hi all,

I am one year experienced software professional.
Worked on python and flask.
But now I need to learn And build hands-on Django projects.
Which is best source for project based understanding  and learning.

Please provide me any free hands-on  bootcamps  or sources.

--
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/CAJruv46usXAMXUXukt7%2BsGuMSib1JMdTVL_04zd7EQt0tQ3CZA%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/AM0P193MB0308D44E73EE3A85D2ADC7F08C810%40AM0P193MB0308.EURP193.PROD.OUTLOOK.COM.
For more options, visit https://groups.google.com/d/optout.


Re: Storing SSN and other PII in Django

2019-01-15 Thread Jason
There was a djangocon presentation on similar topic:  
https://www.youtube.com/watch?v=wRro4xv8n6k

That said, when it comes to SSNs, I'd just store the last four digits in 
plaintext and encrypt the rest.

oh, and ensure everything is https end to end.  all this won't do anything 
if you're exposing all your traffic on a regular http connection.

On Monday, January 14, 2019 at 3:41:21 PM UTC-5, cp...@usc.edu wrote:
>
> Hey all,
>
> My company requires us to store a user's SSN to report business on his or 
> her behalf. I'll admit that I've never built out a django production app, 
> so I'm not sure the best practices for storing PII. Is there any way to 
> encrypt the information on the backend so even the admins like me couldn't 
> read the data? It needs to be stored so that I Can run a script on our 
> database that produces a large concatenated string of each user's 
> information.
>
> Thanks for any suggestions!
> Charlie
>

-- 
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/082ce908-468f-4b30-a7e5-eab5b1f2cab7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


I want to test the function of django application created on docker with selenium

2019-01-15 Thread yuya . nishimaki . miraidenshi
*I'm trying to do:*
I want to test the function of django application with selenium, behave and 
behave-django.
Also, I want to check the flow of execution of selenium by accessing the 
vnc server (vnc://localhost:5900).

*The problem:*
The vnc server refuses the access to the localhost. But, I can access the 
other websites, for exmaple, https://www.google.com/.

Also, nothing is displayed in the reverse-proxy log. So I thought that 
reverse-proxy was not working well, but I do not know the solution.

Can anyone tell me the solution or clues?

Details of the questions are summarized in stackoverflow.
Can anyone answer this?
https://stackoverflow.com/q/54195889/10680292

-- 
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/ac3c8039-0add-4e08-951b-ed61e0e4ee3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


To learn proper project based Django .

2019-01-15 Thread Nikhil kanamadi
Hi all,

I am one year experienced software professional.
Worked on python and flask.
But now I need to learn And build hands-on Django projects.
Which is best source for project based understanding  and learning.

Please provide me any free hands-on  bootcamps  or sources.

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


Re: Populate modelform field with username

2019-01-15 Thread Ivan Martić
Nema greški ali save ne prolazi..

System check identified no issues (0 silenced).
January 15, 2019 - 13:01:29
Django version 2.1.4, using settings 'qif.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[15/Jan/2019 13:01:31] "GET / HTTP/1.1" 200 8939
[15/Jan/2019 13:01:33] "GET /performance/ HTTP/1.1" 200 14799
[15/Jan/2019 13:01:39] "POST /performance/ HTTP/1.1" 200 14811

Da li ovi podaci mogu što pomoći?

uto, 15. sij 2019. u 12:54 Ivan Martić  napisao je:

> Nažalost, iz nekog razloga ne prolazi save ni poruka nakog save...
>
>
> uto, 15. sij 2019. u 12:52 Nebojsa Hajdukovic 
> napisao je:
>
>> view:
>> def performance_view(request):
>> form = PerformanceForm( {'supplier_name':request.user}  )
>> if request.method == "POST":
>> form = PerformanceForm[request.POST]
>> if form.is_valid():
>> form.save()
>> return render(request, 'qif/performance.html', {"form" : form})
>>
>> ovako nekako bi trebalo da radi
>>
>> уто, 15. јан 2019. у 12:49 Ivan Martić  је
>> написао/ла:
>>
>>> Ej hvala ti, puno mi je jasnije.. razumijem da si u gužvi, idem dalje
>>> sam pa ako zapnem javim se...
>>>
>>> 5 Star for support!!
>>>
>>> uto, 15. sij 2019. u 12:45 Nebojsa Hajdukovic 
>>> napisao je:
>>>
 moras da dodas
 if request.method == "POST"
 form = PerformanceForm[request.POST]
 izvini sad sam u nekoj bas velikoj guzvi, evo ti otprilike kako sam ja
 na drugoj formi uradio, ako ne uspes ispisacu ti malo kasnije
 [image: image.png]

 уто, 15. јан 2019. у 12:26 Ivan Martić  је
 написао/ла:

> Bravo! radi!
> Samo što sad neradi spremanje (request.POST)...kako da to sad
> implementiram, jel može savjet?
>
> uto, 15. sij 2019. u 12:22 Nebojsa Hajdukovic <
> nebojsa.zero...@gmail.com> napisao je:
>
>> Obrisi ovo request.post or none
>>
>> uto, 15. jan 2019. 12:19 Ivan Martić  je
>> napisao/la:
>>
>>> Bok Nebojsa,
>>>
>>> hvala ti na brzom odgovoru.
>>> napravio sam ovako i nema promjene
>>>
>>> def performance_view(request):
>>> * form = PerformanceForm(request.POST or None,
>>> {'supplier_name':request.user})*
>>> if form.is_valid():
>>> form.save()
>>> messages.success(request, 'Your entry has been saved. Relevant
>>> persons will be informed of this change.')
>>> #(nevezano za populate) i ovaj message.success mi se isto  javlja
>>> kao problem.. na performance appu mi bilježi login/logout umjesto samo
>>> poruka nakon uspješnog spremanja.
>>> return render(request, 'qif/performance.html', {"form" : form})
>>>
>>> Možda mi nešto na formi nedostaje?
>>>
>>> uto, 15. sij 2019. u 11:59 Nebojsa Hajdukovic <
>>> nebojsa.zero...@gmail.com> napisao je:
>>>
 Hey, based on your name I believe u speak our language, so will
 switch to that : )

 Ako hoces da na primer supplier_name bude automatski popunjeno kao
 koristik samo dodaj ovako u views.py:
 view:
 def performance_view(request):
 form = PerformanceForm({'supplier_name':request.user})
 if form.is_valid():
 form.save()
 return render(request, 'qif/performance.html', {"form" : form})

 уто, 15. јан 2019. у 09:51 Ivan Martić  је
 написао/ла:

> Hi all,
>
> can someone assist me.
> I cant get the modelform field get populated with active username.
>
> Does any one have a good advice?
>
> view:
> def performance_view(request):
> form = PerformanceForm(request.POST or None)
> if form.is_valid():
> form.save()
> return render(request, 'qif/performance.html', {"form" : form})
>
> forms:
> from django import forms
> from .models import Performance
>
>
> class PerformanceForm(forms.ModelForm):
> class Meta:
> model = Performance
> fields = [
> 'supplier_name',
> 'deliverability',
> 'rating',
> 'rated_by',
> 'date_of_entry'
> ]
>
> def __init__(self, rated_by, *args, **kwargs):
> super(PerformanceForm, self).__init__(*args, **kwargs)
> self.fields["rated_by"].initial = rated_by
>
> what am i missing..
> Thank you in advance..
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> 

Re: Populate modelform field with username

2019-01-15 Thread Ivan Martić
Nažalost, iz nekog razloga ne prolazi save ni poruka nakog save...


uto, 15. sij 2019. u 12:52 Nebojsa Hajdukovic 
napisao je:

> view:
> def performance_view(request):
> form = PerformanceForm( {'supplier_name':request.user}  )
> if request.method == "POST":
> form = PerformanceForm[request.POST]
> if form.is_valid():
> form.save()
> return render(request, 'qif/performance.html', {"form" : form})
>
> ovako nekako bi trebalo da radi
>
> уто, 15. јан 2019. у 12:49 Ivan Martić  је
> написао/ла:
>
>> Ej hvala ti, puno mi je jasnije.. razumijem da si u gužvi, idem dalje sam
>> pa ako zapnem javim se...
>>
>> 5 Star for support!!
>>
>> uto, 15. sij 2019. u 12:45 Nebojsa Hajdukovic 
>> napisao je:
>>
>>> moras da dodas
>>> if request.method == "POST"
>>> form = PerformanceForm[request.POST]
>>> izvini sad sam u nekoj bas velikoj guzvi, evo ti otprilike kako sam ja
>>> na drugoj formi uradio, ako ne uspes ispisacu ti malo kasnije
>>> [image: image.png]
>>>
>>> уто, 15. јан 2019. у 12:26 Ivan Martić  је
>>> написао/ла:
>>>
 Bravo! radi!
 Samo što sad neradi spremanje (request.POST)...kako da to sad
 implementiram, jel može savjet?

 uto, 15. sij 2019. u 12:22 Nebojsa Hajdukovic <
 nebojsa.zero...@gmail.com> napisao je:

> Obrisi ovo request.post or none
>
> uto, 15. jan 2019. 12:19 Ivan Martić  je
> napisao/la:
>
>> Bok Nebojsa,
>>
>> hvala ti na brzom odgovoru.
>> napravio sam ovako i nema promjene
>>
>> def performance_view(request):
>> * form = PerformanceForm(request.POST or None,
>> {'supplier_name':request.user})*
>> if form.is_valid():
>> form.save()
>> messages.success(request, 'Your entry has been saved. Relevant
>> persons will be informed of this change.')
>> #(nevezano za populate) i ovaj message.success mi se isto  javlja kao
>> problem.. na performance appu mi bilježi login/logout umjesto samo poruka
>> nakon uspješnog spremanja.
>> return render(request, 'qif/performance.html', {"form" : form})
>>
>> Možda mi nešto na formi nedostaje?
>>
>> uto, 15. sij 2019. u 11:59 Nebojsa Hajdukovic <
>> nebojsa.zero...@gmail.com> napisao je:
>>
>>> Hey, based on your name I believe u speak our language, so will
>>> switch to that : )
>>>
>>> Ako hoces da na primer supplier_name bude automatski popunjeno kao
>>> koristik samo dodaj ovako u views.py:
>>> view:
>>> def performance_view(request):
>>> form = PerformanceForm({'supplier_name':request.user})
>>> if form.is_valid():
>>> form.save()
>>> return render(request, 'qif/performance.html', {"form" : form})
>>>
>>> уто, 15. јан 2019. у 09:51 Ivan Martić  је
>>> написао/ла:
>>>
 Hi all,

 can someone assist me.
 I cant get the modelform field get populated with active username.

 Does any one have a good advice?

 view:
 def performance_view(request):
 form = PerformanceForm(request.POST or None)
 if form.is_valid():
 form.save()
 return render(request, 'qif/performance.html', {"form" : form})

 forms:
 from django import forms
 from .models import Performance


 class PerformanceForm(forms.ModelForm):
 class Meta:
 model = Performance
 fields = [
 'supplier_name',
 'deliverability',
 'rating',
 'rated_by',
 'date_of_entry'
 ]

 def __init__(self, rated_by, *args, **kwargs):
 super(PerformanceForm, self).__init__(*args, **kwargs)
 self.fields["rated_by"].initial = rated_by

 what am i missing..
 Thank you in advance..

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it,
 send an email to django-users+unsubscr...@googlegroups.com.
 To post to this group, send email to django-users@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/df4ca182-fb48-4a27-a2a0-a9b20f0e6a21%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 

Re: Populate modelform field with username

2019-01-15 Thread Nebojsa Hajdukovic
view:
def performance_view(request):
form = PerformanceForm( {'supplier_name':request.user}  )
if request.method == "POST":
form = PerformanceForm[request.POST]
if form.is_valid():
form.save()
return render(request, 'qif/performance.html', {"form" : form})

ovako nekako bi trebalo da radi

уто, 15. јан 2019. у 12:49 Ivan Martić  је
написао/ла:

> Ej hvala ti, puno mi je jasnije.. razumijem da si u gužvi, idem dalje sam
> pa ako zapnem javim se...
>
> 5 Star for support!!
>
> uto, 15. sij 2019. u 12:45 Nebojsa Hajdukovic 
> napisao je:
>
>> moras da dodas
>> if request.method == "POST"
>> form = PerformanceForm[request.POST]
>> izvini sad sam u nekoj bas velikoj guzvi, evo ti otprilike kako sam ja na
>> drugoj formi uradio, ako ne uspes ispisacu ti malo kasnije
>> [image: image.png]
>>
>> уто, 15. јан 2019. у 12:26 Ivan Martić  је
>> написао/ла:
>>
>>> Bravo! radi!
>>> Samo što sad neradi spremanje (request.POST)...kako da to sad
>>> implementiram, jel može savjet?
>>>
>>> uto, 15. sij 2019. u 12:22 Nebojsa Hajdukovic 
>>> napisao je:
>>>
 Obrisi ovo request.post or none

 uto, 15. jan 2019. 12:19 Ivan Martić  je
 napisao/la:

> Bok Nebojsa,
>
> hvala ti na brzom odgovoru.
> napravio sam ovako i nema promjene
>
> def performance_view(request):
> * form = PerformanceForm(request.POST or None,
> {'supplier_name':request.user})*
> if form.is_valid():
> form.save()
> messages.success(request, 'Your entry has been saved. Relevant persons
> will be informed of this change.')
> #(nevezano za populate) i ovaj message.success mi se isto  javlja kao
> problem.. na performance appu mi bilježi login/logout umjesto samo poruka
> nakon uspješnog spremanja.
> return render(request, 'qif/performance.html', {"form" : form})
>
> Možda mi nešto na formi nedostaje?
>
> uto, 15. sij 2019. u 11:59 Nebojsa Hajdukovic <
> nebojsa.zero...@gmail.com> napisao je:
>
>> Hey, based on your name I believe u speak our language, so will
>> switch to that : )
>>
>> Ako hoces da na primer supplier_name bude automatski popunjeno kao
>> koristik samo dodaj ovako u views.py:
>> view:
>> def performance_view(request):
>> form = PerformanceForm({'supplier_name':request.user})
>> if form.is_valid():
>> form.save()
>> return render(request, 'qif/performance.html', {"form" : form})
>>
>> уто, 15. јан 2019. у 09:51 Ivan Martić  је
>> написао/ла:
>>
>>> Hi all,
>>>
>>> can someone assist me.
>>> I cant get the modelform field get populated with active username.
>>>
>>> Does any one have a good advice?
>>>
>>> view:
>>> def performance_view(request):
>>> form = PerformanceForm(request.POST or None)
>>> if form.is_valid():
>>> form.save()
>>> return render(request, 'qif/performance.html', {"form" : form})
>>>
>>> forms:
>>> from django import forms
>>> from .models import Performance
>>>
>>>
>>> class PerformanceForm(forms.ModelForm):
>>> class Meta:
>>> model = Performance
>>> fields = [
>>> 'supplier_name',
>>> 'deliverability',
>>> 'rating',
>>> 'rated_by',
>>> 'date_of_entry'
>>> ]
>>>
>>> def __init__(self, rated_by, *args, **kwargs):
>>> super(PerformanceForm, self).__init__(*args, **kwargs)
>>> self.fields["rated_by"].initial = rated_by
>>>
>>> what am i missing..
>>> Thank you in advance..
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it,
>>> send an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/df4ca182-fb48-4a27-a2a0-a9b20f0e6a21%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/CAJ60hW2jg6rAeHtX-dW8KJj3dVK5DRsYDWCT0f0eh9-tJKqTBQ%40mail.gmail.com
>> 

Re: Populate modelform field with username

2019-01-15 Thread Ivan Martić
Ej hvala ti, puno mi je jasnije.. razumijem da si u gužvi, idem dalje sam
pa ako zapnem javim se...

5 Star for support!!

uto, 15. sij 2019. u 12:45 Nebojsa Hajdukovic 
napisao je:

> moras da dodas
> if request.method == "POST"
> form = PerformanceForm[request.POST]
> izvini sad sam u nekoj bas velikoj guzvi, evo ti otprilike kako sam ja na
> drugoj formi uradio, ako ne uspes ispisacu ti malo kasnije
> [image: image.png]
>
> уто, 15. јан 2019. у 12:26 Ivan Martić  је
> написао/ла:
>
>> Bravo! radi!
>> Samo što sad neradi spremanje (request.POST)...kako da to sad
>> implementiram, jel može savjet?
>>
>> uto, 15. sij 2019. u 12:22 Nebojsa Hajdukovic 
>> napisao je:
>>
>>> Obrisi ovo request.post or none
>>>
>>> uto, 15. jan 2019. 12:19 Ivan Martić  je
>>> napisao/la:
>>>
 Bok Nebojsa,

 hvala ti na brzom odgovoru.
 napravio sam ovako i nema promjene

 def performance_view(request):
 * form = PerformanceForm(request.POST or None,
 {'supplier_name':request.user})*
 if form.is_valid():
 form.save()
 messages.success(request, 'Your entry has been saved. Relevant persons
 will be informed of this change.')
 #(nevezano za populate) i ovaj message.success mi se isto  javlja kao
 problem.. na performance appu mi bilježi login/logout umjesto samo poruka
 nakon uspješnog spremanja.
 return render(request, 'qif/performance.html', {"form" : form})

 Možda mi nešto na formi nedostaje?

 uto, 15. sij 2019. u 11:59 Nebojsa Hajdukovic <
 nebojsa.zero...@gmail.com> napisao je:

> Hey, based on your name I believe u speak our language, so will switch
> to that : )
>
> Ako hoces da na primer supplier_name bude automatski popunjeno kao
> koristik samo dodaj ovako u views.py:
> view:
> def performance_view(request):
> form = PerformanceForm({'supplier_name':request.user})
> if form.is_valid():
> form.save()
> return render(request, 'qif/performance.html', {"form" : form})
>
> уто, 15. јан 2019. у 09:51 Ivan Martić  је
> написао/ла:
>
>> Hi all,
>>
>> can someone assist me.
>> I cant get the modelform field get populated with active username.
>>
>> Does any one have a good advice?
>>
>> view:
>> def performance_view(request):
>> form = PerformanceForm(request.POST or None)
>> if form.is_valid():
>> form.save()
>> return render(request, 'qif/performance.html', {"form" : form})
>>
>> forms:
>> from django import forms
>> from .models import Performance
>>
>>
>> class PerformanceForm(forms.ModelForm):
>> class Meta:
>> model = Performance
>> fields = [
>> 'supplier_name',
>> 'deliverability',
>> 'rating',
>> 'rated_by',
>> 'date_of_entry'
>> ]
>>
>> def __init__(self, rated_by, *args, **kwargs):
>> super(PerformanceForm, self).__init__(*args, **kwargs)
>> self.fields["rated_by"].initial = rated_by
>>
>> what am i missing..
>> Thank you in advance..
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/df4ca182-fb48-4a27-a2a0-a9b20f0e6a21%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/CAJ60hW2jg6rAeHtX-dW8KJj3dVK5DRsYDWCT0f0eh9-tJKqTBQ%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.

Re: Populate modelform field with username

2019-01-15 Thread Nebojsa Hajdukovic
moras da dodas
if request.method == "POST"
form = PerformanceForm[request.POST]
izvini sad sam u nekoj bas velikoj guzvi, evo ti otprilike kako sam ja na
drugoj formi uradio, ako ne uspes ispisacu ti malo kasnije
[image: image.png]

уто, 15. јан 2019. у 12:26 Ivan Martić  је
написао/ла:

> Bravo! radi!
> Samo što sad neradi spremanje (request.POST)...kako da to sad
> implementiram, jel može savjet?
>
> uto, 15. sij 2019. u 12:22 Nebojsa Hajdukovic 
> napisao je:
>
>> Obrisi ovo request.post or none
>>
>> uto, 15. jan 2019. 12:19 Ivan Martić  je
>> napisao/la:
>>
>>> Bok Nebojsa,
>>>
>>> hvala ti na brzom odgovoru.
>>> napravio sam ovako i nema promjene
>>>
>>> def performance_view(request):
>>> * form = PerformanceForm(request.POST or None,
>>> {'supplier_name':request.user})*
>>> if form.is_valid():
>>> form.save()
>>> messages.success(request, 'Your entry has been saved. Relevant persons
>>> will be informed of this change.')
>>> #(nevezano za populate) i ovaj message.success mi se isto  javlja kao
>>> problem.. na performance appu mi bilježi login/logout umjesto samo poruka
>>> nakon uspješnog spremanja.
>>> return render(request, 'qif/performance.html', {"form" : form})
>>>
>>> Možda mi nešto na formi nedostaje?
>>>
>>> uto, 15. sij 2019. u 11:59 Nebojsa Hajdukovic 
>>> napisao je:
>>>
 Hey, based on your name I believe u speak our language, so will switch
 to that : )

 Ako hoces da na primer supplier_name bude automatski popunjeno kao
 koristik samo dodaj ovako u views.py:
 view:
 def performance_view(request):
 form = PerformanceForm({'supplier_name':request.user})
 if form.is_valid():
 form.save()
 return render(request, 'qif/performance.html', {"form" : form})

 уто, 15. јан 2019. у 09:51 Ivan Martić  је
 написао/ла:

> Hi all,
>
> can someone assist me.
> I cant get the modelform field get populated with active username.
>
> Does any one have a good advice?
>
> view:
> def performance_view(request):
> form = PerformanceForm(request.POST or None)
> if form.is_valid():
> form.save()
> return render(request, 'qif/performance.html', {"form" : form})
>
> forms:
> from django import forms
> from .models import Performance
>
>
> class PerformanceForm(forms.ModelForm):
> class Meta:
> model = Performance
> fields = [
> 'supplier_name',
> 'deliverability',
> 'rating',
> 'rated_by',
> 'date_of_entry'
> ]
>
> def __init__(self, rated_by, *args, **kwargs):
> super(PerformanceForm, self).__init__(*args, **kwargs)
> self.fields["rated_by"].initial = rated_by
>
> what am i missing..
> Thank you in advance..
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/df4ca182-fb48-4a27-a2a0-a9b20f0e6a21%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/CAJ60hW2jg6rAeHtX-dW8KJj3dVK5DRsYDWCT0f0eh9-tJKqTBQ%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/CAFab_C_iOye2LahEJxOArPPqyEaqEFcM_H%2B2MrDeRXHbTaYGYw%40mail.gmail.com
>>> 

Re: Populate modelform field with username

2019-01-15 Thread Ivan Martić
Bravo! radi!
Samo što sad neradi spremanje (request.POST)...kako da to sad
implementiram, jel može savjet?

uto, 15. sij 2019. u 12:22 Nebojsa Hajdukovic 
napisao je:

> Obrisi ovo request.post or none
>
> uto, 15. jan 2019. 12:19 Ivan Martić  je
> napisao/la:
>
>> Bok Nebojsa,
>>
>> hvala ti na brzom odgovoru.
>> napravio sam ovako i nema promjene
>>
>> def performance_view(request):
>> * form = PerformanceForm(request.POST or None,
>> {'supplier_name':request.user})*
>> if form.is_valid():
>> form.save()
>> messages.success(request, 'Your entry has been saved. Relevant persons
>> will be informed of this change.')
>> #(nevezano za populate) i ovaj message.success mi se isto  javlja kao
>> problem.. na performance appu mi bilježi login/logout umjesto samo poruka
>> nakon uspješnog spremanja.
>> return render(request, 'qif/performance.html', {"form" : form})
>>
>> Možda mi nešto na formi nedostaje?
>>
>> uto, 15. sij 2019. u 11:59 Nebojsa Hajdukovic 
>> napisao je:
>>
>>> Hey, based on your name I believe u speak our language, so will switch
>>> to that : )
>>>
>>> Ako hoces da na primer supplier_name bude automatski popunjeno kao
>>> koristik samo dodaj ovako u views.py:
>>> view:
>>> def performance_view(request):
>>> form = PerformanceForm({'supplier_name':request.user})
>>> if form.is_valid():
>>> form.save()
>>> return render(request, 'qif/performance.html', {"form" : form})
>>>
>>> уто, 15. јан 2019. у 09:51 Ivan Martić  је
>>> написао/ла:
>>>
 Hi all,

 can someone assist me.
 I cant get the modelform field get populated with active username.

 Does any one have a good advice?

 view:
 def performance_view(request):
 form = PerformanceForm(request.POST or None)
 if form.is_valid():
 form.save()
 return render(request, 'qif/performance.html', {"form" : form})

 forms:
 from django import forms
 from .models import Performance


 class PerformanceForm(forms.ModelForm):
 class Meta:
 model = Performance
 fields = [
 'supplier_name',
 'deliverability',
 'rating',
 'rated_by',
 'date_of_entry'
 ]

 def __init__(self, rated_by, *args, **kwargs):
 super(PerformanceForm, self).__init__(*args, **kwargs)
 self.fields["rated_by"].initial = rated_by

 what am i missing..
 Thank you in advance..

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.
 To post to this group, send email to django-users@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/df4ca182-fb48-4a27-a2a0-a9b20f0e6a21%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/CAJ60hW2jg6rAeHtX-dW8KJj3dVK5DRsYDWCT0f0eh9-tJKqTBQ%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/CAFab_C_iOye2LahEJxOArPPqyEaqEFcM_H%2B2MrDeRXHbTaYGYw%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 

Re: Populate modelform field with username

2019-01-15 Thread Nebojsa Hajdukovic
Obrisi ovo request.post or none

uto, 15. jan 2019. 12:19 Ivan Martić  je napisao/la:

> Bok Nebojsa,
>
> hvala ti na brzom odgovoru.
> napravio sam ovako i nema promjene
>
> def performance_view(request):
> * form = PerformanceForm(request.POST or None,
> {'supplier_name':request.user})*
> if form.is_valid():
> form.save()
> messages.success(request, 'Your entry has been saved. Relevant persons
> will be informed of this change.')
> #(nevezano za populate) i ovaj message.success mi se isto  javlja kao
> problem.. na performance appu mi bilježi login/logout umjesto samo poruka
> nakon uspješnog spremanja.
> return render(request, 'qif/performance.html', {"form" : form})
>
> Možda mi nešto na formi nedostaje?
>
> uto, 15. sij 2019. u 11:59 Nebojsa Hajdukovic 
> napisao je:
>
>> Hey, based on your name I believe u speak our language, so will switch to
>> that : )
>>
>> Ako hoces da na primer supplier_name bude automatski popunjeno kao
>> koristik samo dodaj ovako u views.py:
>> view:
>> def performance_view(request):
>> form = PerformanceForm({'supplier_name':request.user})
>> if form.is_valid():
>> form.save()
>> return render(request, 'qif/performance.html', {"form" : form})
>>
>> уто, 15. јан 2019. у 09:51 Ivan Martić  је
>> написао/ла:
>>
>>> Hi all,
>>>
>>> can someone assist me.
>>> I cant get the modelform field get populated with active username.
>>>
>>> Does any one have a good advice?
>>>
>>> view:
>>> def performance_view(request):
>>> form = PerformanceForm(request.POST or None)
>>> if form.is_valid():
>>> form.save()
>>> return render(request, 'qif/performance.html', {"form" : form})
>>>
>>> forms:
>>> from django import forms
>>> from .models import Performance
>>>
>>>
>>> class PerformanceForm(forms.ModelForm):
>>> class Meta:
>>> model = Performance
>>> fields = [
>>> 'supplier_name',
>>> 'deliverability',
>>> 'rating',
>>> 'rated_by',
>>> 'date_of_entry'
>>> ]
>>>
>>> def __init__(self, rated_by, *args, **kwargs):
>>> super(PerformanceForm, self).__init__(*args, **kwargs)
>>> self.fields["rated_by"].initial = rated_by
>>>
>>> what am i missing..
>>> Thank you in advance..
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/df4ca182-fb48-4a27-a2a0-a9b20f0e6a21%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/CAJ60hW2jg6rAeHtX-dW8KJj3dVK5DRsYDWCT0f0eh9-tJKqTBQ%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/CAFab_C_iOye2LahEJxOArPPqyEaqEFcM_H%2B2MrDeRXHbTaYGYw%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/CAJ60hW1YE0uihXQ%3DqC0mJ%2Btsy50Yo9n91GA2gFCz6HzEoq2bWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Populate modelform field with username

2019-01-15 Thread Ivan Martić
Bok Nebojsa,

hvala ti na brzom odgovoru.
napravio sam ovako i nema promjene

def performance_view(request):
* form = PerformanceForm(request.POST or None,
{'supplier_name':request.user})*
if form.is_valid():
form.save()
messages.success(request, 'Your entry has been saved. Relevant persons will
be informed of this change.')
#(nevezano za populate) i ovaj message.success mi se isto  javlja kao
problem.. na performance appu mi bilježi login/logout umjesto samo poruka
nakon uspješnog spremanja.
return render(request, 'qif/performance.html', {"form" : form})

Možda mi nešto na formi nedostaje?

uto, 15. sij 2019. u 11:59 Nebojsa Hajdukovic 
napisao je:

> Hey, based on your name I believe u speak our language, so will switch to
> that : )
>
> Ako hoces da na primer supplier_name bude automatski popunjeno kao
> koristik samo dodaj ovako u views.py:
> view:
> def performance_view(request):
> form = PerformanceForm({'supplier_name':request.user})
> if form.is_valid():
> form.save()
> return render(request, 'qif/performance.html', {"form" : form})
>
> уто, 15. јан 2019. у 09:51 Ivan Martić  је
> написао/ла:
>
>> Hi all,
>>
>> can someone assist me.
>> I cant get the modelform field get populated with active username.
>>
>> Does any one have a good advice?
>>
>> view:
>> def performance_view(request):
>> form = PerformanceForm(request.POST or None)
>> if form.is_valid():
>> form.save()
>> return render(request, 'qif/performance.html', {"form" : form})
>>
>> forms:
>> from django import forms
>> from .models import Performance
>>
>>
>> class PerformanceForm(forms.ModelForm):
>> class Meta:
>> model = Performance
>> fields = [
>> 'supplier_name',
>> 'deliverability',
>> 'rating',
>> 'rated_by',
>> 'date_of_entry'
>> ]
>>
>> def __init__(self, rated_by, *args, **kwargs):
>> super(PerformanceForm, self).__init__(*args, **kwargs)
>> self.fields["rated_by"].initial = rated_by
>>
>> what am i missing..
>> Thank you in advance..
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/df4ca182-fb48-4a27-a2a0-a9b20f0e6a21%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/CAJ60hW2jg6rAeHtX-dW8KJj3dVK5DRsYDWCT0f0eh9-tJKqTBQ%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/CAFab_C_iOye2LahEJxOArPPqyEaqEFcM_H%2B2MrDeRXHbTaYGYw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Populate modelform field with username

2019-01-15 Thread Nebojsa Hajdukovic
Hey, based on your name I believe u speak our language, so will switch to
that : )

Ako hoces da na primer supplier_name bude automatski popunjeno kao koristik
samo dodaj ovako u views.py:
view:
def performance_view(request):
form = PerformanceForm({'supplier_name':request.user})
if form.is_valid():
form.save()
return render(request, 'qif/performance.html', {"form" : form})

уто, 15. јан 2019. у 09:51 Ivan Martić  је
написао/ла:

> Hi all,
>
> can someone assist me.
> I cant get the modelform field get populated with active username.
>
> Does any one have a good advice?
>
> view:
> def performance_view(request):
> form = PerformanceForm(request.POST or None)
> if form.is_valid():
> form.save()
> return render(request, 'qif/performance.html', {"form" : form})
>
> forms:
> from django import forms
> from .models import Performance
>
>
> class PerformanceForm(forms.ModelForm):
> class Meta:
> model = Performance
> fields = [
> 'supplier_name',
> 'deliverability',
> 'rating',
> 'rated_by',
> 'date_of_entry'
> ]
>
> def __init__(self, rated_by, *args, **kwargs):
> super(PerformanceForm, self).__init__(*args, **kwargs)
> self.fields["rated_by"].initial = rated_by
>
> what am i missing..
> Thank you in advance..
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/df4ca182-fb48-4a27-a2a0-a9b20f0e6a21%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/CAJ60hW2jg6rAeHtX-dW8KJj3dVK5DRsYDWCT0f0eh9-tJKqTBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using the Models from two Different Projects in a single script

2019-01-15 Thread Michal Petrucha
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On Tue, Jan 15, 2019 at 03:04:23PM +0530, Glen D souza wrote:
> Hi,
> 
> I have two different django projects which each project having different
> model
> 
> Lets say projects to be p1 and p2
> 
> 
> Now i have to populate the data from p1 model to a model in p2 ( note p1
> and p2 models are different, i just have to use some data from p1 model to
> move to p2)
> 
> 
> Now in order to write the script i have to initialise two different django
> projects, something like
> 
> 
> os.environ.setdefault('DJANGO_SETTINGS_MODULE', "p1.settings")
> django.setup()
> 
> 
> settings.configure("p2.settings", DEBUG=True)
> django.setup()
> 
> 
> So i was wondering, is this even possible? and is there any other way

Hi Glen,

This won't work – Django uses a whole lot of global state to keep
track of all the settings, model registries, and so on.

I'd suggest an alternative approach, where you'd use a management
command to export the relevant data from one project (either just
dumpdata, or write your own, more specialized version), and then use
another management command in the other project to import the exported
data (again, either write your own custom importer, or use loaddata,
depending on whether you need to transform it in any way).

Good luck,

Michal
-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iQIcBAEBCgAGBQJcPbANAAoJEHA7T/IPM/klSMIQALnCiWUeVCvKvjVnrk6bboYX
abN8NrPjO/rEwVzqMnxw1V5wZvJ12SgK/hQMiiaO+LKMsbx0D8PSWTlZdPRzBWOi
asXnlxKdrEy/2zT7ohW0DGdl8mwltqIdkqtbAZl4T9/+gOwUiFIdvfw1SKX/Zbrx
rTXBKb/cwixUymfRPmdX0ML4d9NTQ4JD4N2RW1OKtMrn2PpfdW9nqtiukFC16ExX
8Zbow6SQHL5m2VfR/FJIdXY2ueG7RRm6TPrrHUF6ww3NIKBx1grUHw6vcyIW3ueb
YE0dDIhK0Xcj0zxwjumxjKG/Snzlrwc2TKtOM0syf3FXdgv4IWnP0iqj6i8R9hwM
F5x+4WsFrBbd6hLlNWXGmcwa5VzdxHSI0fZzVbtQI5gfMKVyk0byWdHIBlgNhBd6
SzwkGN2AgK+++cMwwGNKpiuo27EOS/ilHD7oLBTDSXcKFJ7UU9Unp56at+2mmd82
SjZsoDnoYoeOiuJ+Z6TMfvidvKrUJsuYqqZxWwlrUPLz1zWAyyWRdAq1n1fiZh3K
i8mr/n/QD64Jaq9KNZ+CU+/65Jicxg0bAtuvUuDrBUIirua9RJ+XEFTmphCWIobj
gBt5NPoR4ZkODukFG2N8IY3xxc9qEoZynTrhIxxpxcZJIdv2PoljsTnOk9BkUCYb
l+rHw0rgU2BZJkAd7AYg
=cOhG
-END PGP SIGNATURE-

-- 
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/20190115100357.GY8269%40konk.org.
For more options, visit https://groups.google.com/d/optout.


Using the Models from two Different Projects in a single script

2019-01-15 Thread Glen D souza
Hi,

I have two different django projects which each project having different
model

Lets say projects to be p1 and p2


Now i have to populate the data from p1 model to a model in p2 ( note p1
and p2 models are different, i just have to use some data from p1 model to
move to p2)


Now in order to write the script i have to initialise two different django
projects, something like


os.environ.setdefault('DJANGO_SETTINGS_MODULE', "p1.settings")
django.setup()


settings.configure("p2.settings", DEBUG=True)
django.setup()


So i was wondering, is this even possible? and is there any other way


Thanks

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


Admin problem launching a non-Admin page

2019-01-15 Thread Mike Dewhirst
I'm studying the Admin docs trying to figure out how to launch a 
non-Admin page when required.


Django 1.11 and Pythons 2.7/3.6

The parts which look promising are ...
[1]    ModelAdmin.response_add()
[2] ModelAdmin.response_change()
[3]    ModelAdmin.add_view()
[4]    ModelAdmin.change_view()
and
[5]    admin.ModelAdmin.form

The use-case is ...after saving, detect whether a token (from a payment 
gateway) exists in a subscription record and if not, launch a non-Admin 
Django page/form to interface with the payment gateway.


I have tried unsuccessfully to launch any of a form, view or template 
from the model save() method.


Has anyone had a similar Admin use-case and found a good way of tackling it?

Thanks for any suggestions

Mike

[1] 
https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.response_add
[2] 
https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.response_change
[3] 
https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.add_view
[4] 
https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.change_view
[5] 
https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#adding-custom-validation-to-the-admin


--
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/f078a84e-dce0-4da7-4cef-3e2759052926%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Populate modelform field with username

2019-01-15 Thread Ivan Martić
Hi all,

can someone assist me.
I cant get the modelform field get populated with active username.

Does any one have a good advice?

view:
def performance_view(request):
form = PerformanceForm(request.POST or None) 
if form.is_valid():
form.save()
return render(request, 'qif/performance.html', {"form" : form})

forms:
from django import forms
from .models import Performance


class PerformanceForm(forms.ModelForm):
class Meta:
model = Performance
fields = [
'supplier_name', 
'deliverability', 
'rating', 
'rated_by', 
'date_of_entry'
]

def __init__(self, rated_by, *args, **kwargs):
super(PerformanceForm, self).__init__(*args, **kwargs)
self.fields["rated_by"].initial = rated_by

what am i missing..
Thank you in advance..

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