Re: do i need a custom admin app or should i just use django admin?

2019-06-17 Thread James Farris
Read the docs regarding this.
https://docs.djangoproject.com/en/2.2/topics/auth/default/#permissions-and-authorization


On Mon, Jun 17, 2019 at 11:31 AM Rajat Chopra  wrote:

> What are the reasons not to use Django Admin?
>
> Also with regards to creating views and giving those views permissions -
> are there any examples someone can point to help illustrate?
>
>
>
> On Monday, June 17, 2019 at 11:40:53 AM UTC-5, James Farris wrote:
>>
>> Think of the Django Admin as a tool for developers or Database Admins.
>> IMO, it should never be used by an end user.  Create views as Andreas
>> mentioned and give those views permissions.
>>
>> On Monday, June 17, 2019 at 4:12:53 AM UTC-7, Arya wrote:
>>>
>>> i'm planning to build a full ecommerce business to business website.
>>> there are several user types.
>>> *premium users need to create products and edit them. they need to
>>> communicate to each other. see statistics and access some premium content.*
>>> do you suggest to user the default django admin? or i'm better off
>>> creating a custom admin app ?
>>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/1LpORyVyQls/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2b4f9ad1-2c29-42ca-b585-3b96e0a07118%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2b4f9ad1-2c29-42ca-b585-3b96e0a07118%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAMdMWAURSPzwwxWAdf9dw_YApzH7S1jfso7_JObaPhg1MLfZTQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: do i need a custom admin app or should i just use django admin?

2019-06-17 Thread James Farris
Think of the Django Admin as a tool for developers or Database Admins.  
IMO, it should never be used by an end user.  Create views as Andreas 
mentioned and give those views permissions.

On Monday, June 17, 2019 at 4:12:53 AM UTC-7, Arya wrote:
>
> i'm planning to build a full ecommerce business to business website. there 
> are several user types.
> *premium users need to create products and edit them. they need to  
> communicate to each other. see statistics and access some premium content.*
> do you suggest to user the default django admin? or i'm better off 
> creating a custom admin app ?
>

-- 
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/851b7542-0dcf-49ca-85e6-1e306899720a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: my file uploads missing/deleted

