Olá, estou fazendo o curso com python 3 e tive um problema quando instanciei a classe perfil vazia, recebi o seguinte erro :
TypeError at /profiles/1
__init__() missing 4 required positional arguments: 'name', 'email', 'interests', and 'city'
Request Method: GET
Request URL: http://localhost:8000/profiles/1
Django Version: 2.1
Exception Type: TypeError
Exception Value:
__init__() missing 4 required positional arguments: 'name', 'email', 'interests', and 'city'
Segue o meu codigo :
from django.db import models
class Profile:
def __init__(self, name, email, interests, city):
self.name = name
self.email = email
self.interests = interests
self.city = city
Segue a view
from django.shortcuts import render
from profiles.models import Profile
def index(request):
return render(request, 'index.html')
def profileView(request,profile_id):
profile = Profile()
if profile_id == '1':
profile = Profile('Paris','paris@gmail.com','[tech, arts, design]','NY')
if profile_id == '2':
profile = Profile('John','John@gmail.com','[Writing, arts, CGI','Sao Paulo')
return render(request, 'profile.html',{"profile":profile})
Alguem poderia me ajudar pf ?