Yeah but this doesn't work. I describe IT in my Last Post why

Regards

MOHIT DILIP MAKWANA <f20200...@pilani.bits-pilani.ac.in> schrieb am Mo.,
15. Feb. 2021, 15:22:

> Hey,
>       You can add a dunder method for your  "Productinterests" model to
> return the name of the object instead of the name of model.
> It involves the use of '__str__()' method. You can implement it in the
> following way:
>
> class Productinterests(models.Model):
>     id = models.AutoField(primary_key=True)
>     name =
> models.CharField(max_length=255, default="", blank=False, null=False)
>     def __str__(self):
>             return str(self.name)
>
> Just add the extra function in your models, and then whenever a
> "Productinterests" object is called, it will be outputted as the value of
> its 'name' property.
>
> Regards.
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/34ef8ba9-eca9-4c67-923f-b4815dcd9eaan%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/34ef8ba9-eca9-4c67-923f-b4815dcd9eaan%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKGT9my%2B-D1HW4s0C_3P5hgfr0BsBDG4ianY0k1EQ-YA_w3sKw%40mail.gmail.com.

Reply via email to