Alex
There is ofcourse a bit of mess with it in django admin, but you should not rely on it.
Luis
Luis
Ok I think I got it
Alex
At least if it's (your app) for someone other than you.
Luis
Another thing, not related: if I want to create more User fields
Luis
should this be done by relating another model to the User or by creating a custom User model?
Luis
or, how would you go if you wanted to create a user comments model
Alex
Luis
How do I identify the User?
Luis
sorry for my bad question
Luis
where can I read more about example django database designs?
Alex
I want each user to post one comment per product but they can post comments in many products.
> I want each user to post one comment per product
Sounds more like a review, than a comment.
So there are 3 entities - Users, Products and Reviews.
User may have many reviews, but a review has only single user. Therefore we make:
class Review:
user = ForeignKey(User)
A review can be dedicated only for single product. So we add there one more fk - to a product. I'm ommiting here fields like text, rate and other.
Luis
Alex
I see
We also can add it unique_togther constraint to the Review model so a user could not review the same product multiple times.
https://docs.djangoproject.com/en/3.1/ref/models/options/#unique-together
like unique_together = [['user', 'product']]
Luis
Luis
But you helped me a lot.
Alex
Luis
Creator
Hey How Can I Create Quiz with Next Button . i.e ; After Hitting Next Button it should render next Question From Dictionary passed in context
Creator
Hey How Can I Create Quiz with Next Button . i.e ; After Hitting Next Button it should render next Question From Dictionary passed in context
Богдан
I got ”message": "Select a valid choice. That choice is not one of the available choices.", "code": "invalid_choice" in insurance_company field
However i got valid queryset
Please tell me what's wrong?
from django import forms
from .models import Contract, Insurance
class InsuranceContractForm(forms.ModelForm):
class Meta:
model = Contract
fields = "__all__"
def __init__(self, *args, **kwargs):
insurance_company = kwargs.pop('insurance_company', '')
super(InsuranceContractForm, self).__init__(*args, **kwargs)
self.fields['insurance_company'] = forms.ModelChoiceField(
queryset=Insurance.objects.filter(code=str(insurance_company)),)
Alex
Haleem
I have a Client model where I need relationship to multiple users from User Model. I am using OneToMany relationship field. I can able to select only one user in Admin Panel from drop down list. I want to select multiple users instead of one. Should I have to use ManyToMany relationship or there is anyway to select multiple users in dropdown list in admin panel.
Богдан
Anonymous
Anonymous
Ajay Bansal:
My custom user model is not able to generate tokens. Users are registered to database but token is not generated can anyone help
Showing error : <user: mike> token. User must be a user instance
Mirco
Mirco
Anonymous
https://pastebin.com/0vM4KNup
Anonymous
Here is the code
Raazu
Hello All,
Any one giving training on Django real-time projects and scenario's.
Thanks in advance
ken
hi. is it possible to show user profile in django using built-in functions (and some bootstrap in templates, of course)
Mirco
Anonymous
I have basic knowledge of django framework, so how much time does it take to learn rest framework , api
Anonymous
❓
Mirco
âshîsh
Anonymous
Any suggestions for study materials
Anonymous
??
âshîsh
Official documents are best
Anonymous
:(
âshîsh
Alex
Anonymous
Ok I won't then
Anonymous
Thanks for your help guys
Anonymous
You guys love reading documentation?
Mirco
Mirco
âshîsh
Anonymous
Yikes
Anonymous
I'm in the wrong business
Mirco
âshîsh
Don't read like a theory book to pass the semester !
Read like you have a query and want to find the answer
Anonymous
Anonymous
Noel
Anonymous
1st take it practically from youtube.. then again read documents.. u can get it Easyly😂..but 1st read dovumnets then do practically its like why i am coder?😀
Valentine ✙
Hi there! Speaking about DRF, I found myself being throttled on localhost after I tried to test anon throttling settings. Tried to cache.clear(), clear LockMemCache, restart server, cleared browser caches and data. Still being throttled by my own django code.
Is it smth like land mine for begginers? I looked at DRF throttling code, they do use default cache to store/check client . What else it can be?
Anonymous
Chatbot project which one is good
Django signals
Django channels
Socket.io
Богдан
How to fix validation error in ModelForm: “Select a valid choice. That choice is not one of the available choices.”?
https://dpaste.org/Enfy
âshîsh
Mirco
Mirco
Harsh
Any suggestions for implementing particular time stop and after that start on particular time django website
Alex
Harsh
I have website in django which is based on HRMS. I want to implement a service which can can Stop all services on particular time without stop server