Mithilfe von __str__ () - Methode in Django für Python 2

Lerne ich Django mit der Django-Projekt-Lernprogramm.
Da ich python 2.7 ich bin nicht in der Lage, um die Umsetzung der folgenden in der python 2.7:

from django.db import models

class Question(models.Model):
# ...
    def __str__(self):              # __unicode__ on Python 2
        return self.question_text

class Choice(models.Model):
# ...
    def __str__(self):              # __unicode__ on Python 2
        return self.choice_text
Antwort ist schon in die Kommentare!
Akzeptierte Antwort sein sollte, dass man von @alfetopito, weil dieser Technik ist die beste übereinstimmung für Django-Portierung der Philosophie.

InformationsquelleAutor bhavya | 2015-02-17

Schreibe einen Kommentar