I need id by objects

0 votes

Hello geeks:

Here is my models:

  

class Room_Type(models.Model):

"""Django data model Room_Type"""

ROOM_CATEGORIES={

('Elt','Elite'),

('Lux','Luxury'),

('Sig','Signature')

}

image = models.ImageField(upload_to="pics")

roomtype = models.CharField(choices=ROOM_CATEGORIES,max_length=20)

price = models.CharField(blank=True, max_length=100)

def __str__(self):

return f'{self.roomtype}'


I want Id with any one of the detail given in model,Help me solve geeks

Dec 5, 2020 in Python by Mohamed
• 170 points
308 views
Hey, @Mohamed,

Are you facing any error while executing your model?

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
1 answer

How do I filter query objects by date range in Django?

Hello @kartik, Use Sample.objects.filter(date__range=["2020-01-01", "2020-01-31"]) Or if you are just ...READ MORE

answered Jun 26, 2020 in Python by Niroj
• 82,880 points
33,198 views
+1 vote
4 answers

How can I concatenate str and int objects?

If you want to concatenate int or ...READ MORE

answered Oct 18, 2018 in Python by subhm
962 views
0 votes
1 answer

How do I sort a dictionary by value?

It is not possible to sort a ...READ MORE

answered Jul 30, 2018 in Python by Priyaj
• 58,090 points
565 views
0 votes
2 answers

In Python, how do I read a file line-by-line into a list?

readline function help to  read line in ...READ MORE

answered Jun 21, 2020 in Python by sahil
• 580 points
1,504 views
0 votes
1 answer
0 votes
1 answer

How to temporarily disable a foreign key constraint in MySQL?

Hello @kartik, To turn off foreign key constraint ...READ MORE

answered Jun 23, 2020 in Python by Niroj
• 82,880 points
2,141 views
0 votes
1 answer

How do I use Django templates without the rest of Django?

Hello @kartik, Let's say you have this important ...READ MORE

answered Jun 23, 2020 in Python by Niroj
• 82,880 points
1,283 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP