Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
La clase no tiene miembros de objetos
def index(request): latest_question_list = Question.objects.all().order_by('-pub_date')[:5] template = loader.get_template('polls/index.html') context = {'latest_question_list':latest_question_list} return HttpResponse(template.render(context, request))

La primera línea de esa función recibe un error en Question.objects.all() :

E1101: La clase 'Pregunta' no tiene objetos 'miembro'

Estoy siguiendo el tutorial de documentación de Django y tienen el mismo código en funcionamiento.

He intentado llamar a una instancia.

 Question = new Question() and using MyModel.objects.all()

También mi código models.py para esa clase es este...

 class Question(models.Model): question_text = models.CharField(max_length = 200) pub_date = models.DateTimeField('date published') def was_published_recently(self): return self.pub_date >= timezone.now() - datetime.timedelta(days=1) def __str__(self): return self.question_text

En vano todavía tengo este error.

He leído sobre pylint y ejecuté esto ...

 pylint --load-plugins pylint_django

Lo que no ayudó, aunque el archivo Léame de github dice...

Evita advertencias sobre atributos generados por Django como Model.objects o Views.request.

Ejecuté el comando dentro de mi entorno virtual y, sin embargo, nada.

Por lo que cualquier ayuda sería grande.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Instale pylint-django usando pip de la siguiente manera

 pip install pylint-django

Luego, en Visual Studio Code vaya a: Configuración de usuario ( Ctrl + , o Archivo > Preferencias > Configuración si está disponible ) Ingrese lo siguiente (tenga en cuenta las llaves que se requieren para la configuración de usuario personalizada en VSC):

 {"python.linting.pylintArgs": [ "--load-plugins=pylint_django" ],}
over 4 years ago · Santiago Trujillo Report

0

La respuesta de @ tieuminh2510 es perfecta. Pero en las versiones más recientes de VSC no encontrará la opción de editar o pegar ese comando en User Settings .

Para versiones más nuevas, agregue el código en los siguientes pasos:

  1. Presione ctrl shift p para abrir la paleta de comandos.
  2. Ahora, en la Paleta de comandos, escriba Preferences: Configure Language Specific Settings .
  3. Seleccione Python .
  4. Agregue estas líneas dentro de las primeras llaves:
 "python.linting.pylintArgs": [ "--load-plugins=pylint_django", ]

Asegúrese de que pylint-django también esté instalado.

over 4 years ago · Santiago Trujillo Report

0

Instale Django pylint:

 pip install pylint-django

ctrl+shift+p > Preferencias: configurar ajustes específicos del idioma > Python

El archivo settings.json disponible para el lenguaje python debería tener el siguiente aspecto:

 { "python.linting.pylintArgs": [ "--load-plugins=pylint_django" ], "[python]": { } }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!