Wednesday, July 26, 2017

Dynamic Model ID cannot be called

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+unsubscribe@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/CAD83tOyL_Sdi3eeuManMXnsNBXHhvpwzGA0Tt2qXX_MgAbOUaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment