Tuesday, August 27, 2019

Re: Database Views

Thank you. I got it.. Issue with timezone

By default django considering 
TIME_ZONE = 'UTC'
USE_TZ = True

Thats the reason it was showing less records than actual.. 
I changed it local to local time zone name and USE_TZ = False

Its working perfectly.. I also understood that its not only to database views, its also applicable to tables also. 

Kindly make sure to change above two lines in setting according to ur local time zone to render correct records. 

Thank you. 


On Tue, Aug 27, 2019, 10:02 PM Doddahulugappa.B <doddahulugappa@gmail.com> wrote:
Thanks for your response.

In Django models.. For example 

class TempUser(models.Model):      first_name = models.CharField(max_length=100)        class Meta:          managed = False          db_table = "temp_user"


temp_user is database view. 
Now assume select * from temp_user
Gives 5 records 

Same model if i register in admin panel. 
It will show less records than 5. 
Even if i do TempUser.Objects.Count()
It will show less records than 5.

Very rare case it show exactly what view is having otherwise most of the time it fails to show exact records. 
I observed this since many days in 3 to 4 projects of my django



On Tue, Aug 27, 2019, 9:01 PM Jani Tiainen <redetin@gmail.com> wrote:
Hi.

You really need to provide more context. Without knowing your data, tables involved in a view. Your model and query you used and query you used to verify wrong (or correct) results it is virtually impossible to help you further.


ti 27. elok. 2019 klo 17.47 HULUGESH B <doddahulugappa@gmail.com> kirjoitti:
Hi All,


I am facing issues in Django Models:

If connect databse views in models.

It shows less records than actual number of records. Kindly assist me. How to solve. This is not all the time.. sometimes it is correct sometimes not correct.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/29c228cc-295a-487e-a5df-afb1471b8730%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHn91ocVY%2B-Z-9_GYKa0gbT5MCg%2Bh%2BvBzfLEgVf5QmnArV%2BaZw%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAKfjjGoar7k6qQqb%2BoOBv5S3SY-z6a4aeKdjdh_7MsR7BdZ%2BPA%40mail.gmail.com.

No comments:

Post a Comment