Re: django 1.11 run error

2017-11-22 Thread ngn zone
Thanks k2527806 , Actually my virtualenv is activated and all the commands 
"python manage.py migrate " is run  while it is activated. So I still 
wonder what might be wrong. Is it the django installation or the virtualenv 
installation? I  wonder

On Wednesday, November 22, 2017 at 10:51:09 PM UTC+1, k2527806 wrote:
>
> If you use virtualenv, first of all activate the virtualenv
>
> On Nov 22, 2017 8:12 PM, "ngn zone"  
> wrote:
>
> Hello all,
>
>   I am new to Django. I am trying to run a project and when I run "python 
> manage.py makemigrations " I get the following error message. 
> What am I doing wrong?
>
>
> python manage.py makemigrations
> Traceback (most recent call last):
>   File "manage.py", line 9, in 
> dotenv.read_dotenv()
> AttributeError: 'module' object has no attribute 'read_dotenv'
>
> -- 
> You received this message because you are subscribed 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/7b296ad6-ef80-4186-a82b-a49345448bee%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/33a4b45e-37c9-4696-a0df-7a4408fd55f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do you access parent object values in an admin inline

2017-11-22 Thread Matemática A3K
On Wed, Nov 22, 2017 at 5:38 PM, test  wrote:

> Thanks for the response.
>
> I'm still kind of confused.
> So I save the request by overriding the function.
>

You save the object in the request so you can access it from the inline for
further processing, like showing or hiding something


> Then I can only read the request by overriding a function in the inline.
> How do I change the model in the overrided function in the inline.
>

If you want to change "the model entirely", you should do several inlines
(one per each model) and show the appropriate inline according to the
object. Here is sample (untested) code:
https://stackoverflow.com/questions/8074161/how-to-show-different-inlines-depending-of-current-object-field-value


>
> On Wednesday, November 22, 2017 at 1:54:08 PM UTC-5, Matemática A3K wrote:
>>
>>
>>
>> On Wed, Nov 22, 2017 at 3:21 PM, test  wrote:
>>
>>> For example:
>>>
>>> class AnswerInLine(admin.TabularInline):
>>>   model = Answers
>>>
>>> class QuestionAdmin(admin.ModelAdmin):
>>>   inlines = [AnswerInLine]
>>>
>>>
>>>  I want to change the model in the AnswerInLine depending on what the
>>> QuestionAdmin value is
>>>
>>> First save the request object in the parent of the inline, then use it
>> in fk field in the inline. Here is an example:
>> https://github.com/math-a3k/django-ai/blob/master/django_ai/
>> bayesian_networks/admin.py
>>
>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/7300b116-9681-46f9-8df5-aa95691f37d4%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/9b1c32ba-7441-488a-a9e4-9bcec9eaa824%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%2BFDnhJYSXkwcQhtkHkRKMdJUu%3Dr8_KvXrRnGB_zaphLDqP4iA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django 1.11 run error

2017-11-22 Thread nerdfiles
pyenv also allows for a .local file to autoload the environment

On Wednesday, November 22, 2017 at 3:51:09 PM UTC-6, k2527806 wrote:
>
> If you use virtualenv, first of all activate the virtualenv
>
> On Nov 22, 2017 8:12 PM, "ngn zone"  
> wrote:
>
> Hello all,
>
>   I am new to Django. I am trying to run a project and when I run "python 
> manage.py makemigrations " I get the following error message. 
> What am I doing wrong?
>
>
> python manage.py makemigrations
> Traceback (most recent call last):
>   File "manage.py", line 9, in 
> dotenv.read_dotenv()
> AttributeError: 'module' object has no attribute 'read_dotenv'
>
> -- 
> You received this message because you are subscribed 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/7b296ad6-ef80-4186-a82b-a49345448bee%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/d9ba221d-e3fd-4a74-903b-cf16e7f4b357%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django 1.11 run error

2017-11-22 Thread mohammad k
If you use virtualenv, first of all activate the virtualenv

On Nov 22, 2017 8:12 PM, "ngn zone"  wrote:

Hello all,

  I am new to Django. I am trying to run a project and when I run "python