2019-06-13 Thread James Farris
ate/loader_tags.py"
> in render
>   150. return compiled_parent._render(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in _render
>   163. return self.nodelist.render(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in render
>   937. bit = node.render_annotated(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in render_annotated
>   904. return self.render(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/loader_tags.py"
> in render
>   62. result = block.nodelist.render(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in render
>   937. bit = node.render_annotated(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in render_annotated
>   904. return self.render(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in render
>   987. output = self.filter_expression.resolve(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in resolve
>   671. obj = self.var.resolve(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in resolve
>   796. value = self._resolve_lookup(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in _resolve_lookup
>   837. current = getattr(current, bit)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/db/models/fields/files.py"
> in url
>   62. return self.storage.url(self.name)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/utils/functional.py"
> in inner
>   256. self._setup()
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/core/files/storage.py"
> in _setup
>   363. self._wrapped = get_storage_class()()
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/core/files/storage.py"
> in get_storage_class
>   358. return import_string(import_path or
> settings.DEFAULT_FILE_STORAGE)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/utils/module_loading.py"
> in import_string
>   17. module = import_module(module_path)
>
> File "/app/.heroku/python/lib/python3.6/importlib/__init__.py" in
> import_module
>   126. return _bootstrap._gcd_import(name[level:], package, level)
>
> File "" in _gcd_import
>   994. 
>
> File "" in _find_and_load
>   971. 
>
> File "" in _find_and_load_unlocked
>   955. 
>
> File "" in _load_unlocked
>   665. 
>
> File "" in exec_module
>   678. 
>
> File "" in _call_with_frames_removed
>   219. 
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django_dropbox_storage/storage.py"
> in 
>   8. from StringIO import StringIO
>
> Exception Type: ModuleNotFoundError at /8/clubpage/
> Exception Value: No module named 'StringIO'
>
>
> On Thursday, June 13, 2019 at 5:11:37 PM UTC+2, omar ahmed wrote:
>>
>> i added django_dropbox_storage in installed apps in settings.py
>> what should i add else ?
>> thanks
>> On Thursday, June 13, 2019 at 4:43:23 PM UTC+2, James Farris wrote:
>>>
>>> That means it wasn’t installed or it wasn’t added to your settings.py
>>> file in the installed apps section
>>>
>>> Sent from my mobile device
>>>
>>> On Jun 13, 2019, at 7:07 AM, omar ahmed  wrote:
>>>
>>> i followed the steps
>>> when i typed
>>> python manage.py test [--settings=test_settings]
>>> i found this error
>>> ModuleNotFoundError: No module named '[--settings=test_settings]'
>>> and when i tried to open my site (club page that has image) i foun this
>>> error
>>>
>>> No module named 'StringIO'
>>>
>>> i searched at Google but no similar issues
>>>
>>> On Thursday, June 13, 2019 at 1:03:10 AM UTC+2, James Farris wrote:
>>>>
>>>> This python package may be a better choice for you, since I assume you
>>>> want all user generated cont

Re: my file uploads missing/deleted

2019-06-13 Thread James Farris
When you run the server does it give you any errors?

On Thu, Jun 13, 2019 at 8:12 AM omar ahmed  wrote:

> i added django_dropbox_storage in installed apps in settings.py
> what should i add else ?
> thanks
> On Thursday, June 13, 2019 at 4:43:23 PM UTC+2, James Farris wrote:
>>
>> That means it wasn’t installed or it wasn’t added to your settings.py
>> file in the installed apps section
>>
>> Sent from my mobile device
>>
>> On Jun 13, 2019, at 7:07 AM, omar ahmed  wrote:
>>
>> i followed the steps
>> when i typed
>> python manage.py test [--settings=test_settings]
>> i found this error
>> ModuleNotFoundError: No module named '[--settings=test_settings]'
>> and when i tried to open my site (club page that has image) i foun this
>> error
>>
>> No module named 'StringIO'
>>
>> i searched at Google but no similar issues
>>
>> On Thursday, June 13, 2019 at 1:03:10 AM UTC+2, James Farris wrote:
>>>
>>> This python package may be a better choice for you, since I assume you
>>> want all user generated content (images) to be stored in Dropbox.
>>>
>>> This has pretty good documentation.
>>> https://pypi.org/project/django-dropbox-storage/
>>>
>>> If you use this package, remove the sample code I sent
>>>
>>>
>>> On Wed, Jun 12, 2019 at 3:53 PM omar ahmed  wrote:
>>>
>>>> i added this function at the end of views.py file
>>>> def connect_to_dropbox():
>>>> dbx = dropbox.Dropbox(‘your access token)
>>>> dbx.users_get_current_account()
>>>> and i put given access token from dropbox
>>>> then what about call
>>>> do you mean in any view function that will show page included images
>>>> add
>>>> connect_to_dropbox()
>>>> and what about
>>>>
>>>> for entry in dbx.files_list_folder('').entries:
>>>> print(entry.name)
>>>>
>>>>
>>>>
>>>> On Thursday, June 13, 2019 at 12:38:11 AM UTC+2, James Farris wrote:
>>>>>
>>>>> You would add this code to the views.py file, which is where the
>>>>> business logic goes.
>>>>>
>>>>> https://docs.djangoproject.com/en/2.2/topics/http/views/
>>>>>
>>>>> Likely would add a class with properties and methods or a definition
>>>>> (a function) like below:
>>>>>
>>>>> For example in your apps views.py file:
>>>>>
>>>>> def connect_to_dropbox():
>>>>> dbx = dropbox.Dropbox(‘your access token)
>>>>> dbx.users_get_current_account()
>>>>>
>>>>> # this stuff likely would go in a separate function
>>>>> for entry in dbx.files_list_folder(‘’).entries:
>>>>> print(entry.name)
>>>>>
>>>>>
>>>>> At some point in your code you would call the function:
>>>>> connect_to_dropbox()
>>>>>
>>>>> On Wed, Jun 12, 2019 at 3:10 PM omar ahmed  wrote:
>>>>>
>>>>>> i opened the documentation for django-storages ... and i installed
>>>>>> Dropbox in my environment and i created my app folder  but i didn't
>>>>>> complete docs .
>>>>>> somethings not clear ... like :
>>>>>> Link an account
>>>>>>
>>>>>> dbx = dropbox.Dropbox('YOUR_ACCESS_TOKEN')
>>>>>>
>>>>>> dbx.users_get_current_account()
>>>>>> Try some API requests
>>>>>>
>>>>>> for entry in dbx.files_list_folder('').entries:
>>>>>> print(entry.name)
>>>>>>
>>>>>> where should i write these commands ?
>>>>>> thanks
>>>>>>
>>>>>> On Wednesday, June 12, 2019 at 1:13:11 AM UTC+2, James Farris wrote:
>>>>>>>
>>>>>>> You might try the docs from Dropbox
>>>>>>> https://www.dropbox.com/developers/documentation/python#overview
>>>>>>>
>>>>>>> You can checkout this project for ideas
>>>>>>> https://github.com/singingwolfboy/django-with-dropbox
>>>>>>>
>>>>>>> and here is documentation for django-storages
>>>>>>>
>>>>>>> https://django-storages.readthedocs.io/en/latest/backends/dropbox.html
>>

Re: my file uploads missing/deleted

2019-06-13 Thread James Farris
That means it wasn’t installed or it wasn’t added to your settings.py file in 
the installed apps section 

Sent from my mobile device

> On Jun 13, 2019, at 7:07 AM, omar ahmed  wrote:
> 
> i followed the steps
> when i typed 
> python manage.py test [--settings=test_settings]
> i found this error 
> ModuleNotFoundError: No module named '[--settings=test_settings]'
> and when i tried to open my site (club page that has image) i foun this error
> No module named 'StringIO'
> i searched at Google but no similar issues
> 
>> On Thursday, June 13, 2019 at 1:03:10 AM UTC+2, James Farris wrote:
>> This python package may be a better choice for you, since I assume you want 
>> all user generated content (images) to be stored in Dropbox. 
>> 
>> This has pretty good documentation. 
>> https://pypi.org/project/django-dropbox-storage/
>> 
>> If you use this package, remove the sample code I sent
>> 
>> 
>>> On Wed, Jun 12, 2019 at 3:53 PM omar ahmed  wrote:
>>> i added this function at the end of views.py file 
>>> def connect_to_dropbox():
>>> dbx = dropbox.Dropbox(‘your access token)
>>> dbx.users_get_current_account()
>>> and i put given access token from dropbox
>>> then what about call
>>> do you mean in any view function that will show page included images add  
>>> connect_to_dropbox()
>>> and what about 
>>> for entry in dbx.files_list_folder('').entries:
>>> print(entry.name)
>>> 
>>> 
>>> 
>>>> On Thursday, June 13, 2019 at 12:38:11 AM UTC+2, James Farris wrote:
>>>> You would add this code to the views.py file, which is where the business 
>>>> logic goes. 
>>>> 
>>>> https://docs.djangoproject.com/en/2.2/topics/http/views/
>>>> 
>>>> Likely would add a class with properties and methods or a definition (a 
>>>> function) like below:
>>>> 
>>>> For example in your apps views.py file:
>>>> 
>>>> def connect_to_dropbox():
>>>> dbx = dropbox.Dropbox(‘your access token)
>>>> dbx.users_get_current_account()
>>>> 
>>>> # this stuff likely would go in a separate function
>>>> for entry in dbx.files_list_folder(‘’).entries:
>>>> print(entry.name)
>>>> 
>>>> 
>>>> At some point in your code you would call the function:
>>>> connect_to_dropbox()
>>>> 
>>>>> On Wed, Jun 12, 2019 at 3:10 PM omar ahmed  wrote:
>>>>> i opened the documentation for django-storages ... and i installed 
>>>>> Dropbox in my environment and i created my app folder  but i didn't 
>>>>> complete docs .
>>>>> somethings not clear ... like :
>>>>> Link an account 
>>>>> dbx = dropbox.Dropbox('YOUR_ACCESS_TOKEN')
>>>>> dbx.users_get_current_account()
>>>>> Try some API requests
>>>>> 
>>>>> for entry in dbx.files_list_folder('').entries:
>>>>> print(entry.name)
>>>>> where should i write these commands ?
>>>>> thanks
>>>>> 
>>>>> 
>>>>>> On Wednesday, June 12, 2019 at 1:13:11 AM UTC+2, James Farris wrote:
>>>>>> You might try the docs from Dropbox
>>>>>> https://www.dropbox.com/developers/documentation/python#overview
>>>>>> 
>>>>>> You can checkout this project for ideas
>>>>>> https://github.com/singingwolfboy/django-with-dropbox
>>>>>> 
>>>>>> and here is documentation for django-storages
>>>>>> https://django-storages.readthedocs.io/en/latest/backends/dropbox.html
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On Tue, Jun 11, 2019 at 2:17 PM omar ahmed  wrote:
>>>>>>> yes James you are right i need to upload images using the Django 
>>>>>>> admin, ... how can i use Dropbox for this issue ? 
>>>>>>> i need a good tutorial
>>>>>>> 
>>>>>>>> On Tuesday, June 11, 2019 at 6:14:10 PM UTC+2, James Farris wrote:
>>>>>>>> He is saying these aren’t static files. It sounds like he uploads them 
>>>>>>>> using the Django admin, which of course is like an end user on a 
>>>>>>>> client uploading files to the media directory. 
>>>>>>>> 
>>>>>>>

Re: my file uploads missing/deleted

2019-06-12 Thread James Farris
This python package may be a better choice for you, since I assume you want
all user generated content (images) to be stored in Dropbox.

This has pretty good documentation.
https://pypi.org/project/django-dropbox-storage/

If you use this package, remove the sample code I sent


On Wed, Jun 12, 2019 at 3:53 PM omar ahmed  wrote:

> i added this function at the end of views.py file
> def connect_to_dropbox():
> dbx = dropbox.Dropbox(‘your access token)
> dbx.users_get_current_account()
> and i put given access token from dropbox
> then what about call
> do you mean in any view function that will show page included images add
> connect_to_dropbox()
> and what about
>
> for entry in dbx.files_list_folder('').entries:
> print(entry.name)
>
>
>
> On Thursday, June 13, 2019 at 12:38:11 AM UTC+2, James Farris wrote:
>>
>> You would add this code to the views.py file, which is where the business
>> logic goes.
>>
>> https://docs.djangoproject.com/en/2.2/topics/http/views/
>>
>> Likely would add a class with properties and methods or a definition (a
>> function) like below:
>>
>> For example in your apps views.py file:
>>
>> def connect_to_dropbox():
>> dbx = dropbox.Dropbox(‘your access token)
>> dbx.users_get_current_account()
>>
>> # this stuff likely would go in a separate function
>> for entry in dbx.files_list_folder(‘’).entries:
>> print(entry.name)
>>
>>
>> At some point in your code you would call the function:
>> connect_to_dropbox()
>>
>> On Wed, Jun 12, 2019 at 3:10 PM omar ahmed  wrote:
>>
>>> i opened the documentation for django-storages ... and i installed
>>> Dropbox in my environment and i created my app folder  but i didn't
>>> complete docs .
>>> somethings not clear ... like :
>>> Link an account
>>>
>>> dbx = dropbox.Dropbox('YOUR_ACCESS_TOKEN')
>>>
>>> dbx.users_get_current_account()
>>> Try some API requests
>>>
>>> for entry in dbx.files_list_folder('').entries:
>>> print(entry.name)
>>>
>>> where should i write these commands ?
>>> thanks
>>>
>>> On Wednesday, June 12, 2019 at 1:13:11 AM UTC+2, James Farris wrote:
>>>>
>>>> You might try the docs from Dropbox
>>>> https://www.dropbox.com/developers/documentation/python#overview
>>>>
>>>> You can checkout this project for ideas
>>>> https://github.com/singingwolfboy/django-with-dropbox
>>>>
>>>> and here is documentation for django-storages
>>>> https://django-storages.readthedocs.io/en/latest/backends/dropbox.html
>>>>
>>>>
>>>>
>>>> On Tue, Jun 11, 2019 at 2:17 PM omar ahmed  wrote:
>>>>
>>>>> yes James you are right i need to upload images using the Django
>>>>> admin, ... how can i use Dropbox for this issue ?
>>>>> i need a good tutorial
>>>>>
>>>>> On Tuesday, June 11, 2019 at 6:14:10 PM UTC+2, James Farris wrote:
>>>>>>
>>>>>> He is saying these aren’t static files. It sounds like he uploads
>>>>>> them using the Django admin, which of course is like an end user on a
>>>>>> client uploading files to the media directory.
>>>>>>
>>>>>> Since that is the case it sounds like the Dropbox option is the best.
>>>>>> Documentation was provided earlier. So being that it seems like he read
>>>>>> through the documentation, my question is where is he stuck in the 
>>>>>> Dropbox
>>>>>> implementation?
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to a topic in the
>>>>> Google Groups "Django users" group.
>>>>> To unsubscribe from this topic, visit
>>>>> https://groups.google.com/d/topic/django-users/8O8BS7DhF30/unsubscribe
>>>>> .
>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>> django...@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/3d50f417-cceb-4141-9b6d-9d2f5d0feee4%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/django-users

Re: my file uploads missing/deleted

2019-06-12 Thread James Farris
You would add this code to the views.py file, which is where the business
logic goes.

https://docs.djangoproject.com/en/2.2/topics/http/views/

Likely would add a class with properties and methods or a definition (a
function) like below:

For example in your apps views.py file:

def connect_to_dropbox():
dbx = dropbox.Dropbox(‘your access token)
dbx.users_get_current_account()

# this stuff likely would go in a separate function
for entry in dbx.files_list_folder(‘’).entries:
print(entry.name)


At some point in your code you would call the function:
connect_to_dropbox()

On Wed, Jun 12, 2019 at 3:10 PM omar ahmed  wrote:

> i opened the documentation for django-storages ... and i installed Dropbox
> in my environment and i created my app folder  but i didn't complete docs .
> somethings not clear ... like :
> Link an account
>
> dbx = dropbox.Dropbox('YOUR_ACCESS_TOKEN')
>
> dbx.users_get_current_account()
> Try some API requests
>
> for entry in dbx.files_list_folder('').entries:
> print(entry.name)
>
> where should i write these commands ?
> thanks
>
> On Wednesday, June 12, 2019 at 1:13:11 AM UTC+2, James Farris wrote:
>>
>> You might try the docs from Dropbox
>> https://www.dropbox.com/developers/documentation/python#overview
>>
>> You can checkout this project for ideas
>> https://github.com/singingwolfboy/django-with-dropbox
>>
>> and here is documentation for django-storages
>> https://django-storages.readthedocs.io/en/latest/backends/dropbox.html
>>
>>
>>
>> On Tue, Jun 11, 2019 at 2:17 PM omar ahmed  wrote:
>>
>>> yes James you are right i need to upload images using the Django
>>> admin, ... how can i use Dropbox for this issue ?
>>> i need a good tutorial
>>>
>>> On Tuesday, June 11, 2019 at 6:14:10 PM UTC+2, James Farris wrote:
>>>>
>>>> He is saying these aren’t static files. It sounds like he uploads them
>>>> using the Django admin, which of course is like an end user on a client
>>>> uploading files to the media directory.
>>>>
>>>> Since that is the case it sounds like the Dropbox option is the best.
>>>> Documentation was provided earlier. So being that it seems like he read
>>>> through the documentation, my question is where is he stuck in the Dropbox
>>>> implementation?
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Django users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/django-users/8O8BS7DhF30/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> django...@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/3d50f417-cceb-4141-9b6d-9d2f5d0feee4%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/3d50f417-cceb-4141-9b6d-9d2f5d0feee4%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/8O8BS7DhF30/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e8763fdb-d559-4d5b-9274-a59c7c0e9198%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e8763fdb-d559-4d5b-9274-a59c7c0e9198%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 
*James Farris*
Web Application Developer | Web and Digital Solutions
External Relations & Advancement Marketing Communications
University Development and Alumni Relations | UC Berkeley
510-664-4512 | jfar...@berkeley.edu

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


Re: my file uploads missing/deleted

2019-06-11 Thread James Farris
You might try the docs from Dropbox
https://www.dropbox.com/developers/documentation/python#overview

You can checkout this project for ideas
https://github.com/singingwolfboy/django-with-dropbox

and here is documentation for django-storages
https://django-storages.readthedocs.io/en/latest/backends/dropbox.html



On Tue, Jun 11, 2019 at 2:17 PM omar ahmed  wrote:

> yes James you are right i need to upload images using the Django
> admin, ... how can i use Dropbox for this issue ?
> i need a good tutorial
>
> On Tuesday, June 11, 2019 at 6:14:10 PM UTC+2, James Farris wrote:
>>
>> He is saying these aren’t static files. It sounds like he uploads them
>> using the Django admin, which of course is like an end user on a client
>> uploading files to the media directory.
>>
>> Since that is the case it sounds like the Dropbox option is the best.
>> Documentation was provided earlier. So being that it seems like he read
>> through the documentation, my question is where is he stuck in the Dropbox
>> implementation?
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/8O8BS7DhF30/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3d50f417-cceb-4141-9b6d-9d2f5d0feee4%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/3d50f417-cceb-4141-9b6d-9d2f5d0feee4%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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/CAMdMWAWR1zurFJbU-yPnojEJ_iLLLgXbE1VvthRQNHxzgS21Ow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Unknown column 'boericke_joints.id' in 'field list

2019-06-11 Thread James Farris
If the database was originally created by Django, it would have been built with 
an ID field. Django is confused because it can’t find that field in the 
database. If you added ID to the model, did you run python manage.py 
makemigrations and then python manage.py migrate

-- 
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/cf82c1b4-3b7a-4d7c-87a3-9b182c92b59a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: my file uploads missing/deleted

2019-06-11 Thread James Farris
He is saying these aren’t static files. It sounds like he uploads them using 
the Django admin, which of course is like an end user on a client uploading 
files to the media directory. 

Since that is the case it sounds like the Dropbox option is the best. 
Documentation was provided earlier. So being that it seems like he read through 
the documentation, my question is where is he stuck in the Dropbox 
implementation?

-- 
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/c19daa24-8b3c-43de-816f-b1c37f85450e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Module lock error when starting development server

2019-06-11 Thread James Farris
Do you have a venv running in another venv? 

You could try installing and running gdb 
https://wiki.python.org/moin/DebuggingWithGdb

It may give you more insight. But Deadlocking is essentially one python process 
clobbering another causing the app to lock up. 

-- 
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/dfd8b345-c713-4944-8ca9-721479f4a814%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: mysqlclient installation error

2019-06-11 Thread James Farris
I have Django 2.2.x running with mysqlclient successfully

mysql-connector-python==8.0.15
mysqlclient==1.3.13

-- 
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/7acd7a9f-a524-442e-892a-c72184cb96bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: This site can’t be reached 127.0.0.1 refused to connect.

2018-06-05 Thread James Farris
What’s the actual error?

Did you mean ALLOWED_HOSTS? If so you can just add:
ALLOWED_HOSTS=[‘*’]

On Tue, Jun 5, 2018 at 12:55 PM Jamie Roberts 
wrote:

> Hi,
>
> This is from memory and may not be your problem but ... I had to add
> 127.0.0.1 to ALLOWED_USERS in settings.py
>
> Sent from my iPhone
>
> On 5 Jun 2018, at 16:38, Avitab Ayan Sarmah  wrote:
>
> While going through the turolal 7 of the django project, couldn't connect
> to the url.Please comment why my local host refused to connect
>
> --
> 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/e948142e-163f-4a82-bc91-46c16c292c5d%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/93BADF4F-E86D-47B7-9034-1D61408850D6%40gmail.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/CAE-E-_0fGD-7a%3DY4w-%2BjvR%3DZ3Zj6QdyRmZgc9PDWjXuaW_gX2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: calculate the followers difference/grow by day

2018-06-05 Thread James Farris
I think you can do something like this

stats = Statistics.objects.all().order_by('-last_update')
latest_stat = 0
for stat in stats:
print(abs(latest_stat - stat.followers))
latest_stat = stat.followers

On Mon, Jun 4, 2018 at 11:24 AM, Daniel Germano Travieso <
danielgtravi...@gmail.com> wrote:

> Hello!
> I don't quite understand what you mean by the followers difference by day,
> but as that difference by day is not a property of each model tuple, but a
> property of a specific day, you can write a view to handle that processing.
> Custom model Managers are used to either add manager methods or to
> customize and change the QuerySet your model returns. If you wish to use
> the model manager for this, it could be used to add a field to your model
> that makes a query to the last followers on that day and calculates the
> difference (?). You could also use a @property on your Model class for that
> too.
>
> Hope it helps!
>
> *[]'s*
> *Daniel Germano Travieso*
> *Engenharia da Computação Turma: 013*
> *Unicamp*
>
> On Thu, May 31, 2018 at 11:14 AM, João Paulo 
> wrote:
>
>>
>> Hey guys,
>>
>> I´m using SQLite and trying to calculate the followers difference by day
>>
>> This is my model:
>>
>> class Statistics(models.Model):
>> followers = models.IntegerField()
>> last_update = models.DateTimeField(auto_now_add=True)
>>
>> This are my database rows:
>>
>> "6" "50" "*2018-05-29* 00:25:48.276102"
>> "1" "100" "*2018-05-29* 00:26:48.276102"
>> "3" "200" "*2018-05-30* 00:27:04.178444"
>> "5" "250" "*2018-05-30* 00:30:04.178444"
>> "4" "300" "*2018-05-31* 00:27:04.178444"
>>
>> And the result I´m tryting to achieve is:
>>
>> followers | last_update
>> 150
>> *2018-05-30*50
>>
>> *2018-05-31*
>> *# I´m new to Django and thinking about use a Manager, but don't know
>> if´s doable using a Manager# Does anyone has a suggestion ?*
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/3196a628-a53f-41ac-bcbf-6cc8b8a66016%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/CABF8kZNYHY8zWYNw3WKTxLMcnsxxD
> U9hPAep4wpzk9i4c-veRg%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/CAE-E-_0j3r6g-DHrhif9P_HhpKHCPDohuS6jn86_XPzcg4zFJA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: error: can not import the name 'path'

2018-06-05 Thread James Farris
As the previous reply suggests, what Django version are you using?
Using django.conf.urls is a Django 1.11 and below utility function,

Django 2.x uses this
from django.urls import path

*If you are using Django 1.x* this is what your urls.py should look like:

from django.conf.urls import urlfrom django.contrib import admin
from . import views
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^index/', views.index, name="index"),]

*If you're using Django 2.x* this is what your urls.py should look like

from django.urls import pathfrom django.contrib import admin
from . import views
urlpatterns = [
path('admin/', admin.site.urls),
path('index/', views.index, name="index"),]









On Mon, Jun 4, 2018 at 3:12 PM, Aphiso Media  wrote:

> Whats version are you using? Im on mobile so i cant open urls.py.
>
> If you're using a version earlier than 2.0 you need to use url instead of
> path.
>
> Do you have from django.urls import path?
>
> On Mon, Jun 4, 2018, 4:29 PM anguboy  wrote:
>
>> i am new in django, so in my first app ,am stack at mapping the URL and I
>> get an error that can not import name 'path' ,,which is in the tmn(my_app)
>> folder , please help
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/88ca007c-c716-4050-a7ce-7bb1b7214fe0%
>> 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/CAJiup7FSUuROtUXyArQqVgFTfOSnf9oBn-zY6TFWyttib%2B5g-Q%
> 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/CAE-E-_33zTiPH4sDNc1mY1X0N_RD6nmGzTGfWODKDfzeULrytw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Starting a poll

2018-05-24 Thread James Farris
If you open the app once the server is started by going to 127.0.0.1:8000
is it loading the website or are you getting a 404 error in the browser?

I see the favicon 404 error all the time, but it doesn’t halt my site.
It’s just django looking for a favicon. That shouldn’t break anything.

Another 404 you might see is django looking for a robots.txt file. This is
normal until you have these setup.

On Thu, May 24, 2018 at 2:15 PM Jorge Gimeno  wrote:

>
>
> On Thu, May 24, 2018, 10:06 AM Caleb Bryson  wrote:
>
>> So I am follow the instructions on the django site to make a poll. I am
>> at the current step where you run the server and everything went fine when
>> i typed in the command. But now it is just there at saying "GET
>> /favicon.ico HTTP/1.1" 404 1977 on the last command line. I was wondering
>> should i wait, or close the cmd prompt and open a new one to continue the
>> steps, or quit the server with CTRL-BREAK(not sure which button represents
>> break on the key board)?
>>
>> --
>> 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/e500ed8f-e5b4-4d3b-aced-29f33dfeb7ec%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout
>
>
>
> Caleb,
>
> If I recall correctly, Ctrl-C stops the server.  Django dpes know when
> some changes are made, but unless I know for sure I always stop and restart
> the server.
>
> --
> 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/CANfN%3DK80LL-H3hETKcKMv8yLajgONuz4zKTFeJujS9VH0wZQJg%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/CAE-E-_2xmTM3o4z8f5i26o7hLH8T_cRYKb1GMSsNvHFkK7_Kdg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re:

2018-05-23 Thread James Farris
I assume you mean TemplateDoesNotExist and I also assume you have created a
templates folder in your project and have details.html in it.

If that’s the case did you check your settings.py for your template
settings?

It should look something like this.

TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates'), ], 'APP_DIRS': True,
...More code here...

On Wed, May 23, 2018 at 3:16 AM Umar Kambala  wrote:

> Yes its spelled correctly on the command window its telling me
> TemplateDoesNotExit: polls/detail.html
> On May 23, 2018 9:58 AM, "tango ward"  wrote:
>
> Check if your template name is correct in your views.py
>
> On Wed, May 23, 2018 at 5:56 PM, Umar Kambala 
> wrote:
>
>> Plz need help
>> I found this problem TemplateDoesNotExit at /polls/1/ where might have I
>> gone wrong?
>>
>> --
>> 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/CAPkbFbZwVPyBpVsA65UTjeJNgKHnQqpsTVmOmeO5GFeusnVfww%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/CAA6wQLLkxWQd3wDOMPNDEAPPNeTfVJhU7L1GP4au75yrU6Bcuw%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/CAPkbFbZmHibrrij317hQeczBiWqFB_QexEZFxKcko2qpsbzEww%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/CAE-E-_3n7kHV2N9tYLbC1XeANQXXN4eyM-Y3-jZetfZSxnmxbw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django

2018-05-21 Thread James Farris
Start with the Django docs tutorials
https://docs.djangoproject.com/en/2.0/intro/tutorial01/


On Mon, May 21, 2018 at 12:20 PM chaitanya goud 
wrote:

> Google "full stack python "
>
> On 22-May-2018 12:49 am, "Shivprasad Khandapure" <
> shivkhandapure...@gmail.com> wrote:
>
> Hii everyone
> I'm interested to learn django framework. I'm new in python and
> django so give some important important ideas, details about django and its
> basics. How can i work with django and its python libraries and its
> templates.
>  Thank you..!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFR1ACRU_YGo-otVE-hD9nBTNCcznuXMhy8m00%3DoaPz%2B9%2BmsBw%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/CA%2BkSnu6kWcePXQtFWot2ZMrbMd%2BTLBjSFmFaX2fY2zdV3J8oow%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/CAE-E-_3%3D3R%3D25QYifm8NneDFE6j6Cqw18jRNzGTTFtAm0%3DjvLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: need help

2018-05-19 Thread James Farris
What does your settings.py look for k like? Can you copy/paste it here?

On Sat, May 19, 2018 at 9:00 AM Umar Kambala <umarkamb...@gmail.com> wrote:

> DEBUG is on but when I runserver the content on my header.html is not
> displaying on de browser. It gives me not found on de cmd window n 404
> error on de webpage.
> On May 19, 2018 3:37 PM, "James Farris" <jamesafar...@gmail.com> wrote:
>
> If you set DEBUG = True
> Then restart your python server then reload the page, what is the output?
>
> It’s best to leave debug on until you have all the bugs worked out since
> it provides a lot of information that will tell you what’s happening
>
>
> Sent from my mobile device
>
> On May 19, 2018, at 8:32 AM, Umar Kambala <umarkamb...@gmail.com> wrote:
>
> I have been following de tutorials on web development but got lost on de
> peronal. Wen I run my server its gud to go but it won't display de content
> on de web browser. It always give me 404 error
> On May 19, 2018 3:28 PM, "James Farris" <jamesafar...@gmail.com> wrote:
>
>> Are you asking where DEBUG = False is?
>> If so, it would be in your project folder/project name/settings.py
>>
>>
>> Sent from my mobile device
>>
>> On May 19, 2018, at 4:36 AM, Umar Kambala <umarkamb...@gmail.com> wrote:
>>
>> How to I set my debug = false? On my django settings.. I don't know where
>> to get de settings
>> On May 3, 2018 12:52 AM, "Gerald Brown" <gsbrow...@gmail.com> wrote:
>>
>> Have you tried "pip install django" without the "== 2.0.5". I think that
>> if you do not specify a version pip will install the latest version.
>>
>> On Thursday, 03 May, 2018 12:46 AM, umarkamb...@gmail.com wrote:
>>
>> please  this is the massage i keep on getting when trying to install
>> django.. what do i do?
>>
>>
>> C:\Users\Admin>pip install Django==2.0.5
>> Collecting Django==2.0.5
>>   Retrying (Retry(total=4, connect=None, read=None, redirect=None,
>> status=None)) after connection broken by
>> 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read
>> timed out. (read timeout=15)",)': /simple/django/
>>   Downloading
>> https://files.pythonhosted.org/packages/23/91/2245462e57798e9251de87c88b2b8f996d10ddcb68206a8a020561ef7bd3/Django-2.0.5-py3-none-any.whl
>> (7.1MB)
>> 0% || 10kB 1.2kB/s eta
>> 1:36:24Exception:
>> Traceback (most recent call last):
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\_vendor\urllib3\response.py",
>> line 302, in _error_catcher
>> yield
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\_vendor\urllib3\response.py",
>> line 384, in read
>> data = self._fp.read(amt)
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py",
>> line 60, in read
>> data = self.__fp.read(amt)
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\http\client.py",
>> line 449, in read
>> n = self.readinto(b)
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\http\client.py",
>> line 493, in readinto
>> n = self.fp.readinto(b)
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\socket.py",
>> line 586, in readinto
>> return self._sock.recv_into(b)
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\ssl.py", line
>> 1009, in recv_into
>> return self.read(nbytes, buffer)
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\ssl.py", line
>> 871, in read
>> return self._sslobj.read(len, buffer)
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\ssl.py", line
>> 631, in read
>> v = self._sslobj.read(len, buffer)
>> socket.timeout: The read operation timed out
>>
>> During handling of the above exception, another exception occurred:
>>
>> Traceback (most recent call last):
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\basecommand.py",
>> line 215, in main
>> status = self.run(options, args)
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\commands\install.py",
>> line 3

Re: need help

2018-05-19 Thread James Farris
If you set DEBUG = True 
Then restart your python server then reload the page, what is the output?

It’s best to leave debug on until you have all the bugs worked out since it 
provides a lot of information that will tell you what’s happening 

Sent from my mobile device

> On May 19, 2018, at 8:32 AM, Umar Kambala <umarkamb...@gmail.com> wrote:
> 
> I have been following de tutorials on web development but got lost on de 
> peronal. Wen I run my server its gud to go but it won't display de content on 
> de web browser. It always give me 404 error
> 
>> On May 19, 2018 3:28 PM, "James Farris" <jamesafar...@gmail.com> wrote:
>> Are you asking where DEBUG = False is?
>> If so, it would be in your project folder/project name/settings.py
>> 
>> 
>> Sent from my mobile device
>> 
>>> On May 19, 2018, at 4:36 AM, Umar Kambala <umarkamb...@gmail.com> wrote:
>>> 
>>> How to I set my debug = false? On my django settings.. I don't know where 
>>> to get de settings
>>> 
>>> On May 3, 2018 12:52 AM, "Gerald Brown" <gsbrow...@gmail.com> wrote:
>>> Have you tried "pip install django" without the "== 2.0.5". I think that if 
>>> you do not specify a version pip will install the latest version.
>>> 
>>>> On Thursday, 03 May, 2018 12:46 AM, umarkamb...@gmail.com wrote:
>>>> please  this is the massage i keep on getting when trying to install 
>>>> django.. what do i do?
>>>> 
>>>> 
>>>> C:\Users\Admin>pip install Django==2.0.5
>>>> Collecting Django==2.0.5
>>>>   Retrying (Retry(total=4, connect=None, read=None, redirect=None, 
>>>> status=None)) after connection broken by 
>>>> 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read 
>>>> timed out. (read timeout=15)",)': /simple/django/
>>>>   Downloading 
>>>> https://files.pythonhosted.org/packages/23/91/2245462e57798e9251de87c88b2b8f996d10ddcb68206a8a020561ef7bd3/Django-2.0.5-py3-none-any.whl
>>>>  (7.1MB)
>>>> 0% || 10kB 1.2kB/s eta 
>>>> 1:36:24Exception:
>>>> Traceback (most recent call last):
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\_vendor\urllib3\response.py",
>>>>  line 302, in _error_catcher
>>>> yield
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\_vendor\urllib3\response.py",
>>>>  line 384, in read
>>>> data = self._fp.read(amt)
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py",
>>>>  line 60, in read
>>>> data = self.__fp.read(amt)
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\http\client.py",
>>>>  line 449, in read
>>>> n = self.readinto(b)
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\http\client.py",
>>>>  line 493, in readinto
>>>> n = self.fp.readinto(b)
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\socket.py", 
>>>> line 586, in readinto
>>>> return self._sock.recv_into(b)
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\ssl.py", 
>>>> line 1009, in recv_into
>>>> return self.read(nbytes, buffer)
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\ssl.py", 
>>>> line 871, in read
>>>> return self._sslobj.read(len, buffer)
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\ssl.py", 
>>>> line 631, in read
>>>> v = self._sslobj.read(len, buffer)
>>>> socket.timeout: The read operation timed out
>>>> 
>>>> During handling of the above exception, another exception occurred:
>>>> 
>>>> Traceback (most recent call last):
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\basecommand.py",
>>>>  line 215, in main
>>>> status = self.run(options, args)
>>>>   File 
>>>> "c:\u

Re: need help

2018-05-19 Thread James Farris
Are you asking where DEBUG = False is?
If so, it would be in your project folder/project name/settings.py


Sent from my mobile device

> On May 19, 2018, at 4:36 AM, Umar Kambala  wrote:
> 
> How to I set my debug = false? On my django settings.. I don't know where to 
> get de settings
> 
> On May 3, 2018 12:52 AM, "Gerald Brown"  wrote:
> Have you tried "pip install django" without the "== 2.0.5". I think that if 
> you do not specify a version pip will install the latest version.
> 
>> On Thursday, 03 May, 2018 12:46 AM, umarkamb...@gmail.com wrote:
>> please  this is the massage i keep on getting when trying to install 
>> django.. what do i do?
>> 
>> 
>> C:\Users\Admin>pip install Django==2.0.5
>> Collecting Django==2.0.5
>>   Retrying (Retry(total=4, connect=None, read=None, redirect=None, 
>> status=None)) after connection broken by 
>> 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read 
>> timed out. (read timeout=15)",)': /simple/django/
>>   Downloading 
>> https://files.pythonhosted.org/packages/23/91/2245462e57798e9251de87c88b2b8f996d10ddcb68206a8a020561ef7bd3/Django-2.0.5-py3-none-any.whl
>>  (7.1MB)
>> 0% || 10kB 1.2kB/s eta 1:36:24Exception:
>> Traceback (most recent call last):
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\_vendor\urllib3\response.py",
>>  line 302, in _error_catcher
>> yield
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\_vendor\urllib3\response.py",
>>  line 384, in read
>> data = self._fp.read(amt)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py",
>>  line 60, in read
>> data = self.__fp.read(amt)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\http\client.py",
>>  line 449, in read
>> n = self.readinto(b)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\http\client.py",
>>  line 493, in readinto
>> n = self.fp.readinto(b)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\socket.py", 
>> line 586, in readinto
>> return self._sock.recv_into(b)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\ssl.py", line 
>> 1009, in recv_into
>> return self.read(nbytes, buffer)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\ssl.py", line 
>> 871, in read
>> return self._sslobj.read(len, buffer)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\ssl.py", line 
>> 631, in read
>> v = self._sslobj.read(len, buffer)
>> socket.timeout: The read operation timed out
>> 
>> During handling of the above exception, another exception occurred:
>> 
>> Traceback (most recent call last):
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\basecommand.py",
>>  line 215, in main
>> status = self.run(options, args)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\commands\install.py",
>>  line 324, in run
>> requirement_set.prepare_files(finder)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_set.py",
>>  line 380, in prepare_files
>> ignore_dependencies=self.ignore_dependencies))
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_set.py",
>>  line 620, in _prepare_file
>> session=self.session, hashes=hashes)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\download.py",
>>  line 821, in unpack_url
>> hashes=hashes
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\download.py",
>>  line 659, in unpack_http_url
>> hashes)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\download.py",
>>  line 882, in _download_http_url
>> _download_url(resp, link, content_file, hashes)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\download.py",
>>  line 603, in _download_url
>> hashes.check_against_chunks(downloaded_chunks)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\utils\hashes.py",
>>  line 46, in check_against_chunks
>> for chunk in chunks:
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\download.py",
>>  line 571, in written_chunks
>> for chunk in chunks:
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\utils\ui.py",
>>  line 139, in iter
>> for x in it:
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\download.py",
>>  line 560, in resp_read
>> 

Re: getting error while reloading the url"http://localhost:8000/polls/".The error is given below.Please tell my why i am seeing this error?

2018-05-18 Thread James Farris
What does your urls.py look like?

According to the error it doesn’t appear that polls/ is defined in your
urls.py file

On Fri, May 18, 2018 at 10:05 AM Avitab Ayan Sarmah 
wrote:

> Page not found (404)
> Request Method: GET
> Request URL: http://localhost:8000/polls/
>
> Using the URLconf defined in mysite.urls, Django tried these URL
> patterns, in this order:
>
>1. [name='index']
>2. / [name='detail']
>3. /results/ [name='results']
>4. /vote/ [name='vote']
>5. admin/
>
> The current path, polls/, didn't match any of these.
>
> You're seeing this error because you have DEBUG = True in your Django
> settings file. Change that to False, and Django will display a standard
> 404 page.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/54b07f4e-663c-4ed0-a419-541d735148a1%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/CAE-E-_2Gms%3DtqeXpJ_FFJ1p6_i1ECAf15yGmw1PCJz%3DN4yZQYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ImportError : cannot import name include

2018-05-18 Thread James Farris
If you are not using a virtual env, did you install pip3? If so, since you
are using puthon3 -V to get that python version, try running
$ pip3 install django
And see if you get a different result

I think what is happening is when you run pip install it’s referencing
another python version, not python 3.

At least that is what I experienced back before I used virtual envs

On Fri, May 18, 2018 at 9:01 AM Journal-Immo 
wrote:

> Thank you for all your answers
>
> I know my problem with version
>
> So for me it's very strange...
>
> python3 -V
>
> Python 3.5.3
>
> pip install Django==2.0.5
>
> Collecting Django==2.0.5...
>
> Could nt find a version... 1.2.1, 1.2.2 etc and the last one 1.11.13
>
> No matching distribution found fot Django==2.0.5
>
> Do you think Virtual Envirenment will solve my problem ?
>
> Many thank again
>
> Le 18/05/2018 à 16:38, Daniel Hepper a écrit :
>
> Your problem is right here:
>
> > django-admin --version 1.11.13
> You are using Django 1.11. The documentation you are using refers to a
> newer version of Django, version 2.0.
>
> Use the right documentation for your version of Django:
>
> https://docs.djangoproject.com/en/1.11/
>
> You are seeing this specific error because in Django 2.0, you can write
> "from django.urls import include", while in Django 1.11, you have to write
> "from django.conf.urls import include".
>
> Note that using Debian packages, you won't get the latest version of
> Django (or any other Python packages). You might want to consider
> installing the latest version with pip.
>
>
> https://docs.djangoproject.com/en/2.0/topics/install/#installing-official-release
>
> Hope that helps,
> Daniel
>
> On Fri, May 18, 2018 at 4:20 PM, Journal-Immo 
> wrote:
>
>> Thank
>>
>> But (I use debian 9)
>>
>> Apt-get update
>>
>> Apt-get install python python3 python-django
>>
>> django-admin --version 1.11.13
>>
>> Where is the problem ?
>>
>> Le 17/05/2018 à 21:01, Fidel Leon a écrit :
>>
>> You are using the wrong combination of Django and tutorial: “include” is
>> available in Django 2 and up, but you’re using Django 1.11.
>>
>> Fidel Leon
>> fi...@flm.cat
>> Phone: +34 622 26 44 92 
>> GPG: 2585 30C2 E3C7 7151 0864  946B 7423 F94B 5753 5FC7
>>
>> El 17 de mayo de 2018 a las 20:56:56, Tristan Demot (
>> cont...@journal-immo.com) escribió:
>>
>> Hello,
>>
>>  I use docs.djangoproject.co/en/2.0
>>  Python 2 7 13
>> Gjango 1.11.13
>>
>> Creating the Polls app OK
>> Write your first view OK
>> But python manage runserver don't work
>> With : python -Wall manage.py test
>> ImportError : cannot import name include
>> If you want to see something, ask me
>> Many 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/1fe7df04-dc85-4a3d-940e-4dde7de31477%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/CAHXg%3DN090U8JCFfdvZJWH1qSoWQgp2mQH6z2RfCzj3384epQKQ%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/7e9e643b-6e7e-681c-eed2-dc9ab9be94e6%40journal-immo.com
>> .
>>
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message 

Re: New project in virtual env referencing another project's default/redirected path

2018-05-18 Thread James Farris
This is where an IDE like PyCharm comes in handy. It will tell you right
away that it doesn’t recognize something and will suggest importing that
package. It does a pretty good job with its suggestions.

On Fri, May 18, 2018 at 9:35 AM Nitin Kumar  wrote:

> you have to import include.
>
> from django.urls import path, include
>
> On Fri, May 18, 2018 at 9:45 PM,  wrote:
>
>> Hi Nitin,
>>
>> Thanks for quick response.
>>
>> Please find the below code from locallibrary/urls.py
>>
>> Could you please let me know, where shall i add the url.
>>
>>
>>
>> 
>> from django.contrib import admin
>> from django.urls import path
>>
>> urlpatterns = [
>> path('admin/', admin.site.urls),
>> ]
>>
>>
>> from django.urls import path
>> from django.contrib import admin
>>
>> # Use include() to add URLS from the catalog application and
>> authentication system
>> from django.urls import include
>>
>>
>> urlpatterns = [
>> path('admin/', admin.site.urls),
>> ]
>>
>>
>> urlpatterns += [
>> path('catalog/', include('catalog.urls')),
>> ]
>>
>>
>> # Use static() to add url mapping to serve static files during
>> development (only)
>> from django.conf import settings
>> from django.conf.urls.static import static
>>
>>
>> urlpatterns+= static(settings.STATIC_URL,
>> document_root=settings.STATIC_ROOT)
>>
>>
>> #Add URL maps to redirect the base URL to our application
>> from django.views.generic import RedirectView
>> urlpatterns += [
>> path('', RedirectView.as_view(url='/catalog/', permanent=True)),
>> ]
>>
>>
>> --
>>
>> On Friday, May 18, 2018 at 6:09:33 PM UTC+2, Nitin Kumar wrote:
>>>
>>> Hi Ankit,
>>>
>>> You must add the urls of catalog to the project urls, locallibrary.urls.
>>>
>>> On Fri, May 18, 2018 at 8:32 PM,  wrote:
>>>
 Hi Doug,

 I am new to Django and i also started with MDN Locallibrary project.
 Everything went fine until Django admin site but I stuck at "Creating
 our home page
 "
 I have written the code in the suggested way only but get below error when
 try to run the project. I tried taking the urls.py code from github also
 but it gives same issue.

 Could you please help me here.

 Regards,
 Ankit


 Page not found (404)
 Request Method: GET
 Request URL: http://127.0.0.1:8000/catalog/

 Using the URLconf defined in locallibrary.urls, Django tried these URL
 patterns, in this order:

1. admin/
2. ^static\/(?P.*)$
3.

 The current path, catalog/, didn't match any of these.

 You're seeing this error because you have DEBUG = True in your Django
 settings file. Change that to False, and Django will display a
 standard 404 page.



 On Monday, January 22, 2018 at 5:46:31 AM UTC+2, Doug Nintzel wrote:
>
> Ok, makes sense. Thank you very much for the details Daniel.
> Doug
>
> On Sunday, January 21, 2018 at 1:02:33 PM UTC-7, Daniel Hepper wrote:
>>
>> Yes, kind of. There are two kinds of redirects, temporary and
>> permanent redirects. By default Django's redirect() method returns a
>> temporary redirect. If you pass permanent=True, it returns a permanent
>> redirect.
>>
>> So here is what happened in your case:
>>
>> 1. You run the MDN tutorial project and point your browser to
>> http://127.0.0.1:8000/
>> 2. The browser requests the path / from the server 127.0.0.1:8000
>> (the runserver running the MDN tutorial project) and receives a permanent
>> redirect to /catalog/
>> 3. Then you stop the MDN project and run your own project.
>> 4. You then point your browser to http://127.0.0.1:8000
>> 5. Your browser thinks "wait a minute, last time I accessed the path
>> / on the server 127.0.0.1:8000, it returned a permanent redirect to
>> /catalog/. I'll save my user some time and just go directly to 
>> /catalog/".
>>
>> Now, if a URL returns a temporary redirect, the browser knows that
>> this redirect is, well, temporary, so it might point to a different
>> location the next time or there might be no redirect at all. Therefore, 
>> it
>> must load the original URL.
>>
>> In the example of the tutorial, a permanent redirect should not be
>> used, not only because it can lead to the problem you encountered.

Re: def get_queryset(self): ^ IndentationError: unindent does not match any outer indentation level

2018-05-18 Thread James Farris
The Indentation error is related to the spaces you have when you write your
code.

Based on looking at what you copy/pasted
The indentation of your def get_queryset is different from your other
def’s.

Python is very picky of how much or how little you indent your code for
good reason.

Everything that is nested inside something else should be 4 spaces or a tab
in. For example a def should be 4 spaces in from its class, a variable
should be 4 spaces in from its def.

IndentationError: unindent does not match any outer indentation level

On Fri, May 18, 2018 at 9:08 AM Avitab Ayan Sarmah 
wrote:

> While going through the django project i committed an error while
> executing "python manage.py runserver" inside my project directory.It is
> showing error is in line 24 of views.py.Please comment what exact the error
> is and how do i overcome this error.The exceptions and views.py is
> mentioned below:
>
> Exceptions:
>
> PS C:\Users\AVITABAYAN\mysite> python manage.py runserver
> Performing system checks...
>
> Unhandled exception in thread started by  check_errors..wrapper at 0x017BA5FB29D8>
> Traceback (most recent call last):
>   File "c:\python36\lib\site-packages\django\utils\autoreload.py", line
> 225, in wrapper
> fn(*args, **kwargs)
>   File
> "c:\python36\lib\site-packages\django\core\management\commands\runserver.py",
> line 121, in inner_run
> self.check(display_num_errors=True)
>   File "c:\python36\lib\site-packages\django\core\management\base.py",
> line 364, in check
> include_deployment_checks=include_deployment_checks,
>   File "c:\python36\lib\site-packages\django\core\management\base.py",
> line 351, in _run_checks
> return checks.run_checks(**kwargs)
>   File "c:\python36\lib\site-packages\django\core\checks\registry.py",
> line 73, in run_checks
> new_errors = check(app_configs=app_configs)
>   File "c:\python36\lib\site-packages\django\core\checks\urls.py", line
> 40, in check_url_namespaces_unique
> all_namespaces = _load_all_namespaces(resolver)
>   File "c:\python36\lib\site-packages\django\core\checks\urls.py", line
> 57, in _load_all_namespaces
> url_patterns = getattr(resolver, 'url_patterns', [])
>   File "c:\python36\lib\site-packages\django\utils\functional.py", line
> 36, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File "c:\python36\lib\site-packages\django\urls\resolvers.py", line 536,
> in url_patterns
> patterns = getattr(self.urlconf_module, "urlpatterns",
> self.urlconf_module)
>   File "c:\python36\lib\site-packages\django\utils\functional.py", line
> 36, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File "c:\python36\lib\site-packages\django\urls\resolvers.py", line 529,
> in urlconf_module
> return import_module(self.urlconf_name)
>   File "c:\python36\lib\importlib\__init__.py", line 126, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 978, in _gcd_import
>   File "", line 961, in _find_and_load
>   File "", line 950, in
> _find_and_load_unlocked
>   File "", line 655, in _load_unlocked
>   File "", line 678, in exec_module
>   File "", line 205, in
> _call_with_frames_removed
>   File "C:\Users\AVITABAYAN\mysite\mysite\urls.py", line 5, in 
> path('', include('polls.urls')),
>   File "c:\python36\lib\site-packages\django\urls\conf.py", line 34, in
> include
> urlconf_module = import_module(urlconf_module)
>   File "c:\python36\lib\importlib\__init__.py", line 126, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 978, in _gcd_import
>   File "", line 961, in _find_and_load
>   File "", line 950, in
> _find_and_load_unlocked
>   File "", line 655, in _load_unlocked
>   File "", line 678, in exec_module
>   File "", line 205, in
> _call_with_frames_removed
>   File "C:\Users\AVITABAYAN\mysite\polls\urls.py", line 3, in 
> from . import views
>   File "C:\Users\AVITABAYAN\mysite\polls\views.py", line 24
> def get_queryset(self):
>   ^
> IndentationError: unindent does not match any outer indentation level
>
>
> views.py:
>
> from django.shortcuts import get_object_or_404, render
> from django.http import HttpResponseRedirect
> from django.urls import reverse
> from django.views import generic
> from django.utils import timezone
>
> from . models import Choice, Question
>
>
> class IndexView(generic.ListView):
> template_name = 'polls/index.html'
> context_object_name = 'latest_question_list'
>
> def get_queryset(self):
> """Return the last five published questions(not including those settings
> to be
> published in the future)."""
> return
> Question.objects.filter(pub_date__lte=timezone.now()).order_by('-pub_date')[:5]
>
> class DetailView(generic.DetailView):
> model = Question
> template_name = 'polls/detail.html'
>
> def get_queryset(self):
> """Excludes any questions that aren't 

Re: Error at login page of Django Admin

2018-05-16 Thread James Farris
Did you run python manage.py migrate on your dev server? And create a super
user (python manage.py createsuperuser)

On Wed, May 16, 2018 at 8:06 AM Stephen Farry 
wrote:

> Hi All,
>
> I have a peculiar issue with the admin on Django. Using the Django
> development server, I can use the admin without any issues at all. However,
> when I deploy it on the server, I still get the admin page, but when I try
> to log in I get a 404 error. I reduced this back to the tutorial, but I
> still get this with any username/password (with DEBUG is True)
> Page not found (404)
> Request Method: POST
> Request URL:
> https://themovieroom.co.uk/mysite/admin/login/?next=/mysite/admin/
>
> Using the URLconf defined in mysite.urls, Django tried these URL
> patterns, in this order:
>
>1. ^admin/
>2. polls/
>
> The current path, login/, didn't match any of these.
>
> You're seeing this error because you have DEBUG = True in your Django
> settings file. Change that to False, and Django will display a standard
> 404 page.
>
>
> This seems to be the same whatever sql database I get, and I suspect is a
> server side problem, but I'm not sure where to look. Let me know any
> further information would help. Thanks for any help you can provide.
>
> Cheers,
> Stephen
>
> --
> 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/a5170810-329f-440b-bc30-64a89d15a8aa%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/CAE-E-_3NyLJ2zy1cFMR7rM3DRnjoZ%2BkAcyPC9PL33xToPjXE3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Message from a django beginner user

2018-05-15 Thread James Farris
In addition to the Django docs, I recommend https://djangobook.com/ although 
it’s written for Django 1.11, a lot of concepts still apply. 

Another good website is https://tutorial.djangogirls.org/en/

Sent from my mobile device

> On May 15, 2018, at 5:16 PM, Gerald Brown  wrote:
> 
> The best way to learn it is o jump in and start using it.  Django has a good 
> tutorial on-line @ https://docs.djangoproject.com/en/2.0/intro/tutorial01/.  
> When you have problems Google and this Group are your friends.
> 
> Goo luck.
> 
>> On 05/16/2018 01:39 AM, Francis F. Massaquoi, Jr. wrote:
>> Hi, I'm Francis F. Massaquoi, Jr. with great interest in learning django 
>> 2.0, which is the latest version, I have been searching on youtube for a 
>> channel that have the latest version tutorial, I have not really find one, 
>> can someone please help me with a pdf or website, where I can learn django 
>> to the best, I have been reading some pdf, I have the basic knowledge, but I 
>> need to advance my knowledge. Or if you can connect with me on skype, this 
>> is my skype username: francisfmassaquoijr, or if you have a skype group, you 
>> can please add me, or give me your skype username...
>> 
>> Your urgent response will highly be appreciated. 
>> 
>> Thanks to the admin for accepting me..
>> 
>> We do it the django way, because it's the best way to web app 
>> development.
>> -- 
>> 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/e22ff629-023d-41dc-bb08-7d0d0f87fd42%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/24c2685c-376f-d895-b51b-2447bbf77903%40gmail.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/39F98B08-C2C2-46AE-A8E3-8BF7A5674DCC%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django 2.0 tutorial :: exception:: application labels are not unique.

2018-05-15 Thread James Farris
Just to note: Django doesn’t change the settings.py file, it only
references it so it knows what configurations to load.

On Tue, May 15, 2018 at 7:27 AM Paolo Chilosi 
wrote:

> thanks for pointing out about the typo. However this was not the cause of
> the exception. Look to my previous answer.
>
>
> On Tuesday, May 15, 2018 at 9:44:57 AM UTC-4, Sidyvan Fernandes de Andrade
> wrote:
>
>> python manage.py makemigrations polls
>>
>> 2018-05-15 8:51 GMT-03:00 Paolo Chilosi :
>>
> As new to Django I am learning following the tutorial carefully. When I
>>> reached the point of making the migration for the polls app I executed
>>> (from the PyCharm terminal) the command:
>>>
>>> (venv) C:\Users\Paolo\PycharmProjects\mysite>python manage.py
>>> makemigration polls
>>>
>>> and then I obtained the following exception messages
>>>
>>> Traceback (most recent call last):
>>>   File "manage.py", line 15, in 
>>> execute_from_command_line(sys.argv)
>>>   File
>>> "C:\Users\Paolo\PycharmProjects\mysite\venv\lib\site-packages\django\core\management\__ini
>>> t__.py", line 371, in execute_from_command_line
>>> utility.execute()
>>>   File
>>> "C:\Users\Paolo\PycharmProjects\mysite\venv\lib\site-packages\django\core\management\__ini
>>> t__.py", line 347, in execute
>>> django.setup()
>>>   File
>>> "C:\Users\Paolo\PycharmProjects\mysite\venv\lib\site-packages\django\__init__.py",
>>> line 24
>>> , in setup
>>> apps.populate(settings.INSTALLED_APPS)
>>>   File
>>> "C:\Users\Paolo\PycharmProjects\mysite\venv\lib\site-packages\django\apps\registry.py",
>>> line 93, in populate
>>> "duplicates: %s" % app_config.label)
>>> django.core.exceptions.ImproperlyConfigured: Application labels aren't
>>> unique, duplicates: polls
>>> (venv) C:\Users\Paolo\PycharmProjects\mysite>
>>>
>>> I reviewed carefully the code and restarted the tutorial several times ,
>>> all the times having the same problem.
>>>
>>> ANY SUGGESTION?? thanks
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>>
>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>
>>
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/653a7dd7-b330-4062-86b2-3fa06598008a%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/fffe2c47-a057-4dbb-9f8c-718b3abb8939%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/CAE-E-_0H_HB1o-wb9TqssPQWJ%3Dk%3DhubEysUk9fVHf3fHqvcz%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: IOError when trying to send email in Django app

2018-05-11 Thread James Farris
You probably already have but check the docs
https://docs.djangoproject.com/en/2.0/topics/email/

And your postfix configurations (or whatever email send system you are
using)

On Fri, May 11, 2018 at 12:07 PM Tom Tanner 
wrote:

> I have a Django app running on a server with uWSGI and nginx.
>
> In my `local_settings.py` file I have this:
>
> ###
> # EMAIL SETUP #
> ###
> EMAIL_HOST = 'smtp.privateemail.com'
> EMAIL_HOST_USER = 'supp...@mydomain.com'
> EMAIL_HOST_PASSWORD = 'MY EMAIL PASSWORD'
> EMAIL_PORT = 587
> EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
> EMAIL_USE_TLS = True
>
>
> 
> # OTHER EMAIL SETTINGS #
> 
> ADMIN_EMAIL = "ad...@mydomain.com"
> SUPPORT_EMAIL = "supp...@mydomain.com"
>
>
> When I fill out the `/password_reset/` template with an email and submit
> the form, the email I enter gets no email.
>
> I see these lines in my `uwsgi.log` file after I submit the password reset
> form.
>
> Fri May 11 17:48:10 2018 - SIGPIPE: writing to a closed pipe/socket/fd
> (probably the client disconnected) on request /password_reset/ (ip
> 73.49.35.42) !!!
> Fri May 11 17:48:10 2018 - uwsgi_response_write_headers_do(): Broken
> pipe [core/writer.c line 248] during POST /password_reset/ (73.49.35.42)
> IOError: write error
>
> What error is this? Why won't the password reset email send?
>
> --
> 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/5a50ba30-9709-48a9-a937-bd9afb8bbf30%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/CAE-E-_14LM2A8%3DPwtoAAXOKh8morKnTnaAt2HH4Pq5RT4GUeZg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: python django group

2018-05-11 Thread James Farris
What errors ?

On Fri, May 11, 2018 at 4:41 PM Akinyiga Obadamilare <
akinyigaobad...@gmail.com> wrote:

> please, when I run my server in local host after creating my polls app in
> django but it did not show the presence of polls app in my local host
> instead of it to display the presence of admin and polls app, to run the
> python manage.py make migration polls was was giving me error
>
> --
> 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/9995e4a7-2288-4e95-8f65-6caf6b5df58c%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/CAE-E-_181du%2BrQ5T8iVRahc64nifnDCVUo5K7TaKu%2BLx9beYdg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Display Users Posts also whether it is logged in or logged out

2018-05-11 Thread James Farris
If you want to show posts, which I assume is blog posts or something (not seen 
in your code) 
You would add an additional queryset that is passed to your template

Something like 
Posts.objects.filter(user_id=pk)

Sent from my mobile device

> On May 10, 2018, at 6:45 PM, objectiveapps...@gmail.com wrote:
> 
> I want to Display Users Posts also whether it is logged in or logged out When 
> I click the everyone User It will show me users Profile Info but I want 
> everyone user's posts also How Can I Solve This
> 
> Here is my code
> https://dpaste.de/KBcF
> 
> 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/aa97858a-71a7-4c65-b5c0-b7afe0ac0364%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/7824C06B-2CFE-4382-809F-5AEF03407B58%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with debug = True/False

2018-05-11 Thread James Farris
I also recommend going through the deploy checklist. I ran into the same 
problem and then other problems after that because I didn’t follow this. 

https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/

Sent from my mobile device

> On May 10, 2018, at 10:53 PM, Andréas Kühne  
> wrote:
> 
> Hi,
> 
> That is the way it should be if you look in the documentation:
> https://docs.djangoproject.com/en/2.0/howto/static-files/
> 
> Serving the files
> 
> In addition to these configuration steps, you’ll also need to actually serve 
> the static files.
> 
> During development, if you use django.contrib.staticfiles, this will be done 
> automatically by runserver when DEBUG is set to True (see 
> django.contrib.staticfiles.views.serve()).
> 
> This method is grossly inefficient and probably insecure, so it is unsuitable 
> for production.
> 
> See Deploying static files for proper strategies to serve static files in 
> production environments.
> 
> So it is exactly like gunicorn - because you need to serve your static files 
> from a webbserver instead of from django itself.
> 
> That's why it is failing.
> 
> What you could do (although I don't recommend it) - it to manually add the 
> static files serving to your urls.py file. See:
> https://docs.djangoproject.com/en/2.0/howto/static-files/#serving-static-files-during-development
> 
> This should be fine for a developer environment - but nothing else.
> 
> Regards,
> 
> Andréas
> 
> 2018-05-11 3:09 GMT+02:00 Gerald Brown :
>> On my admin site if I have Debug set to true (I have read that for 
>> production this is a no-no) everything looks fine.  When I change it to 
>> FALSE all of the styling goes away as if it is being run using gunicorn.
>> 
>> Has anyone observed this?  If so have you found a correction?
>> 
>> 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/2fb3aff8-40ec-464e-81e1-766cf08db433%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/CAK4qSCckZWh8hYJ6HQX-RvOAssSDmP4WCSFbh%2BGcty38GHay%2BQ%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/5958579F-09A0-414D-8A21-E4690829545F%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: integrating themes in django

2018-05-10 Thread James Farris
This should give you an idea of what you have to do
Templates: https://tutorial.djangogirls.org/en/html/
Statics: https://tutorial.djangogirls.org/en/css/

On Thu, May 10, 2018 at 12:27 AM, Hitesh Goyal <hitesh1...@gmail.com> wrote:

> Ok . Could you please provide a sample source where it has been
> implemented .
>
> On Thursday, May 10, 2018 at 12:48:44 PM UTC+5:30, James Farris wrote:
>>
>> Unless someone knows of an easier way, you will have to do some work to
>> get html/css/js themes integrated as you will have to create templates for
>> html and a static directory for css and js.  Then hook the css and js into
>> the template files you create.  It's not like a Drupal or Wordpress site
>> where you download a theme and install it.  It will take some finessing for
>> a ready made website theme to be integrated into a Django project.
>>
>> It sounds complex, but it really isn't that hard.
>>
>> On Wed, May 9, 2018 at 9:10 PM, Hitesh Goyal <hites...@gmail.com> wrote:
>>
>>> Hi team, I am new to Django.
>>> How can i integrate ready-made website themes in a django project ?
>>>
>>> --
>>> 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/c54ea1fa-6cc2-413a-a841-9235a93469d4%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/c54ea1fa-6cc2-413a-a841-9235a93469d4%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> 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/344559c4-ecc3-4e21-8a2d-e842e078066e%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/344559c4-ecc3-4e21-8a2d-e842e078066e%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> 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/CAE-E-_1Rnvt0-SGTk_iPXoW66rSHXqgeqr3ZM-4qXFy-wzQ2oQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: integrating themes in django

2018-05-10 Thread James Farris
Unless someone knows of an easier way, you will have to do some work to get
html/css/js themes integrated as you will have to create templates for html
and a static directory for css and js.  Then hook the css and js into the
template files you create.  It's not like a Drupal or Wordpress site where
you download a theme and install it.  It will take some finessing for a
ready made website theme to be integrated into a Django project.

It sounds complex, but it really isn't that hard.

On Wed, May 9, 2018 at 9:10 PM, Hitesh Goyal  wrote:

> Hi team, I am new to Django.
> How can i integrate ready-made website themes in a django project ?
>
> --
> 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/c54ea1fa-6cc2-413a-a841-9235a93469d4%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/CAE-E-_2pjq65bYW0RuMHd7XrD3i94j9r_rWi0sCXY2hLFYXhNw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Getting error in migrate

2018-05-09 Thread James Farris
To be absolutely clear, you need to make sure if you made changes to models.py 
you need to run 
$ python manage.py makemigrations 
Then
$ python manage.py migrate

-James

Sent from my mobile device

> On May 9, 2018, at 11:26 AM, Pradeep Sharma  
> wrote:
> 
> Did u run the command of py manage.py makemigrations?
> 
> -- 
> 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/030d5c70-d65a-4707-ba4d-669b7317713c%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/A5C5B522-C495-4D7E-8D73-3419F86671A5%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: While going through the django tutorial i found error while scripting automated testing.The code and exeptions are mentioned below. Please find what is the error .

2018-05-09 Thread James Farris
Instead of giving the answer, I suggest looking at the Traceback section you 
posted below because the answer is there. Giving you the answer will not help 
your trouble shooting skills. 

Sent from my mobile device

> On May 9, 2018, at 8:03 AM, Avitab Ayan Sarmah  wrote:
> 
>  shell:
> 
> >>> import datetime
> >>> from django.utils import timezone
> >>> from polls.models import Question
> >>> # create a Question instance with pub_date 30 days in the future
> >>> future_question = Question(pub_date=timezone.now() + 
> >>> datetime.timedelta(days=30))
> >>> # was it published recently?
> >>> future_question.was_published_recently()
> True
> Exceptions:
> 
> PS C:\Users\AVITABAYAN\mysite> python
> Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:57:36) [MSC v.1900 64 bit 
> (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import datetime
> >>> from django.utils import timezone
> >>> from polls.models import Question
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "C:\Users\AVITABAYAN\mysite\polls\models.py", line 7, in 
> class Question(models.Model):
>   File "c:\python36\lib\site-packages\django\db\models\base.py", line 100, in 
> __new__
> app_config = apps.get_containing_app_config(module)
>   File "c:\python36\lib\site-packages\django\apps\registry.py", line 244, in 
> get_containing_app_config
> self.check_apps_ready()
>   File "c:\python36\lib\site-packages\django\apps\registry.py", line 127, in 
> check_apps_ready
> raise AppRegistryNotReady("Apps aren't loaded yet.")
> django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
> 
> models.py:
> 
> import datetime
> 
> from django.db import models
> from django.utils import timezone
> 
> 
> class Question(models.Model):
> #...
> def was_published_recently(self):
> return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
> def __str__(self):
> return self.question_text
> question_text = models.CharField(max_length=200)
> pub_date = models.DateTimeField('date published')
> 
> class Choice(models.Model):
> #...
> def __str__(self):
> return self.choice_text
> question = models.ForeignKey(Question, on_delete=models.CASCADE)
> choice_text = models.CharField(max_length=200)
> votes = models.IntegerField(default=0)
> 
> -- 
> 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/0801b9ea-0d71-4b96-9048-5f51e584a0ad%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/288685FE-5551-48B6-A70B-6A451D942B26%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Working through the Django tutorial and have run into a problem I cannot figure out. Help would be appreciated. What am I missing here? whenever is search the url "http://127.0.0.1:8000/polls/" th

2018-05-03 Thread James Farris
In looks like there is a syntax error also in your polls/urls.py
Your missing the opening <
This:
path(‘int:question_id>/vote/', views.vote, name='vote'),

Should be this:
path('/vote/', views.vote, name='vote'),

On Thu, May 3, 2018 at 10:12 AM Avitab Ayan Sarmah 
wrote:

> thank you Anthony, now i will try your code and i am sure it will run this
> time
>
> On Thu, May 3, 2018 at 10:37 PM, 'Anthony Flury' via Django users <
> django-users@googlegroups.com> wrote:
>
>> I think the root cause of the errors was due to an incorrect settings -
>> but Fidel is right that your views.py wasn't great either.
>>
>> On 03/05/18 17:36, Avitab Ayan Sarmah wrote:
>>
>>> thank you Fidel, and i will take care of it
>>>
>>> On Thu, May 3, 2018 at 9:57 PM, Fidel Leon > fi...@flm.cat>> wrote:
>>>
>>> Sure:
>>>
>>> from django.http import HttpResponse
>>>
>>> from .models import Question
>>>
>>>
>>> def index(request):
>>> latest_question_list = Question.objects.order_by('-pub_date')[:5]
>>> output = ', '.join([q.question_text for q in
>>> latest_question_list])
>>> return HttpResponse(output)
>>>
>>> def detail(request, question_id):
>>> return HttpResponse("You're looking at question %s." % question_id)
>>>
>>> def results(request, question_id):
>>> response = "You're looking at the results of question %s."
>>> return HttpResponse(response % question_id)
>>>
>>> def vote(request, question_id):
>>> return HttpResponse("You're voting on question %s." % question_id)
>>>
>>> As a matter of advice, please use a fixed-width font when pasting
>>> code, because Python is indented with spaces and using any other
>>> type of font makes reading your mail difficult :)
>>>
>>> El jue., 3 may. 2018 a las 18:08, Avitab Ayan Sarmah
>>> (>) escribió:
>>>
>>> hello Fidel Leon can you please rewrite the whole views.py
>>> code so that i can understand what is the exact code is
>>>
>>> On Thu, May 3, 2018 at 9:19 PM, Fidel Leon >> > wrote:
>>>
>>>
>>>
>>> El jue., 3 may. 2018 a las 17:38, Avitab Ayan Sarmah
>>> (>)
>>> escribió:
>>>
>>>
>>> *polls/views.py*:
>>>
>>>
>>> from django.http import HttpResponse
>>> from django.template import loader
>>>
>>> from . models import Question
>>>
>>> def index(request):
>>> return HttpResponse("Hello, world.You're at the polls
>>> index.")
>>> latest_question_list =
>>> Question.objects.order_by('-pub_date')[:5]
>>> output = ', '.join([q.question_text for q in
>>> latest_question_list])
>>> return HttpResponse(output)
>>> latest_question_list =
>>> Question.objects.order_by('-pub_date')[:5]
>>> template = loader.get_template('polls/index.html')
>>> context = {
>>> 'latest_question_list': latest_question_list,
>>> }
>>> return HttpResponse(template.render(context, request))
>>>
>>>
>>> Your function index(request) inside polls/views.py is
>>> badly written (you have three function returns). Seems you
>>> are following the tutorial but not removing the previous
>>> examples:
>>>
>>> def index(request):
>>>   latest_question_list =
>>> Question.objects.order_by('-pub_date')[:5]
>>>   context = {'latest_question_list': latest_question_list}
>>>   return render(request, 'polls/index.html', context)
>>>
>>> -- Fidel Leon
>>> fi...@flm.cat 
>>>
>>> -- You received this message because you are
>>> subscribed to a
>>> topic in the Google Groups "Django users" group.
>>> To unsubscribe from this topic, visit
>>>
>>> https://groups.google.com/d/topic/django-users/5hvN4Lfds-w/unsubscribe
>>> <
>>> https://groups.google.com/d/topic/django-users/5hvN4Lfds-w/unsubscribe>.
>>> To unsubscribe from this group and all its topics, send an
>>> email to django-users+unsubscr...@googlegroups.com
>>> .
>>> To post to this group, send email to
>>> django-users@googlegroups.com
>>> .
>>> Visit this group at
>>> https://groups.google.com/group/django-users
>>> .
>>> To view this discussion on the web visit
>>>
>>> 

Re: How can I use a variable from the instance of my data in the upload path for a FileField in my model?

2018-05-03 Thread James Farris
I did something very similar in my models.py. I think for the date you have
to get the year, month with datetime.

def get_upload_path(self, filename): return
'pictures/{0}/{1}'.format(self.user.username,
filename) pet_image = models.ImageField(upload_to=get_upload_path, blank=
True)

On Thu, May 3, 2018 at 3:20 PM Alexander Joseph <
alexander.v.jos...@gmail.com> wrote:

> Actually I figured this out... kind of
>
> You have to make a method for assigning the upload path in the model..
> something like
>
> def upload_path(instance, filename):
> return os.path.join('uploads/%Y/%m/%d/' + instance.design_ui, filename)
>
> and instance the method in your FileField...
>
> design_document = models.FileField(upload_to=upload_path, blank=True)
>
> but for some reason my %Y/%m/%d/  no longer works. If I take out the
> %Y/%m/%d/  it works but if I leave it in it throws an exception. Does
> anyone know why?
>
>
>
>
> On Thursday, May 3, 2018 at 2:50:02 PM UTC-6, Alexander Joseph wrote:
>>
>> Not even sure if you can do it this way. I'm thinking theres another way
>> like overriding the save or the form_valid function in the view... but I'm
>> trying to use a variable from my instance in my upload path for my file
>> field. If I should do something like override the save method in the view
>> how do I save that in the "upload_to" in my model?
>>
>> Here are my model fields
>>
>> design_ui = models.CharField(max_length=255, default='')
>> design_document = models.FileField(upload_to='uploads/%Y/%m/%d/(Id like
>> to put the instance design_ui here)', blank=True)
>>
>>
>> and my view
>>
>> class GaasWaferDesignCreateView(LoginRequiredMixin, CreateView,):
>> fields = ("design_ui", "emitting", "contact_location",
>> "optical_power", "design_date", "designer", "design_document",
>> "designer_ui", "in_trash", "inactive_date", "notes")
>> model = GaasWaferDesign
>> template_name =
>> 'engineering/gaas_wafer_designs/gaas_wafer_design_form.html'
>>
>> def form_valid(self, form):
>> object = form.save(commit=False)
>> object.created_by = self.request.user
>> object.save()
>> return super(GaasWaferDesignCreateView, self).form_valid(form)
>>
>> i.e. if the design_ui of the specific record is GWD0001 and the date is
>> 5/3/18 the upload path would be "2018/05/03/GWD0001/"
>>
>>
>> Thanks again
>>
> --
> 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/8173dbcc-8870-44d1-9796-e22b465144e1%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/CAE-E-_1j%3DRszvw9T09egv9KnzWmjJRsyPYSUWm8fubOkm3wuWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: serving admin files in Apache

2018-05-03 Thread James Farris
Did you run
$ python manage.py collectstatic in your project folder on the server that
is running Apache?

This add all css, js, and images to the static root folder you specified in
settings.py

On Thu, May 3, 2018 at 4:40 PM sum abiut  wrote:

> Hi,
> I have recently setup my django app with Apache. The app files are serve
> alright but, however when i access the admin page it looks all over the
> place. Please advise how to i serve the admin files in Apache.
>
> Cheers,
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPCf-y5%2BVkkGo%2BDGHfX2o6Q54Gdfoo_AxNvTcuZEkOziAH2V1A%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/CAE-E-_1AaYs5HYKxddZ1bf0YQ%3DbE4gvex2-ePSNB43SjNZtfmg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: i'm having issues displaying parent.model.childmodel_set.all on my template

2018-05-03 Thread James Farris
If you add {{ my_users }} to your template do you get any output? If not,
you’re query set has no results.

On Thu, May 3, 2018 at 4:51 PM stanley oguazu  wrote:

> //My template is only displaying the parent table, and not displaying
> child table
>
>  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/02500f66-1283-49a9-b4c3-4fe723a497d0%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/CAE-E-_0PmeXwuGgAGBT6m5KqeMahSvPyu%2BCajkL_8wAeAQM4Nw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread James Farris
If you run these two commands from your command line, what is the output?

python -V 
django-admin.py version


> On May 3, 2018, at 5:23 AM, Duška Miloradović  
> wrote:
> 
> Ayser, thank you very much but that did not help neither. It is still the 
> same - command ends successfully but still I do not see new folder created.
> 
>> On Thu, May 3, 2018 at 8:13 AM, Ayser shuhaib  
>> wrote:
>> Create your projectdir manually then inside the projectdir folder (right 
>> click with your mouse and open command window here)
>> After that continue with Django commands
>> django-admin startproject ...
>> 
>>> On Thu, 03 May 2018 at 07:59, Daisy  wrote:
>>> Thank you very much for your reply, and here I my answers:
>>>   * Does the directory show up when you do a *dir* command in projectdir ? 
>>> It does not show up, although it says that there are 2 directories (see 
>>> attachment). 
>>> 
>>>   * Can you do anything on the *mysite* directory - can you rename it, 
>>> or even delete it ? I can't - system cannot find the file specified.
>>>   * Can you see it in File explorer - No.
>>>   * Can you manually create a directory in your *projectdir* ? - Yes, and 
>>> it is displayed after command *dir*.
>>> 
>>>   * Can you create a different projectdir - and run *django-admin 
>>> startproject mysite* in there ? - I tried creating it on different 
>>> paths, both on C and D disk, but it was the same behavior.
>>> 
>>> What can I do now? :)
>>> 
>>> четвртак, 03. мај 2018. 01.08.04 UTC+2, TonyF-UK је написао/ла:
 Lets troubleshoot: 
 
   * Does the directory show up when you do a *dir* command in projectdir ? 
   * Can you do anything on the *mysite* directory - can you rename it, 
 or even delete it ? 
   * Can you see it in File explorer 
   * Can you manually create a directory in your *projectdir* ? 
   * Can you create a different projectdir - and run *django-admin 
 startproject mysite* in there ? 
 
 My gut feeling is that this is a diskdrive/OS type issue - rather than 
 Django specific 
 
 You may have a corrupted directory - or a bad section of disk; try the 
 troubleshooting steps above first. 
 
 
 
 On 02/05/18 22:09, Daisy wrote: 
 > I installed django according to provided instructions and I am trying 
 > to follow the Django article: Writing your first Django app, part 1 
 >  but I am 
 > stuck at Creating a project with command: django-admin startproject 
 > mysite. 
 > The problem is that I CAN execute command but when I try to access 
 > directory with cd mysite I get the message "The system cannot find the 
 > path specified." although when I try to execute command startproject 
 > again I get the message that it already exists. (see attachment) 
 > I cannot find new directory via windows explorer neither. 
 > I have installed django 2.0.5 version and python 3.6.3 (32-bit). 
 > -- 
 > 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/c574d479-a1b6-4c20-91ab-208ae42d4996%40googlegroups.com
 >  
 > .
 >  
 > For more options, visit https://groups.google.com/d/optout. 
 
 
 -- 
 -- 
 Anthony Flury 
>>> 
 email : *anthon...@btinternet.com* 
>>> 
 Twitter : *@TonyFlury * 
 
>>> 
>>> -- 
>>> 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/c93769b1-55ca-47f7-9f8f-474ab07ede88%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 

Re: Beginning Django.

2018-04-29 Thread James Farris
This is a great online book. Although written for Django 1.11 a lot still 
applies. 

https://djangobook.com/



Sent from my mobile device

> On Apr 28, 2018, at 6:39 AM, Gerardo Palazuelos Guerrero 
>  wrote:
> 
> Hi
> A quick online tutorial? The Django girls tutorial is very good, use Django 
> 1.11 (LTS). Also is free.
> 
> A good book but long? There is a good one Python TDD (Oreilly publisher) by 
> Harry Percival. I’m enjoying too much. It use Django 1.11 (LTS).
> 
> One Django 2.0 I can see Django By Example (Packt publisher) by Antonio Melé. 
> It seems awesome.
> 
> I hopes this helps.
> 
> ---
> Gerardo Palazuelos
> Enviado desde mi iPhone
> 
> 
> El 27/04/2018, a la(s) 23:52, Kayode Oladipo  
> escribió:
> 
>> Hello friends, 
>> I recently completed Python Crash Course 3 and I'm looking to go into web 
>> development with Django, there are almost no Django 2.0 books and I'm 
>> finding the official Polls tutorial a lil beginner unfriendly.
>> 
>> Any advice as regards this?
>> 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/CA%2BARzD9irbH8tWsHKc9Z0WN0mDA_0%2B139Amwr9-9XZTuJAoW8g%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/186CABDE-A684-4356-A14B-F51ADD62E1E9%40gmail.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/326AAB6D-D0AD-454C-AD27-4D632EE3FF03%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django-admin list in readonly

2018-04-27 Thread James Farris
In Django admin I would create a group and give it permissions and add
users to that group.

On Fri, Apr 27, 2018 at 2:58 AM Hervé Edorh  wrote:

>
> In django admin, we have 3 rules that we can attribute to a table we can
> add, modify and delete. when you choose for an user the rule of modify, he
> can't add and delete, My problem is that a have list of object and i don't
> want that the user modify but can select it. how disable it?
>
>
>
>
>
> 
>
>
> 
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/695626ea-1f0a-4c4e-917c-4d1d4937096e%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/CAE-E-_2UeddP4UyPC8-uDds1DCTJVCzGugNMgsK9kNj%3DPSSzaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Current user ip address on form.py

2018-04-27 Thread James Farris
This should work

https://github.com/un33k/django-ipware/blob/master/README.md


On Fri, Apr 27, 2018 at 5:45 AM lakshitha kumara 
wrote:

> Hello Andréas
>
> Thank for your reply. but unfortunately i need get user ip on form.py or
> custom py file in django. is there way to to that ?
>
> Some one post on this example can be work but its also doesn't work
>
> class RegistrationForm(UserCreationForm):
>
> def __init__(self, *args, **kwargs):
> self.request = kwargs.pop('request')
> super(RegistrationForm, self).__init__(*args, **kwargs)
>
> On Friday, April 27, 2018 at 6:06:36 PM UTC+5:30, Andréas Kühne wrote:
>
>> Hi,
>>
>> You can get the IP address from the request. See here:
>>
>> https://stackoverflow.com/questions/4581789/how-do-i-get-user-ip-address-in-django
>>
>> Regards,
>>
>
>> Andréas
>>
>> 2018-04-27 14:28 GMT+02:00 lakshitha kumara :
>>
> Hello Guys
>>>
>>> Is there way to get current user ip address on form.py
>>>
>>> Thanks
>>>
>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>>
>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>
>>
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/d7edf4df-90c5-4b48-afd5-a31fd157d2f2%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/f82200e2-f329-450e-a8a0-1eaf2dc07bc2%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/CAE-E-_2DwSfmnLNbDh2tge9gHxkUMHMyOWfMoj7Ep20k3LuX4w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django--Making query use part of the matching name

2018-04-26 Thread James Farris
Try using filter(id__regex=r'\w’)

I’m not sure if this will give you the exact results your looking for, but 
worth a shot. 


Sent from my mobile device

> On Apr 26, 2018, at 2:31 AM, shawn...@gmail.com wrote:
> 
> Thank you for your help! And yes, I think I should use regex. But could you 
> please show me how to use it in my example, since I am new to django..
> 
> 在 2018年4月26日星期四 UTC+1上午2:14:10,James Farris写道:
>> 
>> I believe you want to use icontains rather than contains. It’s case 
>> insensitive. 
>> 
>> I’m not sure without using regex it’s possible to return the results based 
>> on any character in any order in the search string. 
>> 
>>> On Apr 25, 2018, at 5:13 PM, shaw...@gmail.com wrote:
>>> 
>>> Hello everyone!
>>> 
>>> Currently I am working on Django.
>>> 
>>> I defined a 'Search' function in views.py:
>>> 
>>> def search(request):
>>> q = request.GET.get("q")
>>> if q:
>>> ReactResul = Reactionsmeta.objects.filter(id__contains=q)
>>> MetaResul = Metabolites.objects.filter(id__contains=q)
>>> GeneResul = Genes.objects.filter(id__contains=q)
>>> 
>>> else:
>>> # you may want to return Customer.objects.none() instead
>>> ReactResul= Reactionsmeta.objects.all()
>>> GeneResul = Genes.objects.all()
>>> MetaResul = Metabolites.objects.all()
>>> context = dict(result_1=MetaResul, q=q, result_2=ReactResul, result_3 = 
>>> GeneResul)
>>> return render(request, "Recon/search.html", context)
>>> 
>>> And now I want to make it more powerful.
>>> 
>>> If I want to search '10FTH86RSK' but I cannot remember the whole name, I 
>>> can just use part of the string to make query. For example, if I type 
>>> '10FTK', '10FTH86RSK' should be returned as result.
>>> In that case, '10FTK', '10F6TK' or '10FTK4' should also be returned as 
>>> results.
>>> 
>>> So how could I achieve this function?
>>> -- 
>>> 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/793b8999-cac4-4c2d-94cc-eabb80f4e702%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/75275cd3-84d0-45fb-a104-4cc5c224f813%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/9F2E0677-FD8C-446B-83DA-8119D6D3705C%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django--Making query use part of the matching name

2018-04-25 Thread James Farris
I believe you want to use icontains rather than contains. It’s case 
insensitive. 

I’m not sure without using regex it’s possible to return the results based on 
any character in any order in the search string. 

> On Apr 25, 2018, at 5:13 PM, shawn...@gmail.com wrote:
> 
> Hello everyone!
> 
> Currently I am working on Django.
> 
> I defined a 'Search' function in views.py:
> 
> def search(request):
> q = request.GET.get("q")
> if q:
> ReactResul = Reactionsmeta.objects.filter(id__contains=q)
> MetaResul = Metabolites.objects.filter(id__contains=q)
> GeneResul = Genes.objects.filter(id__contains=q)
> 
> else:
> # you may want to return Customer.objects.none() instead
> ReactResul= Reactionsmeta.objects.all()
> GeneResul = Genes.objects.all()
> MetaResul = Metabolites.objects.all()
> context = dict(result_1=MetaResul, q=q, result_2=ReactResul, result_3 = 
> GeneResul)
> return render(request, "Recon/search.html", context)
> 
> And now I want to make it more powerful.
> 
> If I want to search '10FTH86RSK' but I cannot remember the whole name, I can 
> just use part of the string to make query. For example, if I type '10FTK', 
> '10FTH86RSK' should be returned as result.
> In that case, '10FTK', '10F6TK' or '10FTK4' should also be returned as 
> results.
> 
> So how could I achieve this function?
> -- 
> 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/793b8999-cac4-4c2d-94cc-eabb80f4e702%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/9EC3A76F-EE60-47DC-B4DD-9092D8321EC1%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trying to understand two messages from `manage.py check --deploy`

2018-04-24 Thread James Farris
Hi,

django.middleware.security.SecurityMiddleware is missing in your settings.py 
file in the middleware section. 

Read the Django docs for more details on what they each one of the security 
options do. 

https://docs.djangoproject.com/en/2.0/ref/middleware/

Sent from my mobile device

> On Apr 23, 2018, at 12:27 PM, Tom Tanner  
> wrote:
> 
> I get these two messages after running `python manage.py check --deploy`
> 
> ?: (security.W001) You do not have 
> 'django.middleware.security.SecurityMiddleware' in your MIDDLEWARE_CLASSES so 
> the SECURE_HSTS_SECONDS, SECURE_CONTENT_TYPE_NOSNIFF, 
> SECURE_BROWSER_XSS_FILTER, and SECURE_SSL_REDIRECT settings will have no 
> effect.
> ?: (security.W019) You have 
> 'django.middleware.clickjacking.XFrameOptionsMiddleware' in your 
> MIDDLEWARE_CLASSES, but X_FRAME_OPTIONS is not set to 'DENY'. The default is 
> 'SAMEORIGIN', but unless there is a good reason for your site to serve other 
> parts of itself in a frame, you should change it to 'DENY'.
> 
> I do not understand what each of them mean or if I should be worried. Can 
> anyone translate these to plain English?
> -- 
> 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/1c0b2ca2-644c-4eac-9494-d3239e22f220%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/08BD2D2F-5EA5-4BE8-9F81-56A980D2E0A8%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django generated migration fails with KeyError for field that was removed from the model.

2018-04-19 Thread James Farris
My guess is that field is not empty in the database or it’s being called in a 
view or template still. 

Sent from my mobile device

> On Apr 18, 2018, at 2:59 PM, jackotonye  wrote:
> 
> A migration generated with `python manage.py makemigrations` Fails to execute 
> using `python manage.py migrate`.
> 
> 
> Model Layout:
> 
> class Offer(BaseModel):
> client = models.ForeignKey(Client, on_delete=models.PROTECT, 
> related_name='offers')
> amount_off = models.DecimalField(max_digits=5, decimal_places=2, 
> default=Decimal('0.00')).  # Removed this field from the model
> 
> 
> 
> Generated Migration file:
> 
> # Generated by Django 2.0.2 on 2018-04-18 21:36
> 
> from django.db import migrations
> 
> 
> class Migration(migrations.Migration):
> 
> dependencies = [
> ('my_app', '0031_auto_20180418_1802'),
> ]
> 
> operations = [
> migrations.RemoveField(
> model_name='offer',
> name='amount_off',
> ),
> ]
> 
> 
> 
> 
> Error:
> Running migrations:
> 
>   Applying my_app.0032_auto_20180418_2136...Traceback (most recent call last):
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/models/options.py",
>  line 566, in get_field
> 
> return self.fields_map[field_name]
> 
> KeyError: 'amount_off'
> 
> 
> During handling of the above exception, another exception occurred:
> 
> 
> Traceback (most recent call last):
> 
>   File "manage.py", line 22, in 
> 
> execute_from_command_line(sys.argv)
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/core/management/__init__.py",
>  line 371, in execute_from_command_line
> 
> utility.execute()
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/core/management/__init__.py",
>  line 365, in execute
> 
> self.fetch_command(subcommand).run_from_argv(self.argv)
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/core/management/base.py",
>  line 288, in run_from_argv
> 
> self.execute(*args, **cmd_options)
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/core/management/base.py",
>  line 335, in execute
> 
> output = self.handle(*args, **options)
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/core/management/commands/migrate.py",
>  line 200, in handle
> 
> fake_initial=fake_initial,
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/migrations/executor.py",
>  line 117, in migrate
> 
> state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, 
> fake_initial=fake_initial)
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/migrations/executor.py",
>  line 147, in _migrate_all_forwards
> 
> state = self.apply_migration(state, migration, fake=fake, 
> fake_initial=fake_initial)
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/migrations/executor.py",
>  line 244, in apply_migration
> 
> state = migration.apply(state, schema_editor)
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/migrations/migration.py",
>  line 122, in apply
> 
> operation.database_forwards(self.app_label, schema_editor, old_state, 
> project_state)
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/migrations/operations/models.py",
>  line 525, in database_forwards
> 
> getattr(new_model._meta, self.option_name, set()),
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/backends/base/schema.py",
>  line 342, in alter_unique_together
> 
> self._delete_composed_index(model, fields, {'unique': True}, 
> self.sql_delete_unique)
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/backends/base/schema.py",
>  line 365, in _delete_composed_index
> 
> columns = [model._meta.get_field(field).column for field in fields]
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/backends/base/schema.py",
>  line 365, in 
> 
> columns = [model._meta.get_field(field).column for field in fields]
> 
>   File 
> "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-packages/django/db/models/options.py",
>  line 568, in get_field
> 
> raise FieldDoesNotExist("%s has no field named '%s'" % (self.object_name, 
> field_name))
> 
> django.core.exceptions.FieldDoesNotExist: Offer has no field named 
> 'amount_off'
> 
> 
> 
> 
> 
> 
> 
> -- 
> 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 

Re: What were your best resources in learning programming, python, ultimately django?

2018-04-09 Thread James Farris
Early on Lynda.com was my best friend for learning basics like HTML and CSS. 
Then a lot of practice. 

Later on I took a coding boot camp in my area that really accelerated my 
learning and filled in a lot of the missing pieces. It covered HTML, CSS, PHP, 
Ruby on Rails and SQL to name a few. 

The Django docs and “The Django Book” https://djangobook.com/ we’re both great 
to get me started on Django. Also Lynda.com again for python and Django.

-James

> On Apr 9, 2018, at 8:15 AM, Mateusz Kurowski  
> wrote:
> 
> https://www.youtube.com/watch?v=HTLu2DFOdTg=PLRVdut2KPAguz3xcd22i_o_onnmDKj3MA
> https://www.youtube.com/watch?v=7lmCu8wz8ro=PLOAwbpVBkzASOH-SzAq8NMI7H-Eo-Vql8
> https://www.youtube.com/watch?v=tkwZ1jG3XgA=PLOAwbpVBkzAQtFNxWpbeDAGRacBn6aL7t=7
> https://www.youtube.com/watch?v=Zo5q48BG8A4=8=PLOAwbpVBkzAQtFNxWpbeDAGRacBn6aL7t
> 
> 
> 2018-04-09 16:56 GMT+02:00 Amber Pond :
>> What were your best resources in learning programming, python, ultimately 
>> django?
>> 
>> Hi friends!
>> 
>> Just starting out with some basic html and css knowledge, and I am taking my 
>> first python class. When you were first learning programming, what were you 
>> MOST influential and helpful resources? Reply to this thread so that others 
>> and myself can use this for reference on our journeys. 
>> 
>> Sites?
>> Books?
>> Projects?
>> Forums?
>> Courses?
>> -- 
>> 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/76a94793-11ad-4149-8b2f-2e9f42e3c77b%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/CAO_JuYMMVB_EK_zDi_y4GAfjM08Nsxgyez5sPoTabnp2SySAXg%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/BA1CD3E2-AFB7-476C-9731-06C419502BB2%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: no styling

2018-04-09 Thread James Farris
Hi Paul,

Have you read this part of the docs? 
https://docs.djangoproject.com/en/2.0/howto/static-files/

You will need a static files directory and will need to tell Django where it is 
In settings.py

Sent from my mobile device

> On Apr 9, 2018, at 5:04 AM, Paul Baforh  wrote:
> 
> Please, my django development page is without css. How do I go about it. 
> 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/8ff37f92-652c-4380-88fa-67b609147638%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/C21BA56C-F7FD-45A1-9EFD-5F13470F40F6%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: A first time programmer

2018-04-07 Thread James Farris
No one can walk you through how to use Django in this group. That is too much 
to explain. 

I recommend choosing a plain text editor like Sublime Text or many others that 
are free in order to start working on any coding project. 

Then once you have that, read the documentation and follow this tutorial 
written by the Django developers. 

https://docs.djangoproject.com/en/2.0/intro/tutorial01/

-- 
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/1f2a4ee9-f435-47a5-810e-c439d4f779d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Storing lists from api into database

2018-04-06 Thread James Farris
I would use the Requests module.  It's much nicer and comes loaded with 
stuff.  It's a module used to connect to API's.  Here's the docs: 
http://docs.python-requests.org/en/master/

As far as using what you have, to save it to the database is just another 
few lines of code.
You have to import the database model

from YOUR_APP.models import tesla

Then in loop in your view just add the following to save the data to the 
database:

tesla = tesla()
tesla.webUrl = data['response']['results'][i]['webUrl]
tesla.webPublicationDat = 
data['response']['results'][i]['webPublicationDate]
tesla.save()

A few things.  It's best practice to Capitalize your models( i.e. class 
Tesla, not tesla) 
If your intention is to generate an id in the id1 field, there is no need 
to have it because Django gives you an id field automatically.

On Friday, April 6, 2018 at 8:03:10 PM UTC, Mukesh Jha wrote:
>
> My main project is to collect and show the results from news site of a 
> particular topic. I have use the guardian's api and I have been given 4 
> keywords. If I click on any one of the keyword, I need to display all the 
> recent articles related to it. Now what I have understood is:
>
> import json,urllib.request
> data = json.load(urllib.request.urlopen('
> https://content.guardianapis.com/search?q=gst=test'))
> lurl=[]  #list to store the url of articles
> ldate=[]   #list to store the date of publish of url
> for i in range(0,10):
>   lurl.append(data['response']['results'][i]['webUrl'])
>   ldate.append(data['response']['results'][i]['webPublicationDate'])
> for i in range(0,10):
>   print(ldate[i]+" : ",end="")
>   print(lurl[i])
>
> Now I have to store all such values in my database and call it in views 
> page.
>
> class tesla(models.Model):
> id1=models.CharField(max_length=1)
> webTitle=models.CharField(max_length=1)
> webUrl=models.CharField(max_length=1)
> apiUrl=models.CharField(max_length=1)
> webPublicationDat=models.CharField(max_length=1)
>
> How can I do it? Please help.
>

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


Re: Storing lists from api into database

2018-04-06 Thread James Farris
I would use the Requests module.  It's much nicer and comes loaded with 
stuff.  It's a module used to connect to API's.  Here's the docs: 
http://docs.python-requests.org/en/master/

As far as using what you have, to save it to the database is just another 
few lines of code.
You have to import the database model

from YOUR_APP import tesla

Then in loop in your view just add the following to save the data to the 
database:

tesla = tesla()
tesla.webUrl = data['response']['results'][i]['webUrl]
tesla.webPublicationDat = 
data['response']['results'][i]['webPublicationDate]
tesla.save()

A few things.  It's best practice to Capitalize your models( i.e. class 
Tesla, not tesla) 
If your intention is to generate an id in the id1 field, there is no need 
to have it because Django gives you an id field automatically.


On Friday, April 6, 2018 at 8:03:10 PM UTC, Mukesh Jha wrote:
>
> My main project is to collect and show the results from news site of a 
> particular topic. I have use the guardian's api and I have been given 4 
> keywords. If I click on any one of the keyword, I need to display all the 
> recent articles related to it. Now what I have understood is:
>
> import json,urllib.request
> data = json.load(urllib.request.urlopen('
> https://content.guardianapis.com/search?q=gst=test'))
> lurl=[]  #list to store the url of articles
> ldate=[]   #list to store the date of publish of url
> for i in range(0,10):
>   lurl.append(data['response']['results'][i]['webUrl'])
>   ldate.append(data['response']['results'][i]['webPublicationDate'])
> for i in range(0,10):
>   print(ldate[i]+" : ",end="")
>   print(lurl[i])
>
> Now I have to store all such values in my database and call it in views 
> page.
>
> class tesla(models.Model):
> id1=models.CharField(max_length=1)
> webTitle=models.CharField(max_length=1)
> webUrl=models.CharField(max_length=1)
> apiUrl=models.CharField(max_length=1)
> webPublicationDat=models.CharField(max_length=1)
>
> How can I do it? Please help.
>

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


Re: A first time programmer

2018-04-06 Thread James Farris
Hi,

If you type this in your terminal, you should see Django==2.0.4 (or some 
other version)

$ pip freeze

If not, Django is not installed.

Also, what is the syntax error you are receiving?

On Friday, April 6, 2018 at 10:33:39 PM UTC, Paul Baforh wrote:
>
> Please programmers, how do I engage django because i get syntax error i 
> type in this code
> - $ django-admin startproject mySite ---
>

-- 
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/732d0a71-22bc-4983-b335-09de5554c518%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Multiple websocket connection vs single websocket connection when using django channels

2018-04-06 Thread James Farris
I’m looking into creating an app that may utilize chat and notifications as 
well. I’m interested in what others have to say about this as well

-- 
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/f39476b5-eb31-48da-ac44-e5f53940396c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Populate a select dropdown based on queryset

2018-03-30 Thread James Farris
Thank you Derek! I will definitely look into it. 

-James

> On Mar 30, 2018, at 12:08 AM, Derek <gamesb...@gmail.com> wrote:
> 
> You can use "smart selects":
> 
> https://github.com/digi604/django-smart-selects
> 
> Works for both normal forms and in the admin.
> 
> 
>> On Wednesday, 28 March 2018 23:02:36 UTC+2, James Farris wrote:
>> Hi,
>> 
>> I'm trying to populate a 'vaccine' dropdown based on a 'species' of a pet.  
>> For example, if a pet is a 'dog' I want to display vaccines for a dog only.  
>> If a pet is a cat, I want to display a list of vaccines for cats only.
>> 
>> How do I do this?  I googled, but didn't come up with anything solid.
>> 
>> Here is my models.py
>> 
>> class Pet(models.Model):
>> user = models.ForeignKey(User, on_delete=models.CASCADE, null=True)
>> name = models.CharField(max_length=100, null=True, db_index=True)
>> species = models.CharField(choices=SPECIES_CHOICES, null=True, 
>> max_length=20)
>> 
>> def __str__(self):
>> return self.name
>> 
>> 
>> class Vaccine(models.Model):
>> vacc_name = models.CharField(max_length=100)
>> species = models.CharField(choices=SPECIES_CHOICES, null=True, 
>> max_length=20)
>> pet = models.ManyToManyField(Pet, through='PetHasVaccine')
>> 
>> def __str__(self):
>> return self.vacc_name
>> 
>> 
>> class PetHasVaccine(models.Model):
>> pet = models.ForeignKey(Pet, on_delete=models.DO_NOTHING)
>> vaccine = models.ForeignKey(Vaccine, on_delete=models.DO_NOTHING)
>> 
>> def __str__(self):
>> return str(self.pet.name) + ' - ' + str(self.vaccine.vacc_name)
>> 
>> 
>> Here is my views.py
>> 
>> def add_vaccine(request, pet_pk):
>> pet = Pet.objects.get(pk=pet_pk)
>> if pet.user == request.user:
>> form = VaccineForm(request.POST or None)
>> if request.POST:
>> if form.is_valid():
>> return HttpResponse(form)
>> else:
>> return render(request, 'pet/vaccine_add.html', {'vacc_form': 
>> VaccineForm(request.POST), 'pet': pet})
>> else:
>> return render(request, 'pet/vaccine_add.html', {'vacc_form': 
>> form, 'pet': pet})
>> 
>> 
>> Here is my forms.py
>> 
>> class VaccineForm(ModelForm):
>> 
>> class Meta:
>> model = PetHasVaccine
>> fields = '__all__'
>> exclude = ('pet',)
>> widgets = {
>> 'date_given': DateInput(),
>> 'date_due': DateInput(),
>> }
> 
> -- 
> 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/172ae5f3-df10-4bf2-acdc-390dea7edc49%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/BFA9FBCE-77D8-45DE-81B7-7CA527AD09A5%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pythonanywhere Hosting issue

2018-03-29 Thread James Farris
Where is your DNS records stored? Godaddy or pythonanywhere. It sounds like the 
dns records are coming from godaddy since that’s the page you see when you load 
the site. 

The way I was taught is you point your cname to an A record which points to the 
server where your doc root is. It sounds like the A record and/or namespace is 
pointing to godaddy. The namespace identifies where the dns records live. 

A - points to server I.e. pythonanywhere.com
CNAME - points to an alias i.e. webapp- on pythonanywhere.com

Hope that helps. 



Sent from my mobile device

> On Mar 29, 2018, at 10:47 AM, Jani Tiainen  wrote:
> 
> Hi,
> 
> This is not issue with Django nor has anything to do with it.
> 
> You need to contact either pythonanywhere.com or godaddy about your DNS 
> issues.
> 
>> On Thu, Mar 29, 2018 at 8:14 PM, yingi keme  wrote:
>> Hello, 
>> 
>> my site is hosted on pythonanywhere.com. As per this tutorial 
>> https://help.pythonanywhere.com/pages/UsingANewDomainForExistingWebApp
>> 
>> I have changed the previous configuration from username.pythonanywhere.com 
>> to www.mydomain.com. There was a CNAME value webapp-.pythonanywhere.com
>> 
>> I bought my domain name from godaddy registrar. I am having an issue with 
>> managing DNS record. When i try to add the record
>> 
>> Type: CNAME
>> Host: www
>> Points to: webapp-.pythonanywhere.com
>> TTL: 1 Hr
>> 
>> It says "The specified CNAME already exist in the zone". 
>> 
>> And then when i try to load www,mydomain.com, it shows a page from the 
>> godaddy site instead of my HomePage
>> 
>> Please anyhelp will be appreciated
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/76b6f86a-35a1-4a0f-ad5b-70f689dcfe6e%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> 
> 
> -- 
> Jani Tiainen
> 
> - Well planned is half done, and a half done has been sufficient before...
> -- 
> 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/CAHn91ocgp_CGarPNt8K3R5zkhO7r-ErT4F8UP2uM1%2BWki_qonA%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/84DB70AC-04CF-4134-A154-24E6B6032346%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Populate a select dropdown based on queryset

2018-03-28 Thread James Farris
Hi,

I'm trying to populate a 'vaccine' dropdown based on a 'species' of a pet.  
For example, if a pet is a 'dog' I want to display vaccines for a dog 
only.  If a pet is a cat, I want to display a list of vaccines for cats 
only.

How do I do this?  I googled, but didn't come up with anything solid.

*Here is my models.py*

class Pet(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, null=True)
name = models.CharField(max_length=100, null=True, db_index=True)
species = models.CharField(choices=SPECIES_CHOICES, null=True, 
max_length=20)

def __str__(self):
return self.name


class Vaccine(models.Model):
vacc_name = models.CharField(max_length=100)
species = models.CharField(choices=SPECIES_CHOICES, null=True, 
max_length=20)
pet = models.ManyToManyField(Pet, through='PetHasVaccine')

def __str__(self):
return self.vacc_name


class PetHasVaccine(models.Model):
pet = models.ForeignKey(Pet, on_delete=models.DO_NOTHING)
vaccine = models.ForeignKey(Vaccine, on_delete=models.DO_NOTHING)

def __str__(self):
return str(self.pet.name) + ' - ' + str(self.vaccine.vacc_name)



*Here is my views.py*


def add_vaccine(request, pet_pk):
pet = Pet.objects.get(pk=pet_pk)
if pet.user == request.user:
form = VaccineForm(request.POST or None)
if request.POST:
if form.is_valid():
return HttpResponse(form)
else:
return render(request, 'pet/vaccine_add.html', {'vacc_form': 
VaccineForm(request.POST), 'pet': pet})
else:
return render(request, 'pet/vaccine_add.html', {'vacc_form': form, 
'pet': pet})



*Here is my forms.py*


class VaccineForm(ModelForm):

class Meta:
model = PetHasVaccine
fields = '__all__'
exclude = ('pet',)
widgets = {
'date_given': DateInput(),
'date_due': DateInput(),
}

-- 
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/0dd005ba-1d3a-4dd2-ab94-4d1f3b94f287%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Getting complex query set with a many to many relationship in django

2018-02-22 Thread James Farris


I am trying to *get all article objects that are part of a section* in an 
edition that is in an issue. I am stumped, even after looking at the 
documentation 

 
for django 2.x

I can get all editions with all of their sections that are part of an 
issue, but I cannot figure out how to get articles that are related to a 
section per edition.

Sample code is here:
https://codeshare.io/5vXbAD

Please note I have a many to many pass through table that has extra fields 
I am trying to get.  Specifically the "order" field.
Here is a screenshot for proof of concept
https://pasteboard.co/H8N2zTt.png

If you are able to get all articles returned from the loop in the code 
linked above, I will be eternally grateful :)

results would be passed to a template.

-- 
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/1ba9dc4e-3eab-4d1e-b552-1102e8e7791a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to install and use Django

2018-02-09 Thread James Farris
I highly recommend installing virtualenv and virtualenvwrapper. This will 
reduce the stress of creating a bunch of unnecessary modules on your computer 
and contain each project you create in a separate environment. For example you 
wouldn’t necessarily want to install Django globally but rather for a specific 
project your working on. That’s where virtualenv comes in. 

I also recommend going through the Django Book. It walks you through an app 
that uses a lot of what Django has to offer: https://djangobook.com

Also go through the Writing your first Django app in the Django docs: 
https://docs.djangoproject.com/en/2.0/intro/tutorial01/

I use PyCharm, because it has great auto complete and debugging. 

Other references mentioned above are below. 

Django apps: https://docs.djangoproject.com/en/2.0/ref/applications/
Homebrew: https://brew.sh/
Virtualenv: https://virtualenv.pypa.io/en/stable/
Virtualenvwrapper: 
https://virtualenvwrapper.readthedocs.io/en/latest/install.html

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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/07ea640d-472e-406b-925b-f5185f28913b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.