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
399 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,840 points
34,188 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
1,278 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,020 points
753 views
0 votes
1 answer

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

with open(fname) as f:     content = f.readlines() # you ...READ MORE

answered Oct 9, 2018 in Python by SDeb
• 13,300 points
1,792 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,840 points
2,451 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,840 points
1,564 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