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
54 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,760 points
11,678 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
295 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,120 points
180 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
• 540 points
514 views
0 votes
2 answers

How can I make Python's UnitTest Framework fail if an exception is raised by any thread?

http://www.drdobbs.com/testing/testing-for-failures-with-python/240169387 Try reading the above document. I ...READ MORE

answered Mar 9, 2019 in Python by anonymous
4,744 views
0 votes
1 answer

Get object by id()

You'll probably want to consider implementing it ...READ MORE

answered Feb 20, 2019 in Python by SDeb
• 13,290 points
198 views
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,760 points
836 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,760 points
349 views