manage.py makemigrations " I get the following error message.
What am I doing wrong?


python manage.py makemigrations
Traceback (most recent call last):
  File "manage.py", line 9, in 
dotenv.read_dotenv()
AttributeError: 'module' object has no attribute 'read_dotenv'

-- 
You received this message because you are subscribed 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/7b296ad6-ef80-4186-a82b-a49345448bee%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/CACOk0TzPjfdSNyhUGwZoX5Kp2JEoWSP3Ar%3Dgjpn%3DmsRsCYSMqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do you access parent object values in an admin inline

2017-11-22 Thread test
Thanks for the response.

I'm still kind of confused.
So I save the request by overriding the function. Then I can only read the 
request by overriding a function in the inline. How do I change the model 
in the overrided function in the inline.


On Wednesday, November 22, 2017 at 1:54:08 PM UTC-5, Matemática A3K wrote:
>
>
>
> On Wed, Nov 22, 2017 at 3:21 PM, test  
> wrote:
>
>> For example:
>>
>> class AnswerInLine(admin.TabularInline):
>>   model = Answers 
>>
>> class QuestionAdmin(admin.ModelAdmin):
>>   inlines = [AnswerInLine]
>>
>>
>>  I want to change the model in the AnswerInLine depending on what the 
>> QuestionAdmin value is
>>
>> First save the request object in the parent of the inline, then use it in 
> fk field in the inline. Here is an example:
>
> https://github.com/math-a3k/django-ai/blob/master/django_ai/bayesian_networks/admin.py
>  
>
>> -- 
>> You received this message because you are subscribed 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/7300b116-9681-46f9-8df5-aa95691f37d4%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/9b1c32ba-7441-488a-a9e4-9bcec9eaa824%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do you access parent object values in an admin inline

2017-11-22 Thread Matemática A3K
On Wed, Nov 22, 2017 at 3:21 PM, test  wrote:

> For example:
>
> class AnswerInLine(admin.TabularInline):
>   model = Answers
>
> class QuestionAdmin(admin.ModelAdmin):
>   inlines = [AnswerInLine]
>
>
>  I want to change the model in the AnswerInLine depending on what the
> QuestionAdmin value is
>
> First save the request object in the parent of the inline, then use it in
fk field in the inline. Here is an example:
https://github.com/math-a3k/django-ai/blob/master/django_ai/bayesian_networks/admin.py


> --
> You received this message because you are subscribed 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/7300b116-9681-46f9-8df5-aa95691f37d4%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%2BFDnhLS%3D81v%2BR73_yryP%2BYgS0uqCUHdOeqFrBkfCKp_LxsMaw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How do you access parent object values in an admin inline

2017-11-22 Thread test
For example:

class AnswerInLine(admin.TabularInline):
  model = Answers 

class QuestionAdmin(admin.ModelAdmin):
  inlines = [AnswerInLine]


 I want to change the model in the AnswerInLine depending on what the 
QuestionAdmin value is

-- 
You received this message because you are subscribed 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/7300b116-9681-46f9-8df5-aa95691f37d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django 1.11 run error

2017-11-22 Thread ngn zone
Hello all,

  I am new to Django. I am trying to run a project and when I run "python 
manage.py makemigrations " I get the following error message. 
What am I doing wrong?


python manage.py makemigrations
Traceback (most recent call last):
  File "manage.py", line 9, in 
dotenv.read_dotenv()
AttributeError: 'module' object has no attribute 'read_dotenv'

-- 
You received this message because you are subscribed 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/7b296ad6-ef80-4186-a82b-a49345448bee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError: 'TemplateResponse' object has no attribute '_reason_phrase'

2017-11-22 Thread Tim Graham
I tried a Google search for the last line of the error message and came to 
https://code.djangoproject.com/ticket/25964. Conclusion: try clearing your 
cache.

