Ильяс
SEX= (
('M', 'Male'),
('F', 'Female'),
)
BODYTYPE= (
('Slim', 'Slim'),
('Average', 'Average'),
('Athletic', 'Athletic'),
('Heavyset', 'Heavyset'),
)
class Profile(models.Model):
sex = models.CharField(max_length=1, choices=SEX, blank=True, null=True)
bodytype = models.CharField(max_length=8, choices=BODYTYPE, blank=True, null=True)
Thanks
Ильяс
Yeah i already finished the problem)) Thanks
Sultonbek Ikromov
Siddhesh
Siddhesh Sawant:
Hey i have a doubt
See im filling form.. Take e.g. email and address are field..
So what i want is after user click submit while registeration
e-mail will go in User model
Address will go in Profile model
Currently i can save data in User model..
And also can generate instace of that particular user. In Profile Table..
But with address empty in column
It jst create user id in Profile all other fields are null
Mihail
Mihail
Pushpender
#Help
i am developing a movie site for acedemic project. i am having dificulty in creating models for genre . i want to make a genre field in which i can store multiple genre. how can i do it
Opeyemi
Pushpender
yup i just don't know where to start, i have already create a genre choice field
Pushpender
i want to make a field where i can store multiple genre for each movie. some movies can have 3 genres while others can have more or maybe less than 3 genres
Opeyemi
i think because there are alot of genres, the better solution is to make it a foreign field
Mihail
Gaurav
Opeyemi
class Genre(models.Model):
name = models.CharField(max_length=300)
class Music(models.Model):
user = models.ForeignKey("Genre", on_delete=models.CASCADE)
Pushpender
Gaurav
Opeyemi
Gaurav
Opeyemi
maybe there is a better solution i dont know about, bet that is was i was told when i was faced with same issue a while ago
Opeyemi
actually i made a mistake, i was to use many to many field
Opeyemi
thanks bro, will try
class Genre(models.Model):
name = models.CharField(max_length=300)
class Music(models.Model):
genre = models.ManyToManyField(Genre, on_delete=models.CASCADE)
Siddhesh
Opeyemi
Anonymous
Anonymous
before that, why does name field contain max_length of 300 char??
Anonymous
Note
If you are writing an application that must be portable to multiple database backends, you should be aware that there are restrictions on max_length for some backends. Refer to the database backend notes for details.
Anonymous
Anonymous
some db backends restrick max_length on CharField to 256. If you do that in production you might endup running into trouble at some point
Damron
Hi guys!
Is there opportunity to see which commands are used when we trying to Model.objects.filter(...)
I mean what's command string is sent to the database to get suitable rows?
raven
Damron
Damron
It's hard to understand quickly
Damron
)
raven
ohh you can try printing this
print( Model.objects.filter().query)
Ananthu
am trying to integrate js frontend frame work to django, trying django to serve the files. Is there a work around for manually addding {%load static%) to files
Ananthu
django2.2 and angular 8
Ananthu
any one done this before?
Katia
What's the best way to create an interactive floormap for a django web app ? Thanks
Ananthu
Ananthu
Anonymous
I dont think that is the best practice. Sorry, i dont have any solution for this
Anonymous
Any django
Anonymous
Interview questions for fresher and experience
Anonymous
Anonymous
Any PDF format is thr??
Anonymous
Is it
Anonymous
Is that link with u
Raph
could anyone help me here please...
Why am I getting this error when trying to install Pillow:
Command "C:\Users\Raph\PycharmProjects\Django_Lectures\venv\Scripts\python.exe -u -c "import setuptools, tokenize;file='C:\\Users\\Raph\\AppData\\Local\\Temp\\pip-install-j18_xkhk\\Pillow\\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace
('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\Raph\AppData\Local\Temp\pip-record-8kvrsjrk\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\Raph\PycharmProjects\Django_Lectures\venv\
include\site\python3.8\Pillow" failed with error code 1 in C:\Users\Raph\AppData\Local\Temp\pip-install-j18_xkhk\Pillow\
Anonymous
What is context in django
Raph
what do you mean?
Anonymous
Question
Ananthu
Anonymous
Django and machine learning anyone has done
professor
I am trying to make my activation url like activate/096715d5a428c3d84dd142711f025d68963cc45ec29d4ddd8007506e00af13a3/ . my origial url looks like path('activate/<slug:uidb64>/<slug:token>/', views.activate, name='activate') , and I tried to remove <slug:uidb64> it doesnt work any tips to achieve this?
Feisal
Should i create a new model for choices?
No put it on the profile models as
Class UserProfile(models.Model):
GENDER_CHOICE=
("m","Male")
("f","Female")
("fns","Prefer not to say")
Human
Guys I am a beginner in Django ....I am creating a practice site for uploading image .....but the images are not showing on Django admin....why ?????
.
Human
Not is shown there
Human
It also show to choose file
Damron
Ghorz
Ghorz
professor
Ghorz
Ghorz
It's customizable
professor
is it possible to allow specific domain mail in django?
Ghorz
You can modify it to your taste
Ghorz
professor
Yes
do you have an example how can I?
professor
example if I want only gmail or hotmail users use this feature