Shubham
Try migrating it again
b
I wanna share an incident here, I forgot to mention model into admin file and the site's still working.
Jon snow
Anyone help me please?
Doragonsureiyā
Anyone help me please?
Please don't ask meta questions like:
"Any user of $x here?"
"Anyone used technology $y?"
"Hello I need help on $z"
Just ask about your problem directly! With 56k+ people the probability that someone will help is pretty high.
Also please read: http://catb.org/~esr/faqs/smart-questions.html
Anonymous
Leonardo
hi! i'm having problems to serialize a Enum with DRF, can someone help?
Leonardo
TypeError: Object of type GenreType is not JSON serializable
Leonardo
where GenreType is a Enum
Mirco
Leonardo
from enum import Enum
class GenreType(Enum):
MALE = "MALE"
FEMALE = "FEMALE"
Leonardo
from rest_framework import serializers
from prescription.models import Prescription, Pacient
class PrescriptionSerializer(serializers.ModelSerializer):
class Meta:
model = Prescription
fields = 'all'
class PacientSerializer(serializers.ModelSerializer):
class Meta:
model = Pacient
fields = 'all'
Mirco
You cannot serialize the enum as it is and where you use that enum ?
Mirco
Use code sharing tool please
Follow our simple rule
Mirco
Leonardo
class Pacient(models.Model):
class Meta:
db_table = 'pacient'
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
name = models.CharField(max_length=100)
age = models.PositiveIntegerField(validators=[MinValueValidator(1), MaxValueValidator(100)])
genre = models.CharField(max_length=10, choices=[(tag, tag.value) for tag in GenreType], default=GenreType.FEMALE)
Leonardo
Mirco
Mirco
Then for the enum
Mirco
Use serializer method field
Mirco
And return obj.get_gnre_display()
Mirco
And you will get that field value
Leonardo
thank you!
so i should not change my model, correct?
Mirco
Yup, the model is correct
Leonardo
thank you, i'll try
Ghorz
Anonymous
Django sendpdf
I find out html2pdf which works fine for client side pdf creation
Anonymous
Any advance django course
Mirco
Doragonsureiyā
Any advance django course
Looking for Django tutorials? you can follow these three recommended ones:
* Official documentation and tutorial
* Tutorial from MDN
* Tutorial from django-girls
Sourav
Can anyone tell me best api documentation stuff for Django REST framework ?
What i know so far is :
1) django rest swagger(seems to be deprecated)
2) drf-yasg
3) drf own way
Plz suggest
Anonymous
Learn graphql
Mirco
Anonymous
Sourav
Actually m confused...on drf official site...they have mentioned use generateschema for static and schemaview for dynamic schema
Sourav
And Redoc is also there
Sourav
Redoc has good 3 panel view but it is not interactive
Sourav
drf-yasg
But drf-yasg only supports swagger 2.0 and not openapi 3
Gil
+1swagger
Sourav
Mirco
Ok
https://mermade.org.uk/openapi-converter
Sourav
Thanks
Sourav
drf-spectacular/README.rst at master · tfranzel/drf-spectacular · GitHub
https://github.com/tfranzel/drf-spectacular/blob/master/README.rst
Sourav
Mirco
Sourav
Ok
Siddharastro
Hello Im trying to configure uwsgi inside docker container for django, but when container starts running sends me the following error: no module named myapp
Siddharastro
the problem occurs in wsgi.py file
Siddharastro
solved: i just added pythonpath = /app/myapp to uwsgi.ini file
Sari
Вук с арбузом
When I use default password_change form auth_views.PasswordChangeView.as_view(), it has description field containing tips like
"Your password can’t be a commonly used password.
Your password can’t be entirely numeric."
I'd like to change this text (probably translate to another language). Is there any way I can do it without writing my own form?
Aman
how can i show PDF which in encrypted in database .
Aman
Govind
Hi Everyone,
How to upload image file using form?
please help me.
b
hey guys I have a quick question
things to learn in Django?
Govind
Cesar
Hello, does anyone know how can i send a variable to base.html file?
in my base.html i have navbar that includes a Title of current page, how can i set it depending of the view calling it
Cesar
Gil
Don't worry, we come from the same way 😜
Ayomide
in the base...do something like this {% block title %} Home {% endblock %}........in the about page ..you can do something like this {% block title %} About{% endblock %}
Ayomide
hope it helps
Cesar
Ayomide
yes...exactly
Ayomide
😊
Вук с арбузом
Gil
I see two things to work
-storage
-frontend serve file/show/download
Do you know how to store? Its not a easy decision
Aman
Gil
I don't know
Mee to 😜 there s some work, is not easy. File into db in short time can be fun, long term huge database.
Aman
Gil
yes
May be better a filesystem encrypted, and only indexing files , giving read permission to users by backdend
Aman
okay i try.
Aman
AJR
Hey guys, I just finished the beginner Django tutorial from Mosh. What would be a good transition from Mosh's beginner tutorial?