Thanks Tim. It worked. Regards, Subhabrata Banerjee. On Monday, May 11, 2015 at 11:02:50 PM UTC+5:30, Tim Graham wrote: > > You are using Python 2, but the tutorial is written for Python 3 as noted > in part 1. If you aren't willing to switch to Python 3, you can rename the > __str__ method to __unicode__ as the comment indicates. > > On Monday, May 11, 2015 at 12:35:39 PM UTC-4, SUBHABRATA BANERJEE wrote: >> >> Dear Group, >> >> I am very new to Django, and started with Django on Windows. I am using >> Python 2.7.9. I have some >> issues learning it. >> >> (a) I was following the Tutorial given in >> https://docs.djangoproject.com/en/1.8/intro/tutorial02/ >> <https://www.google.com/url?q=https%3A%2F%2Fdocs.djangoproject.com%2Fen%2F1.8%2Fintro%2Ftutorial02%2F&sa=D&sntz=1&usg=AFQjCNHffHqfKvFsEfpND42pwKYxOJg7JA> >> It is generally going fine I am using, 1.8.1 of Django as given in >> >>> django.get_version() >> '1.8.1' >> Here as I gave >> python manage.py runserver >> I could find the login page, http://127.0.0.1:8000/admin/ and could >> login using my login id and password. >> But as I changed the admin.py with admin.site.register(Question) I could >> not find the changed view of the login page, rather it is >> not coming anymore. >> >> (b) I was trying to follow the earlier part of the Tutorial given in, >> https://docs.djangoproject.com/en/1.8/intro/tutorial01/, things were >> generally fine, >> but somehow I am failing to follow, >> def __str__(self): # __unicode__ on Python 2 >> return self.question_text >> in models.py, I am not being able to write models.py >> So, if I use it as, >> In [12]: Question.objects.all() >> Out[12]: [<Question: Question object>] >> >> In [13]: from polls.models import Question, Choice >> >> In [14]: Question.objects.all() >> Out[14]: [<Question: Question object>] >> >> In [15]: Question.objects.filter(id=1) >> Out[15]: [<Question: Question object>] >> >> In [16]: Question.objects.filter(question_text__startswith='What') >> Out[16]: [<Question: Question object>] >> >> In [17]: from polls.models import Question, Choice >> >> In [18]: Question.objects.all() >> Out[18]: [<Question: Question object>] >> >> In [19]: Question.objects.filter(id=1) >> Out[19]: [<Question: Question object>] >> >> I am not getting the desired output. >> >> If any one may kindly suggest what is the error I am doing. >> >> Thanks in advance, >> Regards, >> Subhabrata Banerjee. >> >> >> >> >> >> >> >> >> >> >
-- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f62c17e2-9ccc-4647-a194-ca8a06807ae2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

