Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

298
Vistas
"return self.title</pre>" returns a syntax error django

Please bear with my ineptitude. I'm trying upgrade my skillset from simple python scripts to something closer to resembling a full stack developer. RN I am creating a simple Django todo app and am going through a basic tutorial here. https://www.geeksforgeeks.org/python-todo-webapp-using-django/

Env is setup with the following...

Python==3.8.9

Django==3.2.9

django-crispy-forms==1.13.0

my models.py looks like this:

from django.db import models
from django.utils import timezone


class Todo(models.Model):
    title = models.CharField(max_length=100)
    details = models.TextField()
    date = models.DateTimeField(default=timezone.now)
, if I am correct in assuming this is related to CSS. 

I am not sure where to go from here. Can anyone help me? 
    def __str__(self):
        return self.title</pre>


and my forms.py looks like this

from django import forms
from .models import Todo


class TodoForm(forms.ModelForm):
    class Meta:
        model = Todo
        fields = "__all__"</pre>

When I execute python3 manage.py makemigrations or runserver I get the following error and am clearly unable to figure out why.

  File "/home/ezurel/Coding/AppleTree/AppleTree/urls.py", line 19, in <module>
    from todone import views
  File "/home/ezurel/Coding/AppleTree/todone/views.py", line 7, in <module>
    from .forms import TodoForm
  File "/home/ezurel/Coding/AppleTree/todone/forms.py", line 8
    fields = "__all__"</pre>
                       ^
SyntaxError: invalid syntax

I'm stumped as to the need for the </pre> tag and to why it needs to be there and not as part of the HTML, if I am correct in assuming this is related to CSS.

I am not sure where to go from here. Can anyone help me?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Remove the </pre> tag. This tag was (very) likely used to typeset a code fragment, since code fragments are written between <pre> … </pre>, but it is not valid Python code:

class TodoForm(forms.ModelForm):
    class Meta:
        model = Todo
        fields = "__all__"  # ← no </pre>

and for the model:

class Todo(models.Model):
    title = models.CharField(max_length=100)
    details = models.TextField()
    date = models.DateTimeField(default=timezone.now)
    
    def __str__(self):
        return self.title # ← no </pre>
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda