Sunday, November 15, 2020
Select from the dropdown the object car that has the field is_active
hello, i'm a newbie using django and i have a problem that cannot solve.
In my createview i need to select from the dropdown the object car that has the field is_active = true,
how can i acomplish that?
class Car(models.Model):
brand = models.charfield(...)
is_active= models.BooleanField(default=True)
class Service(models.Model):
car = models.ForeingKey('Car'....)
name = models.Charfield()
class ServiceCreateView(CreateView):
model = Service
form = ServiceForm
...
If i change the field is_active to false in Car model, should not be shown in the dropdown.
can someone put me in the right direction?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c0f25f26-0d48-4272-8604-e688fe796370n%40googlegroups.com.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment