Re: How to fetch 10000 above record within second in django?

2023-01-16 Thread Prashanth Patelc
I'm using orm query fetching all data and showing into html templates ,
it's taking more time for get the data ,

On Tue, Jan 17, 2023, 12:40 PM Clive Bruton  wrote:

>
> On 17 Jan 2023, at 05:01, Prashanth Patelc wrote:
>
> > I written query it's taking more time like 38 seconds, how to to
> > fetch the lac of records within seconds any example in django using
> > orm or MySQL query ?
>
> Are you saying that you have a raw SQL query, or you are using a
> Django query?
>
> My experience is that the biggest lag in database retrieval is the
> amount of data retrieved, so if you can reduce the number of fields
> returned, that would be a good start.
>
> If you are using a Django query, and it has related elements, then
> the biggest boost you can give is using "select_related" and
> "prefetch_related".
>
>
> -- Clive
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/9EF46118-6870-46AD-BF58-12AEC8C6A518%40indx.co.uk
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/CAMCU6CrAKQL6qA6hWHPDFbfpCT1R9v5%2BY_Qi-HOkPf%3DOXYt2yA%40mail.gmail.com.


Re: How to fetch 10000 above record within second in django?

2023-01-16 Thread Clive Bruton



On 17 Jan 2023, at 05:01, Prashanth Patelc wrote:

I written query it's taking more time like 38 seconds, how to to  
fetch the lac of records within seconds any example in django using  
orm or MySQL query ?


Are you saying that you have a raw SQL query, or you are using a  
Django query?


My experience is that the biggest lag in database retrieval is the  
amount of data retrieved, so if you can reduce the number of fields  
returned, that would be a good start.


If you are using a Django query, and it has related elements, then  
the biggest boost you can give is using "select_related" and  
"prefetch_related".



-- Clive

--
You received this message because you are subscribed to the Google Groups "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/9EF46118-6870-46AD-BF58-12AEC8C6A518%40indx.co.uk.


Re: Upgrading Django from 3.2.16 to 4.1.x

2023-01-16 Thread ASAMOAH EMMANUEL
Yes, you should be able to upgrade from Django 3.2.16 to 4.1.x by simply
installing the Django 4.1.x software and running the makemigrations command.
It's always a good practice to make a backup of your database and
application before upgrading, just in case any errors occur during the
upgrade process. Additionally, you should make sure to read up on any
breaking changes introduced in Django 4.1.x so that you understand how they
affect your application and / or database. Finally, make sure to thoroughly
test your upgraded application before going live.

On Tue, Jan 17, 2023 at 5:18 AM 'Ellinghaus, Lance J' via Django users <
django-users@googlegroups.com> wrote:

> I will be upgrading from Django 3.2.16 to 4.1.x and wanted to know if
> anyone has any suggestions. I am using oracle as the backend.
>
> The release notes do not go into much detail.
>
> Do I just need to install the Django 4.1.x software and run the
> makemigrations to do the upgrade?
>
>
>
> Thank you,
>
> *Lance Ellinghausen*
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/63c62f61.050a0220.cc9c2.6fc3SMTPIN_ADDED_MISSING%40gmr-mx.google.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/CABFHQYzPaFNZGgp1yDAk6pK9%2BbZaM-EDCdEvn167fNunPK4NrQ%40mail.gmail.com.


Upgrading Django from 3.2.16 to 4.1.x

2023-01-16 Thread 'Ellinghaus, Lance J' via Django users
I will be upgrading from Django 3.2.16 to 4.1.x and wanted to know if anyone 
has any suggestions. I am using oracle as the backend.
The release notes do not go into much detail.
Do I just need to install the Django 4.1.x software and run the makemigrations 
to do the upgrade?

Thank you,
Lance Ellinghausen

-- 
You received this message because you are subscribed to the Google Groups 
"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/63c62f61.050a0220.cc9c2.6fc3SMTPIN_ADDED_MISSING%40gmr-mx.google.com.


How to fetch 10000 above record within second in django?

2023-01-16 Thread Prashanth Patelc
Hi all,

How to fetch the data from db (mysql) above 1 records within second,

I written query it's taking more time like 38 seconds, how to to fetch the
lac of records within seconds any example in django using orm or MySQL
query ?

-- 
You received this message because you are subscribed to the Google Groups 
"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/CAMCU6CqjuTajQb1NstRRyw2KF3qK6FWj16_KGoFYP%2BunKqOjtQ%40mail.gmail.com.


Re: HOW TO OUTPUT DATA GOT FROM combined queryset IN DJANGO TEMPLATE (html file) ?

