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 trialjamalbacchus
Courses Plus Student 6,664 Points@kennethlove: "with DATABASE.transaction"
in the video you moved the "with DATABASE.transaction" to the models.py. Why did you keep it in the app.py?
please explain.
1 Answer
Kenneth Love
Treehouse Guest TeacherI'm not sure I understand what you're asking about. Can you give me a bit more detail?
jamalbacchus
Courses Plus Student 6,664 Pointsjamalbacchus
Courses Plus Student 6,664 PointsKenneth Love In the Streaming Templates video you moved "with DATABASE.transaction" to the models.py. Why didn't keep it in the app.py?
Sorry for the confusion.
jamal
Kenneth Love
Treehouse Guest TeacherKenneth Love
Treehouse Guest TeacherAh. Well since that transaction should happen for creating the models/user(s) every time that work is being done, it makes more sense to put it into function so it'll happen every time.
If we only had it in
app.py
, we're only protecting that one use of the function.