-
-
Save abhisuri97/3c9e67189a01b7a224ac7e8bf7dda7ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Importing environment from .env file | |
SECRET KEY ENV VAR NOT SET! SHOULD NOT SEE IN PRODUCTION | |
THIS APP IS IN DEBUG MODE. YOU SHOULD NOT SEE THIS IN PRODUCTION. | |
>>> from app import models, db | |
>>> club = models.Club(name="hello world club") | |
>>> category1 = models.ClubCategory(category_name="test1") | |
>>> category2 = models.ClubCategory(category_name="test2") | |
>>> club2 = models.Club(name="hello world club 2") | |
>>> club.categories.append(category1) | |
>>> club.categories.append(category2) | |
>>> category1.clubs.append(club2) | |
>>> [x.category_name for x in club.categories] | |
['test1', 'test2'] | |
>>> [x.category_name for x in club2.categories] | |
['test1'] | |
>>> [x.name for x in category1.clubs] | |
['hello world club', 'hello world club 2'] | |
>>> [x.name for x in category2.clubs] | |
['hello world club'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment