Anonymous
share with pastebin your code
https://pastebin.com/0JezbMUQ
Talha
For the FYP of Operating System subject , i create the django website buy domain from namecheap use Heroku for hosting and SSL . But my teacher is saying something different which i'm not getting what he want me to build read the email of my teacher kindly guide me what i have to build to show him the email : Unfortunately i do not see your project satisfying the requirements of the OS security project.i understand u worked hard building the web Application using django .However the project was not to build the web application alone ,it was to build install the OS the entire web application slack and then use SSL, in addition it was to build the certificate Authority from what i can see, You used the django web framework on a heroku service (with all the slack pre -installed ).
Subhasis Khuntia
:)
thanks dude
Subhasis Khuntia
i want to know about how the request and response work can anyone suggest me any good tutorial
Mirco
https://pastebin.com/0JezbMUQ
print(self.get_parent_id(validated_data)) don't do it
Anonymous
what should i do ?
Mirco
what should i do ?
nothing. the code is ok as it is without that print
Mirco
the create must return new obj or call the super() or doing this def create(self, validated_data): return YourModel.objects.create(**validated_data)
Anonymous
Mirco
then how do i get parent_id ?
it's automatically done by Django when you define the method parent_id inside the response will be obj.parent_id
Anonymous
it's automatically done by Django when you define the method parent_id inside the response will be obj.parent_id
'CategoryCreateSerializer' object has no attribute 'parent_id'
Mirco
share the code where you are using the serializer
Anonymous
i need to check if parent_id is provided or not how to do that
Mirco
i need to check if parent_id is provided or not how to do that
if you put required=True it will be mandatory if missing Django will generate ValidationError if it's been sent, it's inside validated_data
Anonymous
parent_id = SerializerMethodField(allow_null=True)
Anonymous
i got only name object in validated_data
Anonymous
print(self.initial_data) = <QueryDict: {'parent_id': ['1'], 'name': ['l']}>
Anonymous
print(validated_data) = {'name': 'l'}
Mohanur
Anybody used svg full background imag in django?
Charly
Anybody used svg full background imag in django?
that has nothiong to do with django is HTML + css
Jugurtha
What is mailhug used for in Django? Should I use one ? Is it useful? With what can I replace it in production?? Regards
Jugurtha
Please answers
Mirco
What is mailhug used for in Django? Should I use one ? Is it useful? With what can I replace it in production?? Regards
It's not mandatory to use it You can use whatever email server you wanna For example I use mailhog only locally within docker
Phill
Hey guys, while using rest_framework, I have a situation where I have a few fields generated by the serializer cause they depend on the type of request, and some data sent in the url. However, I would like to return only some objects to the user based on the calculated field value (not all the objects). How can I do this?
Balaji S
i am trying to implement a chat application
Balaji S
in django
Balaji S
i am not able to implement the second service
Charly
i am not able to implement the second service
If you don't clearly explain your issue we can't help at all
Maan
ChatUser.objects.filter(created_on=now).values_list("receiver", flat=True) i want a list without duplication
Tanguy
hello, I made a new project with django 4 and mysql. Somebody know where I can deploy it freely for testing please?
shila
Actually I have a problem python
shila
Python version not showing
Maxim
Actually I have a problem python
well, then write the point, not the attention-grabbing messages
Sophia
How to create student table for sign up and login without using user table of django admin literally can anyone guide me to create student portal
Sophia
A student to sign up, login and to get his /her details
Fan / Ac
A student to sign up, login and to get his /her details
you know how to create a model and how to create forms ?? if yes you can do this, create a student model with username and password field which is basic but might be enough for your current need i think ?? add username and password of students in the student table create login form and verify data from form using the data in the student table
Sophia
ok let me try but how to add that in student table
Sophia
add username and password of students in the student table,this only i dont know how to do Because every time I am adding it in user table of admin, that's the issue here
Sophia
I don't know how to add in student table
Sophia
really i dont know how to do pls help me
Anik8
really i dont know how to do pls help me
Create A ModelForm for user model and everytime you wanna have a new user for signup , just validate the form and save it. After that you can redirect to the Login page
Sophia
OK let me try thank you
Swapnil
Hello everyone, I want help in one scenario in python django how we can handle the if else conditions in unit test case for GET method. Thanks
Mister
Hey i can send mail with my cpanel mail, i have this mistake ConnectionRefusedError at /register [WinError 10061]
Swapnil
what do u mean with if / else ?
Yes, test case is not cover the multiple if condition
Swapnil
again: which conditions ?
Any normal condition ...."if" part is cover but "else" part is not cover in test case
Mirco
Hi, you should have separate test cases to cover the both of them
not needed everytime, if using pytest you can get the advantages of using parametrize and test different scenarios by generating multiple tests by writing only 1
Anonymous
How to get value in serializer method field
Anonymous
How to get value in serializer method field
like here https://www.django-rest-framework.org/api-guide/fields/#serializermethodfield define a method "get_<your field name>"
Anonymous
I have done but doesn't get the value
Anonymous
I have done but doesn't get the value
when you pass instance it's work this is readonly field
Anonymous
I don't get in validate data but get the value in initial_data
Vishal
I have a model called Inventory and another model Media with Inventory model as Foreign Key. But when filtering the data out of Inventory I need the instance of Media corresponding to that instance of Inventory and join the both. How can I achieve this in Django ORM?
Vishal
What I am doing right now is. I filter out the data out of Inventory and send it to template. And on template using js call I retrieve the Media instance corresponding to each of the Inventory instance. Making me hit the database 2 times for single instance.
Vishal
Thank You any efficient approach to this will be much appreciated.
Soviet Cat
Hello, can your help me please? How I can to check user permission in models by group pelase?
Vishal
If I understand it well, I think you should look at docs for prefetch_related. This might help
Yeah I do looked at prefetch_realted and select_related they both correspond to retrieving the data of Foreign key in current instance
Vishal
prefetch_related is for M2M field or reverse foreign key relation
https://gist.github.com/vashuteotia123/6ed32a541cb5392b57b99c86b905826c Please take a look at this. In views.py function call I need Media instance of every Inventory instance. A syntax help would be appreciated.
Soviet Cat
Hello, how I can check user groups in get_query_set plzz?
Hardik
Hello, django app running but no showing css. CLI shows “404 3139” for css, js files