Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialmichaelangelo owildeberry
18,173 Pointscreate_challenge() takes 1 positional argument but 3 were given
create_challenge() takes 1 positional argument but 3 were given ... what more can I do?
from models import Challenge
def create_challenge():
name = CharField(max_length=100)
language = CharField(max_length=100)
steps = IntegerField(default=1)
2 Answers
Chris Freeman
Treehouse Moderator 68,441 PointsFrom the create function Challenge Task 1 of 1
Create a function named create_challenge()
that takes name, language, and steps arguments. Steps should be optional, so give it a default value of 1. Create a Challenge
from the arguments. create_challenge
should not return anything.
The model Challenge
is imported for you. To create a new model instance use the Challenge create()
method. In the create_challenge()
function, pass the arguments to the create()
method:
from models import Challenge
def create_challenge(name, language, steps=1):
'''Create Challenge model instance.
Arguments: name, language, steps (default 1) '''
# Create Challenge
Challenge.create(name=name, language=language, steps=steps)
michaelangelo owildeberry
18,173 Pointsnow I see why I was going in the opposite direction. :)