2023-01-16 Thread Byansi Samuel
Thanks it worked but I would like to ask you, why did you use  " game" in
{%for game in combined_list %} ? En what is the role of 'game'


On Sat, Jan 14, 2023, 8:35 PM Hector Mwaky  wrote:

>
>1.
>
>In the windows_games view in others/views.py, you are using the
>filter() method on the Action and Adventure models to get the action and
>adventure games that have the 'os' field set to 'windows'. Then you are
>using the itertools.chain() function to combine the two querysets into a
>single list, and storing that list in the variable combined_list. The
>context variable is not created correctly, it should be context =
>{'combined_list': combined_list}
>2.
>
>In the template others/os/windows_game.html, to output the results of
>the combined_list you should use a for loop to iterate over the list and
>display each item. Also, it seems that you are trying to access the
>game_pic attribute of the objects in the combined_list, but the models you
>have defined (Action and Adventure) do not have a field called game_pic
>3.
>
>{% for game in combined_list %}  {{
>game.name }} {% endfor %}
>4.
>
>It would be a good idea to add a __str__ method to the models in order
>to return the name of the game, and also to add a field game_pic if you
>want to display the image of the game.
>class Action(models.Model): name=models.Charfield() os=
>models.Charfield(choices=OS) game_pic = models.ImageField(upload_to=
>'action_game_pic/') def __str__(self): return
>
>
> On Thursday, 12 January 2023 at 18:27:03 UTC+3 samuelb...@gmail.com wrote:
>
>> Hey!  Am having a problem. And l request for your Help.
>>
>> Am having 3 apps in Django project
>> - action
>> - adventure
>> - others
>>
>>
>> #action/ models.py
>>
>> 
>> class Action(models.Model):
>> name=models.Charfield()
>> os= models.Charfield( choices=OS)
>>
>>
>>
>> #adventure/models.py
>>
>>
>> 
>> class Adventure(models.Model):
>>  name=models.Charfield()
>>  os= models.Charfield( choices=OS)
>>
>>
>>
>> #Others/views.py
>>
>>
>> from itertools import chain
>>
>> from action.models import Action
>>
>> from adventure.models import Adventure
>>
>>
>> def windows_games(request):
>>
>> win_action = Action.objects.filter(os='windows')
>>
>> win_adventure = Adventure.objects.filter(os='windows')
>> combined_list = list(chain(win_action,win_adventure))
>>
>> context = ['combined_list':combined_list,]
>>
>>  return render(request, 'others/os/windows_game.html' , context)
>>
>>
>>
>> #others/os/windows_game.html
>>
>> .
>> 
>>  
>>  {{combined_list.name}}
>> .
>>
>>
>>
>>
>>
>>
>>
>>
>> 1). I need to correct me in #others/ views.py  if there is any mistake
>> done.
>>
>> 2). I would like to know how to know how to write the tag that outputs
>> the results in #others/os/windows_game.html because I tried that but
>> outputs nothing.
>> And l would like to be in form of,
>> #{{combined_list.game_pic}}, etc
>>
>>
>> Please help me.
>> I'm Samuel
>>
>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "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/0b3af5d4-bb40-430c-9016-c2c7fa6108fan%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/CAGQoQ3yPZCzzFhw9w5%3DhMrc5jWEjNQzAKgJcdCs8o6jva3JUhA%40mail.gmail.com.


Re: Good Django 4 books for beginners

2023-01-16 Thread Zdravko Georev
Many thanks, I hope they will help me to advance a bit in Django jungle :)

В 8:41:01 ч. UTC+2на понеделник, 16 януари 2023 г. Noel Duffy написа:

> On 16/01/23 08:29, Zdravko Georev wrote:
> > Hi All,
> > Could you please advise for Django book/books for really beginners?
> > 
>
> I've had good results using these two books.
>
> 1. Django 4 by Example, by Antonio Melé. Very comprehensive, covers a 
> wide variety of topics. ISBN 978-1-80181-305-1
>
> 2. Django 4 for the Impatient, by Greg Lim and Daniel Correa. ISBN 
> 978-1-80324-583-6. This one isn't as comprehensive but does get you up 
> and running more quickly.
>
> I was able to get both books as ebooks through Packt Publishing's 
> website, https://www.packtpub.com, for US$5.00 each.
>
> I should add that both books assume reader familiarity with Python 
> itself, with websites in general, and some SQL, though not a whole lot. 
> They only assume you're a beginner with Django.
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/361bc9a4-df95-4103-a93d-3f24859dda2an%40googlegroups.com.