On Wednesday, November 22, 2017 at 3:29:42 AM UTC-5, Web Architect wrote:
>
> Hi,
>
> We recently migrated from Django 1.8 to Django 1.11.7. We have an 
> ecommerece site running on Django. When we are trying to access a page, 
> following exception is occuring:
>
> Traceback (most recent call last):
>
>   File "/usr/local/lib/python2.7/wsgiref/handlers.py", line 85, in run
>
> self.result = application(self.environ, self.start_response)
>
>   File 
> "/virenv/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", 
> line 63, in __call__
>
> return self.application(environ, start_response)
>
>   File 
> "/virenv/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 
> 161, in __call__
>
> status = '%d %s' % (response.status_code, response.reason_phrase)
>
>   File "/virenv/lib/python2.7/site-packages/django/http/response.py", 
> line 69, in reason_phrase
>
> if self._reason_phrase is not None:
>
> AttributeError: 'TemplateResponse' object has no attribute '_reason_phrase'
>
>
> I am completely clueless why the above exception is occurring. I do not 
> have any other data or logs for the above exception
>
>
> Could anyone help me in providing a way to debug the above?
>
>
> 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/27e97e12-d7bd-482b-835f-3dd9f82d7170%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Building a web app for use of third party python package

2017-11-22 Thread Derek
>From what you have said, this is not too hard.

You need a basic view to handle the upload, which is in turn will make a 
call to the specialised method for processing of the file (and zip 
creation) before returning the result to the user.

A quick Google shows some relevant examples:

* 
https://simpleisbetterthancomplex.com/tutorial/2016/08/01/how-to-upload-files-with-django.html
* 
https://stackoverflow.com/questions/12881294/django-create-a-zip-of-multiple-files-and-make-it-downloadable

(Stack Overflow is, in general, a massive resource for Python/Django Q).

HTH


On Tuesday, 21 November 2017 15:49:46 UTC+2, Enikő Regényi wrote:
>
> Hello,
>
> I would like to use Django for building a web application for use of a 
> third party python package. 
>
> This third party package uses a text file as input, and produces a bunch 
> of text files as output (sorted in directories). 
>
> I would like my website to take text/textfile from the user, and give an 
> archive (.zip) back with all the output files. 
>
> I went through the tutorial on the django website already, and made some 
> progress, but my understanding is still shallow for this project.
>
> Could someone point me to the best direction, or give tips on what bits of 
> the documentation I should read to get my head around it as fast as 
> possible?
>
>
> Many thanks!
>
> Eni
>

-- 
You received this message because you are subscribed 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/4991c517-723b-45b7-be89-5e02208f6d6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError: 'TemplateResponse' object has no attribute '_reason_phrase'

2017-11-22 Thread Jason
what is the code for the render call?

-- 
You received this message because you are subscribed 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/08ba6d49-7d3e-4fb7-a69c-dbb060e1c1fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to Speed up Loading the First Page of Django Project?

2017-11-22 Thread Jason
Regardless, your solution is not a good one, because you shifted from a 
password hashing algorithm that enables protection against brute-force 
attacks to a different algorithm with no similar protection.

I would highly suggest you read 
https://docs.djangoproject.com/en/1.11/topics/auth/passwords/ 

-- 
You received this message because you are subscribed 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/e99884be-e3da-4090-90f0-7592dfc7df5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


AttributeError: 'TemplateResponse' object has no attribute '_reason_phrase'

2017-11-22 Thread Web Architect
Hi,

We recently migrated from Django 1.8 to Django 1.11.7. We have an 
ecommerece site running on Django. When we are trying to access a page, 
following exception is occuring:

Traceback (most recent call last):

  File "/usr/local/lib/python2.7/wsgiref/handlers.py", line 85, in run

self.result = application(self.environ, self.start_response)

  File 
"/virenv/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", 
line 63, in __call__

return self.application(environ, start_response)

  File "/virenv/lib/python2.7/site-packages/django/core/handlers/wsgi.py", 
line 161, in __call__

status = '%d %s' % (response.status_code, response.reason_phrase)

  File "/virenv/lib/python2.7/site-packages/django/http/response.py", line 
69, in reason_phrase

if self._reason_phrase is not None:

AttributeError: 'TemplateResponse' object has no attribute '_reason_phrase'


I am completely clueless why the above exception is occurring. I do not 
have any other data or logs for the above exception


Could anyone help me in providing a way to debug the above?


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/1089b578-3a8e-4eed-8ff2-becdc8bf3de9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.