Queries vs Serializers

2020-09-15 Thread Gs_1001
Hey, I previously worked with an organization which had it's back-end implemented using Django. The developers there with did not use the serializers most of the time, I think i must mention that the code base had evolved for the past 4-5 years and the data requested in the APIs was quite com

Re: I need to know how to optimize this?

2020-06-14 Thread Gs_1001
custom_sponsored_book.obj = > sponsored_book > final_sponsored_books.append( > custom_sponsored_book) > if len(final_sponsored_books) == 6: > break > final_sponsored_books.sort(key=lambda x: x.points,

Re: How to add a user ratings feature in djnago application?

2020-06-13 Thread Gs_1001
Hey, A rating feature for a peer reviewed books website would look somewhat like: - A books model having "no_of_reviews" and "rating" field Every time a user rates a book no_of_reviews field would be incremented and rating field would be updated. If you think I somehow missed the point then pl

Re: I need to know how to optimize this?

2020-06-13 Thread Gs_1001
Hey, I was having a bit trouble trying to understand the idea. - The SponsporedBooks model has user field which isn't being used here. Where do you plan to user this ? - The CustomSponsoredBooks model does not have a user field. Are you not trying to store the points for the books (possible for

Re: I need to know how to optimize this?

2020-06-13 Thread Gs_1001
Hey, I was having a bit trouble trying to understand the idea. - The SponsporedBooks model has user field which isn't being used here. Where do you plan to user this ? - The CustomSponsoredBooks model does not have a user field. Are you not trying to store the points for the books (possible for

Re: Best Practices Creating a User

2020-05-05 Thread Gs_1001
The documentation provides some ways to extend the functionality of the user model But the thing I didn't know at first was that once you have your application working and all, it's quite difficult to make changes to the user model. So I always prefer to make a CustomUser model at the start of a