Thank you it worked. Much appreciated. Regards,
Shazia On Wed, Jul 26, 2017 at 5:47 AM, M Hashmi <mhashmi1...@gmail.com> wrote: > Nothing wrong with your function based view. Just try to fill data in DB > field. It will work. Because you don't have any record in DB. Try to use > 'get_or_create' function. > > > M > > On Wed, Jul 26, 2017 at 4:50 AM, Shazia Nusrat <shazianu...@gmail.com> > wrote: > >> Hi, >> >> I have a simple model like below: >> >> class Artists(models.Model): >> name = models.CharField(max_length=200) >> description = models.TextField() >> >> def __unicode__(self): >> return self.name >> >> I am trying to call it in my view like below: >> >> def artistdetail(request, id): >> artista = Artist.objects.get(id=id # this line is giving me >> error. >> >> >> Can someone explain me how to get the id in operational mode. I can call >> IDs with filtering by name in shell. But how to set it up for the user who >> uses it. >> >> >> Regards, >> Shazia >> >> -- >> 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 post to this group, send email to django-users@googlegroups.com. >> Visit this group at https://groups.google.com/group/django-users. >> To view this discussion on the web visit https://groups.google.com/d/ms >> gid/django-users/CAD83tOyL_Sdi3eeuManMXnsNBXHhvpwzGA0Tt2qXX_ >> MgAbOUaQ%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-users/CAD83tOyL_Sdi3eeuManMXnsNBXHhvpwzGA0Tt2qXX_MgAbOUaQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- > 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 post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/django-users/CANoUts5nmSEeqNVa-%2B-vZ%3DPtmndnkDG% > 2B5gehMjA1r208u6ggxQ%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CANoUts5nmSEeqNVa-%2B-vZ%3DPtmndnkDG%2B5gehMjA1r208u6ggxQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAD83tOyGW03%3DLEYF28tHD6hEL1NfH3soY01sSYSNxwCrswaJ0Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.