Re: How Do I Authorise user using token

2021-10-06 Thread Adeyemi Deji
Check this out, might be of help.
https://www.youtube.com/watch?v=Wq6JqXqOzCE


On Wednesday, October 6, 2021 at 6:16:51 PM UTC+2 Kasper Laudrup wrote:

> On 06/10/2021 15.19, M R wrote:
> > 
> > I have created tokens  but i don't know how to use it for authentication.
>
>
> https://devinsights.hashnode.dev/token-based-user-authentication-with-django
>
> > Every web page is showing in postman in google.
> > 
>
> I have no idea what that is supposed to mean. Please clarify.
>
> > how do i use headers in url
> > 
>
> You don't. Headers are not part of a URL.
>
> Kind regards,
>
> Kasper Laudrup
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9dcc91dd-049b-4724-a27d-87aab9fc0546n%40googlegroups.com.


Re: TemplateDoesNotExist at /catalog/books/

2021-10-06 Thread Adeyemi Deji
Hi, please make reference to link below, looks similar to what you are 
building
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Generic_views

Also I will read up the documentation to find solution to this issue. You 
can take a break, you have really worked hard today. 

On Wednesday, October 6, 2021 at 5:26:19 PM UTC+2 nazni...@gmail.com wrote:

> No, both variants don't work. 
>
> ср, 6 окт. 2021 г. в 18:17, Adeyemi Deji :
>
>> Okay, I also noticed something in the TEMPLATES VARIABLE in your 
>> settings.py file, please make DIRS an empty list like this [] with no space 
>> or better still change to [os.path.join(BASE_DIR, 'catalog/templates')]
>>
>> On Wednesday, October 6, 2021 at 5:00:42 PM UTC+2 nazni...@gmail.com 
>> wrote:
>>
>>> Thank you!
>>> I corrected as you wrote. But I also have this mistake (
>>> TemplateDoesNotExist at /catalog/books/
>>> catalog/book_list.html, catalog/book_list.html). 
>>> Might I take the wrong path? (my path is below picture)
>>> Also thank you for helping me. I am grateful to you. I have had this 
>>> problem for 1 week. 
>>> [image: image.png]
>>>
>>>
>>> ср, 6 окт. 2021 г. в 16:19, Adeyemi Deji :
>>>
>>>> correct paginated_by to paginate_by.
>>>>
>>>>
>>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
>>>>  Virus-free. 
>>>> www.avast.com 
>>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
>>>>  
>>>> <#m_-1143733024743841618_m_-1887519385446215222_m_-4865023885270008228_m_2700252164806904525_m_-6914425398611891894_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>>>
>>>> On Wed, Oct 6, 2021 at 3:17 PM Adeyemi Deji  
>>>> wrote:
>>>>
>>>>> Please correct your class views, you are getting it wrong.
>>>>> it should look like this.
>>>>>
>>>>> class BookListView(generic.ListView):
>>>>> model = Book
>>>>> paginated_by = 10
>>>>> template_name = "catalog/book_list.html"
>>>>>
>>>>> class BookDetailView(generic.DetailView):
>>>>> model = Book
>>>>> template_name = "catalog/book_detail.html"
>>>>>
>>>>>
>>>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
>>>>>  Virus-free. 
>>>>> www.avast.com 
>>>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
>>>>>  
>>>>> <#m_-1143733024743841618_m_-1887519385446215222_m_-4865023885270008228_m_2700252164806904525_m_-6914425398611891894_m_1024950781820118978_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>>>>
>>>>> On Wed, Oct 6, 2021 at 3:09 PM Никита Назаров  
>>>>> wrote:
>>>>>
>>>>>> It also doesn't work. I see this error :"TemplateDoesNotExist at 
>>>>>> /catalog/books/ catalog/book_list.html, catalog/book_list.html"
>>>>>> My views.py is below.
>>>>>> Also, I checked on GitHub Mozilla (
>>>>>> https://github.com/mdn/django-locallibrary-tutorial/blob/master/catalog/views.py).
>>>>>>  
>>>>>> They didn't use - template_name. 
>>>>>> I'm completely confused. 
>>>>>>
>>>>>> from .models import Book, Author, BookInstance, Genre
>>>>>> from django.views import generic
>>>>>> from django.shortcuts import render
>>>>>> from django.views.generic.base import TemplateView
>>>>>>
>>>>>> # Create your views here.
>>>>>>
>>>>>>
>>>>>> def index(request):
>>>>>> """View function for home page of site."""
>>>>>>
>>>>>> # Generate counts of some of the main objects
>>>>>> num_books = Book.objects.all().count()
>>>>>> num_instances = BookInstance.objects.all().count()
>>>>>>
>>>>>> # Available books (status

Re: how to include image dynamically

2022-02-24 Thread Adeyemi Deji
They are two ways to this. But would talk about one, the other is more
practical. Takeout the baseUrl variable and the forward slash, then use {{
cmp.img.url }}. This should work and if it doesn't. Look for solutions by
googling it. Sure u would find answers to ur question.

On Thu, 24 Feb 2022, 17:20 Kasper Laudrup,  wrote:

> On 24/02/2022 16.41, Suresh_Chilukuri wrote:
> > I am asking how we can get image from function based views dynamically
> > in template file
> >
>
> What do you mean by dynamic?
>
> Do you mean passing a list of files from a specific sub directory in the
> static folder to the template?
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/42250de8-c569-ed45-f1d6-7c2143e79050%40stacktrace.dk
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEO1GrqZPPdBstOiEQh%2BJ-%2B7gzuLp0uQj8PdEACch21_%2B%2BNKWw%40mail.gmail.com.


Re: how to include image dynamically

2022-02-24 Thread Adeyemi Deji
Make sure u configured the Media_root and Media_url appropriately in the
settings.py file

On Thu, 24 Feb 2022, 18:18 Adeyemi Deji,  wrote:

> They are two ways to this. But would talk about one, the other is more
> practical. Takeout the baseUrl variable and the forward slash, then use {{
> cmp.img.url }}. This should work and if it doesn't. Look for solutions by
> googling it. Sure u would find answers to ur question.
>
> On Thu, 24 Feb 2022, 17:20 Kasper Laudrup,  wrote:
>
>> On 24/02/2022 16.41, Suresh_Chilukuri wrote:
>> > I am asking how we can get image from function based views dynamically
>> > in template file
>> >
>>
>> What do you mean by dynamic?
>>
>> Do you mean passing a list of files from a specific sub directory in the
>> static folder to the template?
>>
>> Kind regards,
>>
>> Kasper Laudrup
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/42250de8-c569-ed45-f1d6-7c2143e79050%40stacktrace.dk
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEO1GroCvpACNOcY7ngM%3DtC%3DpKoprUAONP8qbymkruhP-aui2Q%40mail.gmail.com.


Re: The SECRET_KEY setting must not be empty - os.environ.get('SECRET_KEY')

2022-03-01 Thread Adeyemi Deji
I also get this error anytime I deploy. It works on developments mode. I
suspect the error coming as a result of adding .env to .gitignore, which
doesn't reflect on GitHub and heroku  doesn't have access to .env file. Pls
how do I sort this out?

Thanks in advance for your help

On Wed, 2 Mar 2022, 04:25 Mike Dewhirst,  wrote:

> On 2/03/2022 9:00 am, Dev femibadmus wrote:
>
> Do u create the variable SECRET_KEY if no copy ur secret_key e.g
> "hdFgBv&$..." and create variable SECRET_KEY in ur env which could be or is
> ur hosting platform and give the value as ur secret_key
>
> On Sun, Feb 27, 2022, 21:19 Valdinia - Office  wrote:
>
>> On W10 I defined an environment variable: SECRET_KEY
>> In shell I can read the key:
>>
>> *>>> import os*
>> *>>> os.environ.get('SECRET_KEY')*
>> 'mysecretkey...'
>>
>> But when I'm doing the same thing in *settings.py* I get:
>>
>> \lib\site-packages\django\conf\__init__.py", line 90, in __getattr__
>> raise
>> *ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
>> django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must
>> not be empty.*
>>
>> I found all sorts of solutions, but none works for my app. What should I
>> do?
>>
>
> SECRET_KEY belongs in settings.py as a string
>
> Therefore, if you wish to avoid putting it in there directly (as we all
> do) you must call a function which returns a string.
>
> SECRET_KEY = get_secret_key()
>
> ... where you write get_secret_key() to pull it from the environment or a
> file somewhere which is not in your repository.
>
> In my case, I wrote get_creds() as a general purpose retriever of
> credentials and other bits and pieces which don't belong in the repository
> and/or change between servers, eg., staging vs production vs development
> etc. I keep those credentials in separate files in a standard location on
> every server.
>
> That is only suitable for servers I control.
>
> Cheers
>
> Mike
>
>
>
>
>
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/4afcfd9b-da0f-472e-b5d7-6339088bc4f6n%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAD9bWYyaM2pfg_dvyxk_-UtAqOSi7viT51mX4OxwomFW9sU7Bg%40mail.gmail.com
> 
> .
>
>
>
> --
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Just
> ask and I'll send it to you. Your email software can handle signing.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3b40c474-72c3-ced9-ecb7-fd1348845d00%40dewhirst.com.au
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEO1Grrhh2i0Ds9Mm2%3Dqaw-17KFvvLC_1e-Eeiuq0i5wddU3SA%40mail.gmail.com.


Re: The SECRET_KEY setting must not be empty - os.environ.get('SECRET_KEY')

2022-03-01 Thread Adeyemi Deji
I used dotenv module installed with pip

On Wed, 2 Mar 2022, 04:43 Adeyemi Deji,  wrote:

> I also get this error anytime I deploy. It works on developments mode. I
> suspect the error coming as a result of adding .env to .gitignore, which
> doesn't reflect on GitHub and heroku  doesn't have access to .env file. Pls
> how do I sort this out?
>
> Thanks in advance for your help
>
> On Wed, 2 Mar 2022, 04:25 Mike Dewhirst,  wrote:
>
>> On 2/03/2022 9:00 am, Dev femibadmus wrote:
>>
>> Do u create the variable SECRET_KEY if no copy ur secret_key e.g
>> "hdFgBv&$..." and create variable SECRET_KEY in ur env which could be or is
>> ur hosting platform and give the value as ur secret_key
>>
>> On Sun, Feb 27, 2022, 21:19 Valdinia - Office 
>> wrote:
>>
>>> On W10 I defined an environment variable: SECRET_KEY
>>> In shell I can read the key:
>>>
>>> *>>> import os*
>>> *>>> os.environ.get('SECRET_KEY')*
>>> 'mysecretkey...'
>>>
>>> But when I'm doing the same thing in *settings.py* I get:
>>>
>>> \lib\site-packages\django\conf\__init__.py", line 90, in __getattr__
>>> raise
>>> *ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
>>> django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must
>>> not be empty.*
>>>
>>> I found all sorts of solutions, but none works for my app. What should I
>>> do?
>>>
>>
>> SECRET_KEY belongs in settings.py as a string
>>
>> Therefore, if you wish to avoid putting it in there directly (as we all
>> do) you must call a function which returns a string.
>>
>> SECRET_KEY = get_secret_key()
>>
>> ... where you write get_secret_key() to pull it from the environment or a
>> file somewhere which is not in your repository.
>>
>> In my case, I wrote get_creds() as a general purpose retriever of
>> credentials and other bits and pieces which don't belong in the repository
>> and/or change between servers, eg., staging vs production vs development
>> etc. I keep those credentials in separate files in a standard location on
>> every server.
>>
>> That is only suitable for servers I control.
>>
>> Cheers
>>
>> Mike
>>
>>
>>
>>
>>
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/4afcfd9b-da0f-472e-b5d7-6339088bc4f6n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/4afcfd9b-da0f-472e-b5d7-6339088bc4f6n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAD9bWYyaM2pfg_dvyxk_-UtAqOSi7viT51mX4OxwomFW9sU7Bg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAD9bWYyaM2pfg_dvyxk_-UtAqOSi7viT51mX4OxwomFW9sU7Bg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>>
>>
>> --
>> Signed email is an absolute defence against phishing. This email has
>> been signed with my private key. If you import my public key you can
>> automatically decrypt my signature and be sure it came from me. Just
>> ask and I'll send it to you. Your email software can handle signing.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/3b40c474-72c3-ced9-ecb7-fd1348845d00%40dewhirst.com.au
>> <https://groups.google.com/d/msgid/django-users/3b40c474-72c3-ced9-ecb7-fd1348845d00%40dewhirst.com.au?utm_medium=email&utm_source=footer>
>> .
>>
>

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


Re: The SECRET_KEY setting must not be empty - os.environ.get('SECRET_KEY')

2022-03-02 Thread Adeyemi Deji
Thanks Carsten, It's also a great method.
What do u mean by on installation @On installation, the file is then copied
to localconfig.py, where it is *ignored* by svn, git, etc. The file is then
customized for production, development, …

Do u mean during deployment?

On Wed, Mar 2, 2022 at 7:49 AM Carsten Fuchs  wrote:

> Am 02.03.22 um 04:23 schrieb Mike Dewhirst:
> > ... where you write get_secret_key() to pull it from the environment or
> a file somewhere which is not in your repository.
>
> A variant of this that I like is to have a file like localconfig.example
> in the repository next to settings.py that contains e.g.
> DATABASES = ...  # dummy or default config
> SECRET_KEY = 'example'
>
> On installation, the file is then copied to localconfig.py, where it is
> *ignored* by svn, git, etc. The file is then customized for production,
> development, …
>
> In settings.py, there is
>
> from project_dir import localconfig
> # ...
> DEBUG = localconfig.DEBUG
> SECRET_KEY = localconfig.SECRET_KEY
> DATABASES = localconfig.DATABASES
> # ...
>
> This works very well and is simple, safe and convenient.
>
> Best regards,
> Carsten
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/27159e6a-0472-97c5-8816-7c5a46a3eb89%40cafu.de
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEO1GrqUrHfxBL_J1cGHDjjVdbbfciBTpc322%3DZZFOMckcx-qw%40mail.gmail.com.


Re: The SECRET_KEY setting must not be empty - os.environ.get('SECRET_KEY')

2022-03-03 Thread Adeyemi Deji
Thank u so much. A really useful information I never knew existed. Really
appreciate it.



On Thu, 3 Mar 2022, 07:41 Carsten Fuchs,  wrote:

> Am 03.03.22 um 04:43 schrieb Adeyemi Deji:
> > What do u mean by on installation @On installation, the file is then
> copied to localconfig.py, where it is *ignored* by svn, git, etc. The file
> is then customized for production, development, …
> >
> > Do u mean during deployment?
>
> During development, you create two files:
>
> localconfig.example
> This file contains only example data, comments/instructions and
> *irrelevant* data, such as *fake* secret keys, fake database passwords,
> etc. This file is committed to the repository. Its *only* purpose is to
> serve as an example and be copied to filename localconfig.py later.
>
> localconfig.py
> Created from a copy of localconfig.example, during development you must
> make sure that this file is never committed to your repository. This is
> achieved by telling the repository to ignore it, e.g. Git by editing the
> .gitignore file appropriately, Subversion with the svn:ignore property.
> Still during development, you customize the file as needed for development,
> i.e. insert the required database details, DEBUG = True, etc.
>
> For deployment, when you first clone the repository on the production
> server, it will come with the localconfig.example file, but not with the
> localconfig.py file, as intended. As part of the installation, you copy
> localconfig.example to localconfig.py and customize it for production
> (production database, etc.). Done.
>
> Variants of this approach are possible, e.g. keeping the localconfig.py
> file entirely outside of the project directory, where it is in even less
> danger to be accidentally committed. Or to store the values not in a py,
> but in a json, ini, txt, ... file that is loaded and parsed in settings.py.
>
> Best regards,
> Carsten
>
>
> > On Wed, Mar 2, 2022 at 7:49 AM Carsten Fuchs  <mailto:carsten.fu...@cafu.de>> wrote:
> >
> > Am 02.03.22 um 04:23 schrieb Mike Dewhirst:
> > > ... where you write get_secret_key() to pull it from the
> environment or a file somewhere which is not in your repository.
> >
> > A variant of this that I like is to have a file like
> localconfig.example in the repository next to settings.py that contains e.g.
> > DATABASES = ...  # dummy or default config
> > SECRET_KEY = 'example'
> >
> > On installation, the file is then copied to localconfig.py, where it
> is *ignored* by svn, git, etc. The file is then customized for production,
> development, …
> >
> > In settings.py, there is
> >
> > from project_dir import localconfig
> > # ...
> > DEBUG = localconfig.DEBUG
> > SECRET_KEY = localconfig.SECRET_KEY
> > DATABASES = localconfig.DATABASES
> > # ...
> >
> > This works very well and is simple, safe and convenient.
> >
> > Best regards,
> > Carsten
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/08a9d115-235f-3538-70fa-e6e9ecdb404f%40cafu.de
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEO1GrpKsnq4D%3DmyeM%3DVfOSBXVcVwbguZ-hfKQdGJBMFeLmjSw%40mail.gmail.com.


Re: Image Fetching

2022-10-24 Thread Adeyemi Deji
Still not clear, send screenshots of ur code including the template and
settings.py where u configured ur media root. Thanks

On Mon, 24 Oct 2022, 05:32 Chukwudi Onwusa,  wrote:

>
> I am only being able to fetch image registered only through the admin on
> browser user interface. But the one I registered on browser user interface,
> whenever I try fetching it through the user interface, it only shows image
> icon, but if I upon the image in the admin interface it shows me error like
> the one below.
> But the one registered through the admin interface has no error, I have
> done all the do-ables , but yet no positive results
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGoV8nmhGrgGh44z6kUHDHrLo7xRfct%2Bzr07kYb0mmFHLkVuGA%40mail.gmail.com
> 
> .
>

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


Error: pg_config executable not found. (psycopg2 for postgres in docker not successfully installed)

2022-10-28 Thread Adeyemi Deji
Hello Fam!

I'm currently going through djangoforprofessional tutorial and I've been 
trying to resolve an error related to installing psycopg2 for postgres in a 
docker container.

After setting up Dockerfile, requirements.txt, and docker-compose.yml which 
is shown below, I entered this command: docker-compose up -d --build
and the returned output (error) is shown below.

I have tried this command in Dockerfile: RUN pip install --user 
psycopg2==2.9.5 
I got the command on StackOverflow but still didn't resolve the issue.

Thank you very much in advance.

*Error Output*
#0 23.39 Collecting psycopg2==2.9.5
#0 23.55   Downloading psycopg2-2.9.5.tar.gz (384 kB)
#0 25.11  ━ 384.3/384.3 kB 246.3 
kB/s eta 0:00:00
#0 25.20   Preparing metadata (setup.py): started
#0 26.74   Preparing metadata (setup.py): finished with status 'error'
#0 26.78   error: subprocess-exited-with-error
#0 26.78
#0 26.78   × python setup.py egg_info did not run successfully.
#0 26.78   │ exit code: 1
#0 26.78   ╰─> [25 lines of output]
#0 26.78   
/usr/local/lib/python3.12/site-packages/setuptools/config/setupcfg.py:508: 
SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use 
license_files instead.
#0 26.78 warnings.warn(msg, warning_class)
#0 26.78   running egg_info
#0 26.78   creating /tmp/pip-pip-egg-info-g5ko86oj/psycopg2.egg-info
#0 26.78   writing 
/tmp/pip-pip-egg-info-g5ko86oj/psycopg2.egg-info/PKG-INFO
#0 26.78   writing dependency_links to 
/tmp/pip-pip-egg-info-g5ko86oj/psycopg2.egg-info/dependency_links.txt
#0 26.78   writing top-level names to 
/tmp/pip-pip-egg-info-g5ko86oj/psycopg2.egg-info/top_level.txt
#0 26.78   writing manifest file 
'/tmp/pip-pip-egg-info-g5ko86oj/psycopg2.egg-info/SOURCES.txt'
#0 26.78
#0 26.78   Error: pg_config executable not found.
#0 26.78
#0 26.78   pg_config is required to build psycopg2 from source.  Please 
add the directory
#0 26.78   containing pg_config to the $PATH or specify the full 
executable path with the
#0 26.78   option:
#0 26.78
#0 26.78   python setup.py build_ext --pg-config /path/to/pg_config 
build ...
#0 26.78
#0 26.78   or with the pg_config option in 'setup.cfg'.
#0 26.78
#0 26.78   If you prefer to avoid building psycopg2 from source, please 
install the PyPI
#0 26.78   'psycopg2-binary' package instead.
#0 26.78
#0 26.78   For further information please check the 
'doc/src/install.rst' file (also at
#0 26.78   ).
#0 26.78
#0 26.78   [end of output]
#0 26.78
#0 26.78   note: This error originates from a subprocess, and is likely not 
a problem with pip.
#0 26.78 error: metadata-generation-failed
#0 26.78
#0 26.78 × Encountered error while generating package metadata.
#0 26.78 ╰─> See above for output.
#0 26.78
#0 26.78 note: This is an issue with the package mentioned above, not pip.
#0 26.78 hint: See above for details.
--
failed to solve: executor failed running [/bin/sh -c pip install -r 
requirements.txt]: exit code: 1

*requirements.txt file*
asgiref==3.5.2
Django==4.1.2
psycopg2==2.9.5
sqlparse==0.4.3
tzdata==2022.5

*Dockerfile*
# Pull Base Image

FROM python:3.12.0a1-slim-bullseye

# Set Environment Variables

ENV PIP_DISABLE_PIP_VERSION_CHECK 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# Set Work Directory

WORKDIR /code

# Install Dependencies

COPY ./requirements.txt .
RUN pip install -r requirements.txt

# Copy Project

COPY . .

*docker-compose.yml*
version: '3.9'
services:
  web:
build: .
command: python /code/manage.py runserver 0.0.0.0:8000
volumes:
  - .:/code
ports: 
  - "8000:8000"
depends_on:
  - db
  db:
image: postgres:13
volumes:
  - postgres_data:/var/lib/postgresql/data/
environment:
  - "POSTGRES_HOST_AUTH_METHOD=trust"
volumes:
  postgres_data:



C:\Users\adede\wdev\djangoP\django-docker-postgre>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bb79d32c-e0f8-4db1-9e94-e133e61f443bn%40googlegroups.com.


Re: Error: pg_config executable not found. (psycopg2 for postgres in docker not successfully installed)

2022-10-31 Thread Adeyemi Deji

Hello, fam!

Found a solution to the problem. Updated the Dockerfile. Check below

Thanks, guys...

*Dockerfile*

FROM python:3.8.3-slim

ENV PIP_DISABLE_PIP_VERSION_CHECK=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

WORKDIR /code

RUN apt-get update \
&& apt-get -y install libpq-dev gcc

COPY ./requirements.txt .
RUN pip install -r requirements.txt

COPY . .
On Saturday, October 29, 2022 at 1:12:22 PM UTC+1 Kasper Laudrup wrote:

> On 28/10/2022 12.35, Adeyemi Deji wrote:
> > 
> > I have tried this command in Dockerfile: RUN pip install --user 
> > psycopg2==2.9.5
> > I got the command on StackOverflow but still didn't resolve the issue.
> > 
>
> Seems like you need the postgresql development package or similar to 
> build psycopg2 from source. Try using the binary package 
> (psycopg2-binary) instead as suggested here:
>
> > #0 26.78   If you prefer to avoid building psycopg2 from source, 
> > please install the PyPI
> > #0 26.78   'psycopg2-binary' package instead.
>
> Alternatively, ensure the postgresql development package is installed in 
> your Docker container.
>
> Kind regards,
> Kasper Laudrup
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/184a0ed7-609c-4410-860f-ccf0e0c08cccn%40googlegroups.com.


Re: Error: pg_config executable not found. (psycopg2 for postgres in docker not successfully installed)

2022-11-01 Thread Adeyemi Deji
Hi,

I believe the the binary package is suitable for development and I plan
integrating docker in my company's upcoming project, so I needed a package
best for production.

Thanks kasper

On Mon, 31 Oct 2022, 19:51 'Kasper Laudrup' via Django users, <
django-users@googlegroups.com> wrote:

> On 31/10/2022 19.32, Adeyemi Deji wrote:
> >
> > Hello, fam!
> >
> > Found a solution to the problem. Updated the Dockerfile. Check below
> >
>
> Great to hear you figured it out and thanks for sharing. Out of
> curiosity, any reason why you chose to build the psycopg2 package from
> source instead of using a prebuilt binary?
>
> I would assume using the prebuilt binary would have been simpler and of
> course make it much faster to build your container than building your
> own package from source.
>
> Thanks and kind regards,
> Kasper Laudrup
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/fa5906c5-929f-a2b8-91e2-72d8b0fb8194%40stacktrace.dk
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEO1GrqUD-TWOKre3DjLmeZMP%2BZxxP%3DK%2B9%3DdBBjrPi9PmQt5Ow%40mail.gmail.com.


Re: Error: pg_config executable not found. (psycopg2 for postgres in docker not successfully installed)

2022-11-03 Thread Adeyemi Deji
Also, i tried psycopg2-binary ànd still add the same error issue but when i
updated the Dokerfile, things got normal.

On Mon, 31 Oct 2022, 19:51 'Kasper Laudrup' via Django users, <
django-users@googlegroups.com> wrote:

> On 31/10/2022 19.32, Adeyemi Deji wrote:
> >
> > Hello, fam!
> >
> > Found a solution to the problem. Updated the Dockerfile. Check below
> >
>
> Great to hear you figured it out and thanks for sharing. Out of
> curiosity, any reason why you chose to build the psycopg2 package from
> source instead of using a prebuilt binary?
>
> I would assume using the prebuilt binary would have been simpler and of
> course make it much faster to build your container than building your
> own package from source.
>
> Thanks and kind regards,
> Kasper Laudrup
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/fa5906c5-929f-a2b8-91e2-72d8b0fb8194%40stacktrace.dk
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEO1Grrh2TneJ3cBW0wq%3DV%3DeMDdMbp-PWk-nuXNrjHU6-oSh3g%40mail.gmail.com.


Re: it is very hard to find both email and phone number as username to login

2023-02-26 Thread Adeyemi Deji
Y do u need both?

On Sun, 26 Feb 2023, 15:13 Manobhav Joshi,  wrote:

> is there any way to use both email and phone number as username to login
> safely which we can use authenticate() 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/fd5721c4-0a55-48c3-8a1c-5ef75e470e1cn%40googlegroups.com
> 
> .
>

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


Re: INPUT TEXT in grid

2021-09-29 Thread Adeyemi Deji
Based on my observation. Your form doesn't have it's href attribute,
secondly in the view, the function should ve a post method and not get,
thirdly back to the template, u should have a name attribute for ur input
tag which u do but the value should be an arbitrary name or any name of ur
choice as a string which u will use to reference in the view function.

Little modification to ur view function:
To reference the input name attribute lets give it a value called para.

def parasalidaView(request):
if request.method == 'POST'
parasalida = Parasalida.objects.all()
a_prueba = []
for cue in parasalida:
data = request.POST.get('para')
a_prueba.append(data)



On Wed, 29 Sep 2021, 00:38 David Nugent,  wrote:

> Request.GET can't apply when processing a POST request.
>
> You are quoting 'cur.id_reg' when accessing the GET (should be POST)
> params and it probably should not be - you need to access the "name"
> attribute that your form uses. You should also be using cleaned_data
>  after using proper
> form validation, and in this case you should probably be using a formset
>  instead of
> manually generating a multiple record input form.
>
> HTH, David
>
> On Wed, Sep 29, 2021 at 7:15 AM Gabriel Araya Garcia <
> gabrielaraya2...@gmail.com> wrote:
>
>> I have one grid
>>
>> 
>>
>> {% for pr in parasalida %}
>>   
>> {{ pr.estado}}
>> {{ pr.fecha_ing|date:'d-m-Y'}}
>> {{ pr.lote}}
>> {{ pr.oc_ascoex}}
>> {{ pr.cantidad}}
>> {{ pr.extraida}}
>> > class='saca' value="{{saca_x}}" placeholder='0'/>
>>
>>   
>> {% endfor %}
>>
>> but, I don't know how to get the value in view:
>>
>> parasalida = Parasalida.objects.all()
>> a_prueba = []
>> for cur in parasalida:
>> saca_x = request.GET.get('cur.id_reg') #  template's value
>> according to name property
>> a_prueba.append(saca_x)
>>
>> The list is full with  [None,None,None,..]
>>
>> All others fields are already with values. The only values that user
>> input is "input text"
>>
>> Thank for your help
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/a2ba10d5-639e-4a08-88fe-a4206e18c249n%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAE5VhgWG3AjQD_vASX%3DG%2BpgmNdg9FVc6VSEn-dCf%3DjiNuPncwQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEO1GrpnOMyRwF6STzc89_HNSabJdt-_Gmz3c-U5ZpR6ja9Q-A%40mail.gmail.com.


Re: You're accessing the development server over HTTPS, but it only supports HTTP.

2021-09-30 Thread Adeyemi Deji
Make sure debug is set to True in settings.py file. allowed host should be
an empty list

On Thu, 30 Sep 2021, 10:43 emmanuel odor,  wrote:

> Hi Everyone,
>
> I tried to run Django micro crm locally on my windows host and  whenever i
> run this on my browser i get these errors below.
>
> Starting development server at http://127.0.0.1:8000/
> Quit the server with CTRL-BREAK.
> [30/Sep/2021 10:40:04] code 400, message Bad request version
> ('**\x13\x01\x13\x02\x13\x03À+À/À,À0̨̩À\x13À\x14\x00\x9c\x00\x9d\x00/\x005\x01\x00\x01\x93úú\x00\x00\x00\x17\x00\x00ÿ\x01\x
> 00\x01\x00\x00')
> [30/Sep/2021 10:40:04] You're accessing the development server over HTTPS,
> but it only supports HTTP.
>
> [30/Sep/2021 10:40:04] code 400, message Bad request version
> ('úú\x13\x01\x13\x02\x13\x03À+À/À,À0̨̩À\x13À\x14\x00\x9c\x00\x9d\x00/\x005\x01\x00\x01\x93ÚÚ\x00\x00\x00\x17\x00\x00ÿ\x01\x
> 00\x01\x00\x00')
> [30/Sep/2021 10:40:04] You're accessing the development server over HTTPS,
> but it only supports HTTP.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/35a1ec5c-3b6e-4a3b-9d10-b3e1f8b48c94n%40googlegroups.com
> 
> .
>

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


Re: INPUT TEXT in grid

2021-10-03 Thread Adeyemi Deji
Good to know that you now understand why ur code wasn't working and you
have learnt from asking questions. We always here for you. Peace

On Sun, Oct 3, 2021, 1:44 AM Gabriel Araya Garcia <
gabrielaraya2...@gmail.com> wrote:

> Thanks for your help, My problem I've solved. David Nugent says that the
> template must be built with using 'POST', and also the grid (table) is from
> database table, then the name  in each row I put the ID (numeric),
> therefore in view get the value with:
> valor_saca = request.POST.get(str(sigma.id_reg)) # obligadamente debe ser
> string
> Here is important the 'str', it must be string (chracter, or no numeric)
>
> (Excuse me my english )
> Regards
>
>
> El miércoles, 29 de septiembre de 2021 a las 16:58:11 UTC-3,
> adeyem...@gmail.com escribió:
>
>> Based on my observation. Your form doesn't have it's href attribute,
>> secondly in the view, the function should ve a post method and not get,
>> thirdly back to the template, u should have a name attribute for ur input
>> tag which u do but the value should be an arbitrary name or any name of ur
>> choice as a string which u will use to reference in the view function.
>>
>> Little modification to ur view function:
>> To reference the input name attribute lets give it a value called para.
>>
>> def parasalidaView(request):
>> if request.method == 'POST'
>> parasalida = Parasalida.objects.all()
>> a_prueba = []
>> for cue in parasalida:
>> data = request.POST.get('para')
>> a_prueba.append(data)
>>
>>
>>
>> On Wed, 29 Sep 2021, 00:38 David Nugent,  wrote:
>>
>>> Request.GET can't apply when processing a POST request.
>>>
>>> You are quoting 'cur.id_reg' when accessing the GET (should be POST)
>>> params and it probably should not be - you need to access the "name"
>>> attribute that your form uses. You should also be using cleaned_data
>>>  after using
>>> proper form validation, and in this case you should probably be using a f
>>> ormset  
>>> instead
>>> of manually generating a multiple record input form.
>>>
>>> HTH, David
>>>
>>> On Wed, Sep 29, 2021 at 7:15 AM Gabriel Araya Garcia <
>>> gabriela...@gmail.com> wrote:
>>>
 I have one grid

 

 {% for pr in parasalida %}
   
 {{ pr.estado}}
 {{ pr.fecha_ing|date:'d-m-Y'}}
 {{ pr.lote}}
 {{ pr.oc_ascoex}}
 {{ pr.cantidad}}
 {{ pr.extraida}}
 >>> name='{{pr.id_reg}}' class='saca' value="{{saca_x}}" placeholder='0'/>

   
 {% endfor %}

 but, I don't know how to get the value in view:

 parasalida = Parasalida.objects.all()
 a_prueba = []
 for cur in parasalida:
 saca_x = request.GET.get('cur.id_reg') #  template's value
 according to name property
 a_prueba.append(saca_x)

 The list is full with  [None,None,None,..]

 All others fields are already with values. The only values that user
 input is "input text"

 Thank for your help

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/a2ba10d5-639e-4a08-88fe-a4206e18c249n%40googlegroups.com
 
 .

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAE5VhgWG3AjQD_vASX%3DG%2BpgmNdg9FVc6VSEn-dCf%3DjiNuPncwQ%40mail.gmail.com
>>> 
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6ffed308-dcbb-4849-b67d-7ac2878b82cbn%40googlegroups.c

Re: Django Query

2021-10-05 Thread Adeyemi Deji
You can read up the documentation regarding MPTT, sure to be useful.
https://django-mptt.readthedocs.io/en/latest

On Tuesday, October 5, 2021 at 10:05:42 AM UTC+2 eugenet...@gmail.com wrote:

> Is there any one with a typical example or tutorial  (of Django mptt) that 
> tolks on the similar  issue as mine and share with me? 
>
> regards, 
>
> On Tue, 5 Oct 2021 at 01:00, Sebastian Jung  wrote:
>
>> Hello Eugene,
>>
>> I think that django mptt can Store and display such a tree.
>>
>> Regards
>>
>> Eugene TUYIZERE  schrieb am Mo., 4. Okt. 2021, 
>> 20:29:
>>
> Team,
>>>
>>> Assume you have 3 tables PROVINCES, DISTRICTS, and SECTORS and you have 
>>> Province, District and Sector field names respectively in each table. 
>>>
>>> How can you display in the Django template the following table?
>>>
>>> Province District Sectors 
>>> A A1 A11 
>>> A12 
>>> A2 A21 
>>> A22 
>>> A3 A31 
>>> A32 
>>>
>>> Any assistance will be appreciated
>>> -- 
>>>
>> *TUYIZERE Eugene*
>>>
>>>
>>>
>>> Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38
>>>
>> -- 
>>> You received this message because you are subscribed 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 view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/CABxpZHsGxujwVUp3NEXBWjBnOahYuPOBZccU8O%2BvejowDYxxvg%40mail.gmail.com
>>>  
>>> 
>>> .
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAKGT9mwz%3D0FA27Yr8xxiZPK6O4v9t1CwVFXNtr3DMK-xxobmKw%40mail.gmail.com
>>  
>> 
>> .
>>
>
>
> -- 
> *TUYIZERE Eugene*
>
>
>
> *Msc Degree in Mathematical Science*
>
> *African Institute for Mathematical Sciences (AIMS Cameroon)Crystal 
> Garden-Lime, Cameroon*
>
> Bsc in Computer Science
>
> *UR-Nyagatare Campus*
>
> Email: eugene@aims-cameroon.org
>eugenet...@gmail.com
>
> Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bd62dc5d-1b53-4dbd-bbba-0b36c30679een%40googlegroups.com.


Re: from excel to postgesql

2021-10-05 Thread Adeyemi Deji
Hello, sure the link below will solve your problem.
https://pythoncircle.com/post/591/how-to-upload-and-process-the-excel-file-in-django/

On Tuesday, October 5, 2021 at 5:30:36 AM UTC+2 nader...@gmail.com wrote:

> I have a site on heroku up and running, database postgresql, the models 
> have a lot of relations.
> I want to add data from excel file about 400 excel rows by code in django.
>
> How can I access the excel file to read the data? or suggest another way 
> for the job to be done.
>
> Thanks for your help.
>
> Nader
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/14704a8a-7d78-4f10-b18d-c767d78ab218n%40googlegroups.com.


Re: How to port a Django web app in mobile (iOS & Android)

2021-10-05 Thread Adeyemi Deji
Hello, I'm not sure if this will work but it seems to relate to what you 
are trying to achieve. follow link below
https://www.quora.com/How-do-we-convert-the-Django-web-application-into-an-Android-app

On Tuesday, October 5, 2021 at 5:38:31 AM UTC+2 ram.mu...@gmail.com wrote:

> Hi,
>
> We have a working WebApp developed with Django, Python and Vue.Js. The 
> application is working ok when it is opened in Mobile devices but we need 
> to do lot of tweaking UI to make it compatible to mobile devices everytime. 
> So we are looking for a way to create a mobile app and also need to update 
> the data irrespective of device that users use. Please let us know whether 
> this can be achievable?
>
> Best regards,
> ~Ram
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/51e8aaf0-e7f5-44c8-8742-b7368e215eb0n%40googlegroups.com.


Re: New to Django

2021-10-05 Thread Adeyemi Deji
Hi, I started roughly too. Began paying attention as it started getting 
interesting. Django documentation was actually wat got me started but 
before that I went through some pdfs, had a lot of that on my pc. The poll 
app in django documentation really helped, don't think I would be where I 
am today if I didn't go through building the poll app as I walk through the 
documentation. Also there is this guy on youtube, don't know if you have 
heard of Dennis Ivy, he is really awesome, his story really got me and I 
have never forgotten it till 
date. https://www.youtube.com/channel/UCTZRcDjjkVajGL6wd76UnGg

On Saturday, October 2, 2021 at 5:09:04 AM UTC+2 richluet...@gmail.com 
wrote:

> Hi, I want to learn django very well but tutorials like youtube videos, 
> books and pay for online courses are not really satisfying me that much . 
> So if I decide to learn django directly from the documentation will I learn 
> good enough to Intermediate and Advance level ?  if yes please help me with 
> an order path to follow. 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/04006489-2726-4dea-b4cf-bd174ee96b7fn%40googlegroups.com.


Re: How to show views when an endpoint is called

2021-10-05 Thread Adeyemi Deji
Hi, what you are trying to achieve isn't clear to me. Kindly elaborate pls

On Sunday, October 3, 2021 at 4:30:31 AM UTC+2 iroegbu...@gmail.com wrote:

> Hello guys, thanks for helping the last time.
> I am trying to show course views on django admin.  Django is serving as an 
> API to a flutter app
>
> Am i to create another endpoint to count views? 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d8a2-ace5-4360-812f-fcb9bd21208fn%40googlegroups.com.


Re: TemplateDoesNotExist at /catalog/books/

2021-10-06 Thread Adeyemi Deji
Hi, I observed that you didn't specify the template name attribute for the 
BookListView and BookDetailView, that should solve you problem.

On Tuesday, October 5, 2021 at 10:37:19 PM UTC+2 nazni...@gmail.com wrote:

> Hello!
> I’m beginner in Django. I do Django Tutorial from Mozilla.
> I get TemplateDoesNotExist at /catalog/books/ . Could you help me?. I 
> don’t understand how to resolve it.
>
> */catalog/urls*
>
> from django.urls import path
>
> from . import views
>
> urlpatterns = [
>
> path('', views.index, name='index'),
>
> path('books/', views.BookListView.as_view(), name='books'),
>
> path('book/', views.BookDetailView.as_view(), 
> name='book-detail'),
>
> ]
>
> *catalog/models*
>
> # Used to generate URLs by reversing the URL patterns
>
> from django.urls import reverse
>
> from django.db import models
>
> from django.urls import reverse
>
> import uuid
>
> # Create your models here
>
> class Genre(models.Model):
>
> """Model representing a book genre (e.g. Science Fiction, Non 
> Fiction)."""
>
> name = models.CharField(
>
> max_length=200,
>
> help_text="Enter a book genre (e.g. Science Fiction, French Poetry 
> etc.)"
>
> )
>
> def __str__(self):
>
> """String for representing the Model object (in Admin site etc.)"""
>
> return self.name
>
> class Book(models.Model):
>
> """Model representing a book (but not a specific copy of a book)."""
>
> title = models.CharField(max_length=200)
>
> author = models.ForeignKey('Author', on_delete=models.SET_NULL, 
> null=True)
>
> # Foreign Key used because book can only have one author, but authors 
> can have multiple books
>
> # Author as a string rather than object because it hasn't been 
> declared yet in file.
>
> summary = models.TextField(
>
> max_length=1000, help_text="Enter a brief description of the book")
>
> isbn = models.CharField('ISBN', max_length=13,
>
> unique=True,
>
> help_text='13 Character https://www.isbn-international.org/content/what-isbn'
>
>   '">ISBN number')
>
> genre = models.ManyToManyField(
>
> Genre, help_text="Select a genre for this book")
>
> # ManyToManyField used because a genre can contain many books and a 
> Book can cover many genres.
>
> # Genre class has already been defined so we can specify the object 
> above.
>
> language = models.ForeignKey(
>
> 'Language', on_delete=models.SET_NULL, null=True)
>
> class Meta:
>
> ordering = ['title', 'author']
>
> def display_genre(self):
>
> """Creates a string for the Genre. This is required to display 
> genre in Admin."""
>
> return ', '.join([genre.name for genre in self.genre.all()[:3]])
>
> display_genre.short_description = 'Genre'
>
> def get_absolute_url(self):
>
> """Returns the url to access a particular book instance."""
>
> return reverse('book-detail', args=[str(self.id)])
>
> def __str__(self):
>
> """String for representing the Model object."""
>
> return self.title
>
> class Language(models.Model):
>
> name = models.CharField(
>
> max_length=50, help_text="Enter the book's natural language (e.g. 
> English, French, Japanese etc.)")
>
> def __str__(self):
>
> return self.name
>
> class BookInstance(models.Model):
>
> id = models.UUIDField(primary_key=True, default=uuid.uuid4,
>
>   help_text="Unique ID for this particular book 
> across whole library")
>
> book = models.ForeignKey('Book', on_delete=models.SET_NULL, null=True)
>
> imprint = models.CharField(max_length=200)
>
> due_back = models.DateField(null=True, blank=True)
>
> LOAN_STATUS = (
>
> ('m', 'Maintenance'),
>
> ('o', 'On loan'),
>
> ('a', 'Available'),
>
> ('r', 'Reserved'),
>
> )
>
> status = models.CharField(max_length=1, choices=LOAN_STATUS,
>
>   blank=True, default='m', help_text='Book 
> availability')
>
> class Meta:
>
> ordering = ["due_back"]
>
> def __str__(self):
>
> """
>
> String for representing the Model object
>
> """
>
> return '%s (%s)' % (self.id, self.book.title)
>
> class Author(models.Model):
>
> """
>
> Model representing an author.
>
> """
>
> first_name = models.CharField(max_length=100)
>
> last_name = models.CharField(max_length=100)
>
> date_of_birth = models.DateField(null=True, blank=True)
>
> date_of_death = models.DateField('Died', null=True, blank=True)
>
>
> def get_absolute_url(self):
>
> """
>
> Returns the url to access a particular author instance.
>
> """
>
> return reverse('author-detail', args=[str(self.id)])
>
>
> def __str__(self):
>
> """
>
> String for representing the Model object.
>
>

Re: ModuleNotFoundError: No module named 'tempfile'

2021-10-06 Thread Adeyemi Deji
First of all, what text editor do you use, If not visual studio code I
recommend you get that one and learn how to use it, then u can always set
the python interpreter based on your choice. Secondly u need a virtual
environment and you can get that with (python -m venv venv) then activate
it by changing directory to the directory where the venv folder exist and
do this (call venv/scripts/activate) after that you can start using pip to
install libraries by using (pip install libraryName), some libraries
require you to add into the installed app list in your django project
settings.py file for example the tempfile. This should solve your problem.
If not, there are great developers out there that will be willing to help
you out.

On Tue, Oct 5, 2021 at 10:44 PM Kasper Laudrup 
wrote:

> On 05/10/2021 17.20, Olalekan Alashe wrote:
> > Pls ,How can i fixed this error (ModuleNotFoundError: No module named
> > 'tempfile').i wanted to install Django with this command "python -m pip
> > installs Django" .I have python 3.8,3.7.3.9 on my system.
> >
>
> The tempfile module is part of the Python standard library:
>
> https://docs.python.org/3/library/tempfile.html
>
> I would guess you have somehow messed up your Python installation(s),
> but without any further information it's really hard to help you.
>
> How did you install three different Python versions and how do you
> select which one to run?
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2f69b7fb-67bf-db15-0585-639b1aac9911%40stacktrace.dk
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEO1GroYU%2BpEp43UUdb6tttTasyf%3DHvgnhcnDNt-Ymxe9QhXyQ%40mail.gmail.com.


Re: Keycloak & Django Setup Error - "UNIQUE constraint failed: auth_user.username" & usernames are being hashed

2021-10-06 Thread Adeyemi Deji
Hi, can you make a snapshot of your models.py file?

On Wednesday, October 6, 2021 at 7:26:24 AM UTC+2 abubak...@gmail.com wrote:

> you're facing this error because django receives nique usernames. so you 
> are not allowed to create another username with the same username.
>
> On Wed, Oct 6, 2021 at 1:36 AM Ammon Quackenbush  
> wrote:
>
>>
>> I am setting up keycloak for a django project and this is the error I 
>> receive:
>>
>>
>> IntegrityError at /oidccallback/UNIQUE constraint failed: 
>> auth_user.usernameRequest Method:
>> GET
>>
>> It looks like when I log in, keycloak tries to create my user again, even 
>> though my user is in the database.
>>
>> Also, my usernames are hashed in the auth_user table in the database.
>>
>> This is my code in my settings.py:
>>
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.sqlite3',
>> 'NAME': BASE_DIR / 'db.sqlite3',
>> }
>> }
>>
>> I also tried setting the OIDC_CREATE_USER setting to False but that only 
>> prevented django from from detecting login sessions (which still were 
>> created properly).
>>
>> Any ideas on what is going wrong and how I can fix it?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/6be23087-ab54-4bfb-8a57-1bc8fbe35359n%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/58ec90a1-bd77-47fa-82d2-a9098eea28f1n%40googlegroups.com.


Re: TemplateDoesNotExist at /catalog/books/

2021-10-06 Thread Adeyemi Deji
for example.

class AboutView(TemplateView):
template_name = "about.html"


On Wed, Oct 6, 2021 at 11:32 AM Никита Назаров 
wrote:

> Hello!
> Thank you!
> I'm sorry. How could I do this?
>
> среда, 6 октября 2021 г. в 11:20:19 UTC+3, adeyem...@gmail.com:
>
>> Hi, I observed that you didn't specify the template name attribute for
>> the BookListView and BookDetailView, that should solve you problem.
>>
>> On Tuesday, October 5, 2021 at 10:37:19 PM UTC+2 nazni...@gmail.com
>> wrote:
>>
>>> Hello!
>>> I’m beginner in Django. I do Django Tutorial from Mozilla.
>>> I get TemplateDoesNotExist at /catalog/books/ . Could you help me?. I
>>> don’t understand how to resolve it.
>>>
>>> */catalog/urls*
>>>
>>> from django.urls import path
>>>
>>> from . import views
>>>
>>> urlpatterns = [
>>>
>>> path('', views.index, name='index'),
>>>
>>> path('books/', views.BookListView.as_view(), name='books'),
>>>
>>> path('book/', views.BookDetailView.as_view(),
>>> name='book-detail'),
>>>
>>> ]
>>>
>>> *catalog/models*
>>>
>>> # Used to generate URLs by reversing the URL patterns
>>>
>>> from django.urls import reverse
>>>
>>> from django.db import models
>>>
>>> from django.urls import reverse
>>>
>>> import uuid
>>>
>>> # Create your models here
>>>
>>> class Genre(models.Model):
>>>
>>> """Model representing a book genre (e.g. Science Fiction, Non
>>> Fiction)."""
>>>
>>> name = models.CharField(
>>>
>>> max_length=200,
>>>
>>> help_text="Enter a book genre (e.g. Science Fiction, French
>>> Poetry etc.)"
>>>
>>> )
>>>
>>> def __str__(self):
>>>
>>> """String for representing the Model object (in Admin site
>>> etc.)"""
>>>
>>> return self.name
>>>
>>> class Book(models.Model):
>>>
>>> """Model representing a book (but not a specific copy of a book)."""
>>>
>>> title = models.CharField(max_length=200)
>>>
>>> author = models.ForeignKey('Author', on_delete=models.SET_NULL,
>>> null=True)
>>>
>>> # Foreign Key used because book can only have one author, but
>>> authors can have multiple books
>>>
>>> # Author as a string rather than object because it hasn't been
>>> declared yet in file.
>>>
>>> summary = models.TextField(
>>>
>>> max_length=1000, help_text="Enter a brief description of the
>>> book")
>>>
>>> isbn = models.CharField('ISBN', max_length=13,
>>>
>>> unique=True,
>>>
>>> help_text='13 Character https://www.isbn-international.org/content/what-isbn'
>>>
>>>   '">ISBN number')
>>>
>>> genre = models.ManyToManyField(
>>>
>>> Genre, help_text="Select a genre for this book")
>>>
>>> # ManyToManyField used because a genre can contain many books and a
>>> Book can cover many genres.
>>>
>>> # Genre class has already been defined so we can specify the object
>>> above.
>>>
>>> language = models.ForeignKey(
>>>
>>> 'Language', on_delete=models.SET_NULL, null=True)
>>>
>>> class Meta:
>>>
>>> ordering = ['title', 'author']
>>>
>>> def display_genre(self):
>>>
>>> """Creates a string for the Genre. This is required to display
>>> genre in Admin."""
>>>
>>> return ', '.join([genre.name for genre in self.genre.all()[:3]])
>>>
>>> display_genre.short_description = 'Genre'
>>>
>>> def get_absolute_url(self):
>>>
>>> """Returns the url to access a particular book instance."""
>>>
>>> return reverse('book-detail', args=[str(self.id)])
>>>
>>> def __str__(self):
>>>
>>> """String for representing the Model object."""
>>>
>>> return self.title
>>>
>>> class Language(models.Model):
>>>
>>> name = models.CharField(
>>>
>>> max_length=50, help_text="Enter the book's natural language
>>> (e.g. English, French, Japanese etc.)")
>>>
>>> def __str__(self):
>>>
>>> return self.name
>>>
>>> class BookInstance(models.Model):
>>>
>>> id = models.UUIDField(primary_key=True, default=uuid.uuid4,
>>>
>>>   help_text="Unique ID for this particular book
>>> across whole library")
>>>
>>> book = models.ForeignKey('Book', on_delete=models.SET_NULL,
>>> null=True)
>>>
>>> imprint = models.CharField(max_length=200)
>>>
>>> due_back = models.DateField(null=True, blank=True)
>>>
>>> LOAN_STATUS = (
>>>
>>> ('m', 'Maintenance'),
>>>
>>> ('o', 'On loan'),
>>>
>>> ('a', 'Available'),
>>>
>>> ('r', 'Reserved'),
>>>
>>> )
>>>
>>> status = models.CharField(max_length=1, choices=LOAN_STATUS,
>>>
>>>   blank=True, default='m', help_text='Book
>>> availability')
>>>
>>> class Meta:
>>>
>>> ordering = ["due_back"]
>>>
>>> def __str__(self):
>>>
>>> """
>>>
>>> String for representing the Model object
>>>
>>> """
>>>
>>> return '%s (%s)' % (self.id, self.book.title)
>>>
>>> class Author(m

Re: ModuleNotFoundError: No module named 'tempfile'

2021-10-06 Thread Adeyemi Deji
Oh, I didn't get that talk about tempfile but I do now, thanks. Since
installation is the issue, y not delete and reinstall  python latest version

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Wed, Oct 6, 2021 at 11:56 AM Kasper Laudrup 
wrote:

> I think you replied to the wrong post here, but anyway:
>
> On 06/10/2021 10.57, Adeyemi Deji wrote:
> > First of all, what text editor do you use, If not visual studio code I
> > recommend you get that one and learn how to use it, then u can always
> > set the python interpreter based on your choice.
>
> I don't see how a text editor is relevant for the problem here. Sure,
> some kind of Python IDE might help, but since the poster I assume you
> wanted to reply to already mentioned having installed three different
> Python versions I don't think there's any reason to make things more
> complicated by starting to discuss editors/IDEs. Would be relevant to
> know *how* these Python versions were installed since that very much
> sounds like that could be the cause of the problem.
>
> I use Emacs BTW. :-)
>
> > Secondly u need a
> > virtual environment and you can get that with (python -m venv venv) then
> > activate it by changing directory to the directory where the venv folder
> > exist and do this (call venv/scripts/activate) after that you can start
> > using pip to install libraries by using (pip install libraryName), some
> > libraries require you to add into the installed app list in your django
> > project settings.py file for example the tempfile. This should solve
> > your problem. If not, there are great developers out there that will be
> > willing to help you out.
> >
>
> That's all true and great, but as I wrote, tempfile is part of the
> Python standard library so no reason to look into pip or installed apps
> in Django. It sounds much more like a problem with the Python
> installation(s).
>
> Thanks anyway and kind regards,
>
> Kasper Laudrup
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f0ed1393-625e-c1ce-7202-8847968343fb%40stacktrace.dk
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEO1GrpfK%3D2TSep%2Boe8V6dahxTvkPf6MqwDRY%2B4mq37zArA%3Diw%40mail.gmail.com.


Re: TemplateDoesNotExist at /catalog/books/

2021-10-06 Thread Adeyemi Deji
Please don't change your formal code setting, just add the template_name
attribute and specify the template you are referring to
just add this to your former code:
template_name = "catalog/book_list.html"

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Wed, Oct 6, 2021 at 1:09 PM Никита Назаров  wrote:

> It doesn't seem to work. I wrote your example in views.py.
> Or I might make mistakes. Could you see?
>
> views. py
> from .models import Book, Author, BookInstance, Genre
> from django.views import generic
> from django.shortcuts import render
> from django.views.generic.base import TemplateView
>
> # Create your views here.
>
>
> def index(request):
> """View function for home page of site."""
>
> # Generate counts of some of the main objects
> num_books = Book.objects.all().count()
> num_instances = BookInstance.objects.all().count()
>
> # Available books (status = 'a')
> num_instances_available = BookInstance.objects.filter(
> status__exact='a').count()
>
> # The 'all()' is implied by default.
> num_authors = Author.objects.count()
>
> context = {
> 'num_books': num_books,
> 'num_instances': num_instances,
> 'num_instances_available': num_instances_available,
> 'num_authors': num_authors,
> }
>
> # Render the HTML template index.html with the data in the context variable
> return render(request, 'catalog/index.html', context=context)
>
>
> class BookListView(TemplateView):
> template_name = "catalog/book_list.html"
>
>
> class BookDetailView(TemplateView):
> template_name = "catalog/book_detail.html"
>
>
> urls.py
> from django.urls import path
> from . import views
>
>
> urlpatterns = [
> path('', views.index, name='index'),
> path('books/', views.BookListView.as_view(), name='books'),
> path('book/', views.BookDetailView.as_view(), name='book-detail'),
> ]
>
>
>
>
> ср, 6 окт. 2021 г. в 12:45, Adeyemi Deji :
>
>> for example.
>>
>> class AboutView(TemplateView):
>> template_name = "about.html"
>>
>>
>> On Wed, Oct 6, 2021 at 11:32 AM Никита Назаров 
>> wrote:
>>
>>> Hello!
>>> Thank you!
>>> I'm sorry. How could I do this?
>>>
>>> среда, 6 октября 2021 г. в 11:20:19 UTC+3, adeyem...@gmail.com:
>>>
>>>> Hi, I observed that you didn't specify the template name attribute for
>>>> the BookListView and BookDetailView, that should solve you problem.
>>>>
>>>> On Tuesday, October 5, 2021 at 10:37:19 PM UTC+2 nazni...@gmail.com
>>>> wrote:
>>>>
>>>>> Hello!
>>>>> I’m beginner in Django. I do Django Tutorial from Mozilla.
>>>>> I get TemplateDoesNotExist at /catalog/books/ . Could you help me?. I
>>>>> don’t understand how to resolve it.
>>>>>
>>>>> */catalog/urls*
>>>>>
>>>>> from django.urls import path
>>>>>
>>>>> from . import views
>>>>>
>>>>> urlpatterns = [
>>>>>
>>>>> path('', views.index, name='index'),
>>>>>
>>>>> path('books/', views.BookListView.as_view(), name='books'),
>>>>>
>>>>> path('book/', views.BookDetailView.as_view(),
>>>>> name='book-detail'),
>>>>>
>>>>> ]
>>>>>
>>>>> *catalog/models*
>>>>>
>>>>> # Used to generate URLs by reversing the URL patterns
>>>>>
>>>>> from django.urls import reverse
>>>>>
>>>>> from django.db import models
>>>>>
>>>>> from django.urls import reverse
>>>>>
>>>>> import uuid
>>>>>
>>>>> # Create your models here
>>>>>
>>>>> class Genre(models.Model):
>>>>>
>>>>> """Model representing a book genre (e.g. Science Fiction, Non
>>>>> Fiction)."""
>>>>>

Re: TemplateDoesNotExist at /catalog/books/

2021-10-06 Thread Adeyemi Deji
class BookListView(generic.ListView):

"""Generic class-based view for a list of books."""

model = Book

paginate_by = 10

template_name = "catalog/book_list.html"

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Wed, Oct 6, 2021 at 1:21 PM Adeyemi Deji  wrote:

> Please don't change your formal code setting, just add the template_name
> attribute and specify the template you are referring to
> just add this to your former code:
> template_name = "catalog/book_list.html"
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
>  Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
> <#m_2104138296797754165_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> On Wed, Oct 6, 2021 at 1:09 PM Никита Назаров 
> wrote:
>
>> It doesn't seem to work. I wrote your example in views.py.
>> Or I might make mistakes. Could you see?
>>
>> views. py
>> from .models import Book, Author, BookInstance, Genre
>> from django.views import generic
>> from django.shortcuts import render
>> from django.views.generic.base import TemplateView
>>
>> # Create your views here.
>>
>>
>> def index(request):
>> """View function for home page of site."""
>>
>> # Generate counts of some of the main objects
>> num_books = Book.objects.all().count()
>> num_instances = BookInstance.objects.all().count()
>>
>> # Available books (status = 'a')
>> num_instances_available = BookInstance.objects.filter(
>> status__exact='a').count()
>>
>> # The 'all()' is implied by default.
>> num_authors = Author.objects.count()
>>
>> context = {
>> 'num_books': num_books,
>> 'num_instances': num_instances,
>> 'num_instances_available': num_instances_available,
>> 'num_authors': num_authors,
>> }
>>
>> # Render the HTML template index.html with the data in the context
>> variable
>> return render(request, 'catalog/index.html', context=context)
>>
>>
>> class BookListView(TemplateView):
>> template_name = "catalog/book_list.html"
>>
>>
>> class BookDetailView(TemplateView):
>> template_name = "catalog/book_detail.html"
>>
>>
>> urls.py
>> from django.urls import path
>> from . import views
>>
>>
>> urlpatterns = [
>> path('', views.index, name='index'),
>> path('books/', views.BookListView.as_view(), name='books'),
>> path('book/', views.BookDetailView.as_view(), name='book-detail'
>> ),
>> ]
>>
>>
>>
>>
>> ср, 6 окт. 2021 г. в 12:45, Adeyemi Deji :
>>
>>> for example.
>>>
>>> class AboutView(TemplateView):
>>> template_name = "about.html"
>>>
>>>
>>> On Wed, Oct 6, 2021 at 11:32 AM Никита Назаров 
>>> wrote:
>>>
>>>> Hello!
>>>> Thank you!
>>>> I'm sorry. How could I do this?
>>>>
>>>> среда, 6 октября 2021 г. в 11:20:19 UTC+3, adeyem...@gmail.com:
>>>>
>>>>> Hi, I observed that you didn't specify the template name attribute for
>>>>> the BookListView and BookDetailView, that should solve you problem.
>>>>>
>>>>> On Tuesday, October 5, 2021 at 10:37:19 PM UTC+2 nazni...@gmail.com
>>>>> wrote:
>>>>>
>>>>>> Hello!
>>>>>> I’m beginner in Django. I do Django Tutorial from Mozilla.
>>>>>> I get TemplateDoesNotExist at /catalog/books/ . Could you help me?. I
>>>>>> don’t understand how to resolve it.
>>>>>>
>>>>>> */catalog/urls*
>>>>>>
>>>>>> from django.urls import path
>>>>>>
>>>>>> from . import views
>>>>>>
>>>>>> urlpatterns = [
>>>>>>
>>>>>>   

Re: TemplateDoesNotExist at /catalog/books/

2021-10-06 Thread Adeyemi Deji
Please correct your class views, you are getting it wrong.
it should look like this.

class BookListView(generic.ListView):
model = Book
paginated_by = 10
template_name = "catalog/book_list.html"

class BookDetailView(generic.DetailView):
model = Book
template_name = "catalog/book_detail.html"

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Wed, Oct 6, 2021 at 3:09 PM Никита Назаров  wrote:

> It also doesn't work. I see this error :"TemplateDoesNotExist at
> /catalog/books/ catalog/book_list.html, catalog/book_list.html"
> My views.py is below.
> Also, I checked on GitHub Mozilla (
> https://github.com/mdn/django-locallibrary-tutorial/blob/master/catalog/views.py).
> They didn't use - template_name.
> I'm completely confused.
>
> from .models import Book, Author, BookInstance, Genre
> from django.views import generic
> from django.shortcuts import render
> from django.views.generic.base import TemplateView
>
> # Create your views here.
>
>
> def index(request):
> """View function for home page of site."""
>
> # Generate counts of some of the main objects
> num_books = Book.objects.all().count()
> num_instances = BookInstance.objects.all().count()
>
> # Available books (status = 'a')
> num_instances_available = BookInstance.objects.filter(
> status__exact='a').count()
>
> # The 'all()' is implied by default.
> num_authors = Author.objects.count()
>
> context = {
> 'num_books': num_books,
> 'num_instances': num_instances,
> 'num_instances_available': num_instances_available,
> 'num_authors': num_authors,
> }
>
> # Render the HTML template index.html with the data in the context variable
> return render(request, 'index.html', context=context)
>
>
> class BookListView(generic.ListView):
>
> """Generic class-based view for a list of books."""
>
> model = Book
> paginate_by = 10
> template_name = "catalog/book_list.html"
>
>
> class BookDetailView(generic.DetailView):
>
> """Generic class-based detail view for a book."""
> model = Book
> template_name = "catalog/book_detail.html"
>
>
>
> ср, 6 окт. 2021 г. в 14:24, Adeyemi Deji :
>
>> class BookListView(generic.ListView):
>>
>> """Generic class-based view for a list of books."""
>>
>> model = Book
>>
>> paginate_by = 10
>>
>> template_name = "catalog/book_list.html"
>>
>>
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
>>  Virus-free.
>> www.avast.com
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
>> <#m_8455319138707163929_m_3791702616293114032_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>
>> On Wed, Oct 6, 2021 at 1:21 PM Adeyemi Deji 
>> wrote:
>>
>>> Please don't change your formal code setting, just add the template_name
>>> attribute and specify the template you are referring to
>>> just add this to your former code:
>>> template_name = "catalog/book_list.html"
>>>
>>>
>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
>>>  Virus-free.
>>> www.avast.com
>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
>>> <#m_8455319138707163929_m_3791702616293114032_m_2104138296797754165_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>>
>>> On Wed, Oct 6, 2021 at 1:09 PM Никита Назаров 
>>> wrote:
>>>
>>>> It doesn't seem to work. I wrote your example in views.py.
>>>> Or I might make mistakes. Could you see?
>>>>
>>>> views. py
>>>> from .models import Book, Author, BookInstance, Genre
>>>> from django.views import generic
>>>> from django.shortcuts import render
>>>> from djang

Re: TemplateDoesNotExist at /catalog/books/

2021-10-06 Thread Adeyemi Deji
correct paginated_by to paginate_by.

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Wed, Oct 6, 2021 at 3:17 PM Adeyemi Deji  wrote:

> Please correct your class views, you are getting it wrong.
> it should look like this.
>
> class BookListView(generic.ListView):
> model = Book
> paginated_by = 10
> template_name = "catalog/book_list.html"
>
> class BookDetailView(generic.DetailView):
> model = Book
> template_name = "catalog/book_detail.html"
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
>  Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
> <#m_1024950781820118978_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> On Wed, Oct 6, 2021 at 3:09 PM Никита Назаров 
> wrote:
>
>> It also doesn't work. I see this error :"TemplateDoesNotExist at
>> /catalog/books/ catalog/book_list.html, catalog/book_list.html"
>> My views.py is below.
>> Also, I checked on GitHub Mozilla (
>> https://github.com/mdn/django-locallibrary-tutorial/blob/master/catalog/views.py).
>> They didn't use - template_name.
>> I'm completely confused.
>>
>> from .models import Book, Author, BookInstance, Genre
>> from django.views import generic
>> from django.shortcuts import render
>> from django.views.generic.base import TemplateView
>>
>> # Create your views here.
>>
>>
>> def index(request):
>> """View function for home page of site."""
>>
>> # Generate counts of some of the main objects
>> num_books = Book.objects.all().count()
>> num_instances = BookInstance.objects.all().count()
>>
>> # Available books (status = 'a')
>> num_instances_available = BookInstance.objects.filter(
>> status__exact='a').count()
>>
>> # The 'all()' is implied by default.
>> num_authors = Author.objects.count()
>>
>> context = {
>> 'num_books': num_books,
>> 'num_instances': num_instances,
>> 'num_instances_available': num_instances_available,
>> 'num_authors': num_authors,
>> }
>>
>> # Render the HTML template index.html with the data in the context
>> variable
>> return render(request, 'index.html', context=context)
>>
>>
>> class BookListView(generic.ListView):
>>
>> """Generic class-based view for a list of books."""
>>
>> model = Book
>> paginate_by = 10
>> template_name = "catalog/book_list.html"
>>
>>
>> class BookDetailView(generic.DetailView):
>>
>> """Generic class-based detail view for a book."""
>> model = Book
>> template_name = "catalog/book_detail.html"
>>
>>
>>
>> ср, 6 окт. 2021 г. в 14:24, Adeyemi Deji :
>>
>>> class BookListView(generic.ListView):
>>>
>>> """Generic class-based view for a list of books."""
>>>
>>> model = Book
>>>
>>> paginate_by = 10
>>>
>>> template_name = "catalog/book_list.html"
>>>
>>>
>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
>>>  Virus-free.
>>> www.avast.com
>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
>>> <#m_1024950781820118978_m_8455319138707163929_m_3791702616293114032_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>>
>>> On Wed, Oct 6, 2021 at 1:21 PM Adeyemi Deji 
>>> wrote:
>>>
>>>> Please don't change your formal code setting, just add the
>>>> template_name attribute and specify the template you are referring to
>>>> just add this to your former code:
>>>> template_name = "catalog/book_list.html"
>>>>
>>>>
>>>> <https://www.avas

Re: TemplateDoesNotExist at /catalog/books/

2021-10-06 Thread Adeyemi Deji
Okay, I also noticed something in the TEMPLATES VARIABLE in your 
settings.py file, please make DIRS an empty list like this [] with no space 
or better still change to [os.path.join(BASE_DIR, 'catalog/templates')]

On Wednesday, October 6, 2021 at 5:00:42 PM UTC+2 nazni...@gmail.com wrote:

> Thank you!
> I corrected as you wrote. But I also have this mistake (
> TemplateDoesNotExist at /catalog/books/
> catalog/book_list.html, catalog/book_list.html). 
> Might I take the wrong path? (my path is below picture)
> Also thank you for helping me. I am grateful to you. I have had this 
> problem for 1 week. 
> [image: image.png]
>
>
> ср, 6 окт. 2021 г. в 16:19, Adeyemi Deji :
>
>> correct paginated_by to paginate_by.
>>
>>
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
>>  Virus-free. 
>> www.avast.com 
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
>>  
>> <#m_-4865023885270008228_m_2700252164806904525_m_-6914425398611891894_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>
>> On Wed, Oct 6, 2021 at 3:17 PM Adeyemi Deji  wrote:
>>
>>> Please correct your class views, you are getting it wrong.
>>> it should look like this.
>>>
>>> class BookListView(generic.ListView):
>>> model = Book
>>> paginated_by = 10
>>> template_name = "catalog/book_list.html"
>>>
>>> class BookDetailView(generic.DetailView):
>>> model = Book
>>> template_name = "catalog/book_detail.html"
>>>
>>>
>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
>>>  Virus-free. 
>>> www.avast.com 
>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
>>>  
>>> <#m_-4865023885270008228_m_2700252164806904525_m_-6914425398611891894_m_1024950781820118978_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>>
>>> On Wed, Oct 6, 2021 at 3:09 PM Никита Назаров  
>>> wrote:
>>>
>>>> It also doesn't work. I see this error :"TemplateDoesNotExist at 
>>>> /catalog/books/ catalog/book_list.html, catalog/book_list.html"
>>>> My views.py is below.
>>>> Also, I checked on GitHub Mozilla (
>>>> https://github.com/mdn/django-locallibrary-tutorial/blob/master/catalog/views.py).
>>>>  
>>>> They didn't use - template_name. 
>>>> I'm completely confused. 
>>>>
>>>> from .models import Book, Author, BookInstance, Genre
>>>> from django.views import generic
>>>> from django.shortcuts import render
>>>> from django.views.generic.base import TemplateView
>>>>
>>>> # Create your views here.
>>>>
>>>>
>>>> def index(request):
>>>> """View function for home page of site."""
>>>>
>>>> # Generate counts of some of the main objects
>>>> num_books = Book.objects.all().count()
>>>> num_instances = BookInstance.objects.all().count()
>>>>
>>>> # Available books (status = 'a')
>>>> num_instances_available = BookInstance.objects.filter(
>>>> status__exact='a').count()
>>>>
>>>> # The 'all()' is implied by default.
>>>> num_authors = Author.objects.count()
>>>>
>>>> context = {
>>>> 'num_books': num_books,
>>>> 'num_instances': num_instances,
>>>> 'num_instances_available': num_instances_available,
>>>> 'num_authors': num_authors,
>>>> }
>>>>
>>>> # Render the HTML template index.html with the data in the context 
>>>> variable
>>>> return render(request, 'index.html', context=context)
>>>>
>>>>
>>>> class BookListView(generic.ListView):
>>>>
>>>> """Generic class-based view for a list of books."""
>>>>
>>>> model = Book
>>>> paginate_by = 10
>>>> template_name = "catalog/book_list.html"
>>>>
>>>>
>>>> class BookDetailView(

Re: Looking for collaborators for an online marketplace project with Python, Django, React.js and Next.js

2024-02-11 Thread Adeyemi Deji
I’m interested. Pls create a WhatsApp group so we can communicate better.
+2349011735491

On Sat, 10 Feb 2024 at 17:54, Jorge Bueno 
wrote:

> The project:
>
> I am working on an exciting project that I think you might be interested
> in. It's about an online marketplace similar to the US farmers and
> livestock markets, but with an online focus. The project is already half
> done, with a well-defined requirements list and backlog that will allow you
> to learn a lot while contributing to a real project.
>
> Technologies:
>
> We are using Python and Django for the backend, Next.js and React for the
> frontend.
>
> What we are looking for:
>
> We need help to get django working making python manage.py runserver and
> also all the procedures to check it works well as unit tests right now we
> have the following functionalities programmed the MVP:
> 1.User Registration
> User Profiles
> Product Listing
> 4.Search and Filters
>  5.Shopping Cart
>  6.Payment System
> 7.Ratings and Reviews
> 8.Messaging
>  Notification system
> 10.User management
> Why collaborate:
>
> You will learn a lot: The project is well organized and will allow you to
> work with modern and relevant technologies.
> You will contribute to a real project: Your work will have a direct impact
> on the success of the project.
> You will be part of a community: We are a passionate team committed to the
> success of the project.
> How can you participate?
>  You can access my public GitHub repository here:
> https://github.com/Programacionpuntera/Marketplace-Supremo
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/153e4e9d-4453-4280-8b06-27c8cbd1f72fn%40googlegroups.com
> 
> .
>

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