-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iron out type-checking and formatting #138
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f49ebdf
Iron out type-checking and formatting
Samuel-Therrien-Beslogic 0ce64fa
Lint fix
Samuel-Therrien-Beslogic b471407
Update canopeum_backend/scripts/checkers.py
Samuel-Therrien-Beslogic 7bb8e0b
Apply 100 chars with ruff
Samuel-Therrien-Beslogic 33053fd
Merge branch '100-chars-line-length' of https://github.com/BesLogic/r…
Samuel-Therrien-Beslogic 5d76047
Merge branch 'iron-out-type-checking-and-linting' of https://github.c…
Samuel-Therrien-Beslogic 5dbb3b1
settings usage
Samuel-Therrien-Beslogic d034823
Fixes post merges
Samuel-Therrien-Beslogic e9d251d
Remove unused auth_token
Samuel-Therrien-Beslogic 64f0b02
Merge branch 'main' of https://github.com/BesLogic/releaf-canopeum in…
Samuel-Therrien-Beslogic f3832fa
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 0025f0e
Use mypy_drf_plugin.main
Samuel-Therrien-Beslogic 25a6d95
Merge branch 'iron-out-type-checking-and-linting' of https://github.c…
Samuel-Therrien-Beslogic ebb2707
Missing spaces
Samuel-Therrien-Beslogic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
from django.db import ProgrammingError, connection | ||
from django.utils import timezone | ||
|
||
from canopeum_backend import settings | ||
import canopeum_backend.settings | ||
from canopeum_backend.models import ( | ||
Announcement, | ||
Asset, | ||
|
@@ -145,8 +145,8 @@ def create_posts_for_site(site): | |
# Create a post for the site | ||
post = Post.objects.create( | ||
site=site, | ||
body=f"""{site.name} has planted {random.randint(100, 1000)} new trees today. | ||
Let's continue to grow our forest!""", | ||
body=f"{site.name} has planted {random.randint(100, 1000)} new trees today. " | ||
+ "Let's continue to grow our forest!", | ||
share_count=share_count, | ||
) | ||
# Change created_at date since it is auto-generated on create | ||
|
@@ -266,7 +266,7 @@ def handle(self, *args, **kwargs): | |
try: | ||
for asset in assets_to_delete: | ||
path = ( | ||
Path(settings.BASE_DIR) | ||
Path(canopeum_backend.settings.BASE_DIR) | ||
/ "canopeum_backend" | ||
/ "media" | ||
/ asset.asset.name | ||
|
@@ -349,7 +349,9 @@ def create_site_types(self): | |
) | ||
|
||
def create_assets(self): | ||
seeding_images_path = Path(settings.BASE_DIR) / "canopeum_backend" / "seeding" / "images" | ||
seeding_images_path = ( | ||
Path(canopeum_backend.settings.BASE_DIR) / "canopeum_backend" / "seeding" / "images" | ||
) | ||
image_file_names = ( | ||
"site_img1.png", | ||
"site_img2.jpg", | ||
|
@@ -374,39 +376,39 @@ def create_users(self): | |
User.objects.create_user( | ||
username="admin", | ||
email="[email protected]", | ||
password="Adminbeslogic!", # noqa: S106 MOCK_PASSWORD | ||
password="Adminbeslogic!", # noqa: S106 # MOCK_PASSWORD | ||
is_staff=True, | ||
is_superuser=True, | ||
role=Role.objects.get(name="MegaAdmin"), | ||
) | ||
User.objects.create_user( | ||
username="TyrionLannister", | ||
email="[email protected]", | ||
password="tyrion123", # noqa: S106 MOCK_PASSWORD | ||
password="tyrion123", # noqa: S106 # MOCK_PASSWORD | ||
role=Role.objects.get(name="SiteManager"), | ||
) | ||
User.objects.create_user( | ||
username="DaenerysTargaryen", | ||
email="[email protected]", | ||
password="daenerys123", # noqa: S106 MOCK_PASSWORD | ||
password="daenerys123", # noqa: S106 # MOCK_PASSWORD | ||
role=Role.objects.get(name="SiteManager"), | ||
) | ||
User.objects.create_user( | ||
username="JonSnow", | ||
email="[email protected]", | ||
password="jon123", # noqa: S106 MOCK_PASSWORD | ||
password="jon123", # noqa: S106 # MOCK_PASSWORD | ||
role=Role.objects.get(name="SiteManager"), | ||
) | ||
User.objects.create_user( | ||
username="OberynMartell", | ||
email="[email protected]", | ||
password="oberyn123", # noqa: S106 MOCK_PASSWORD | ||
password="oberyn123", # noqa: S106 # MOCK_PASSWORD | ||
role=Role.objects.get(name="SiteManager"), | ||
) | ||
User.objects.create_user( | ||
username="NormalUser", | ||
email="[email protected]", | ||
password="normal123", # noqa: S106 MOCK_PASSWORD | ||
password="normal123", # noqa: S106 # MOCK_PASSWORD | ||
role=Role.objects.get(name="User"), | ||
) | ||
|
||
|
@@ -437,7 +439,7 @@ def create_canopeum_site(self): | |
image=Asset.objects.first(), | ||
announcement=Announcement.objects.create( | ||
body="We currently have 20000 healthy seedlings of different species, " | ||
+ "ready to be planted at any time!" | ||
+ "ready to be planted at any time! " | ||
+ "Please click the link below to book your favorite seedlings on our website", | ||
link="https://www.canopeum-pos.com", | ||
), | ||
|
@@ -490,11 +492,9 @@ def create_other_sites(self): | |
), | ||
image=Asset.objects.get(asset__contains="site_img2"), | ||
announcement=Announcement.objects.create( | ||
body=""" | ||
Maple Grove Retreat is excited to announce our upcoming Maple Syrup Festival! | ||
Join us on March 15th for a day of maple syrup tastings, nature hikes, | ||
and family fun. Learn more on our website. | ||
""", | ||
body="Maple Grove Retreat is excited to announce our upcoming Maple Syrup " | ||
+ "Festival! Join us on March 15th for a day of maple syrup tastings, " | ||
+ "nature hikes, and family fun. Learn more on our website.", | ||
link="https://www.maplegroveretreat.com/events/maple-syrup-festival", | ||
), | ||
) | ||
|
@@ -514,8 +514,8 @@ def create_other_sites(self): | |
dd_longitude=-71.3075, | ||
address="456 Lakeview Road, Lac-Saint-Jean, QC G8M 1R9", | ||
), | ||
description="""Lakeside Oasis offers a tranquil retreat by the shores of Lac-Saint-Jean, | ||
with pristine waters and breathtaking sunsets.""", | ||
description="Lakeside Oasis offers a tranquil retreat by the shores of " | ||
+ "Lac-Saint-Jean, with pristine waters and breathtaking sunsets.", | ||
size="800", | ||
research_partnership=False, | ||
visible_map=True, | ||
|
@@ -563,10 +563,10 @@ def create_other_sites(self): | |
), | ||
image=Asset.objects.get(asset__contains="site_img4"), | ||
announcement=Announcement.objects.create( | ||
body="""Discover the wonders of Evergreen Trail! | ||
Our guided nature walks are now available every weekend. | ||
Immerse yourself in nature and learn about the diverse | ||
flora and fauna of Mont-Tremblant.""", | ||
body="Discover the wonders of Evergreen Trail! " | ||
+ "Our guided nature walks are now available every weekend. " | ||
+ "Immerse yourself in nature and learn about the diverse " | ||
+ "flora and fauna of Mont-Tremblant.", | ||
link="https://www.evergreentrail.com/guided-walks", | ||
), | ||
) | ||
|
18 changes: 18 additions & 0 deletions
18
canopeum_backend/canopeum_backend/migrations/0002_alter_batch_size.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 5.0.3 on 2024-05-15 18:52 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("canopeum_backend", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="batch", | ||
name="size", | ||
field=models.IntegerField(blank=True, null=True), | ||
), | ||
] |
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CC @NicolasDontigny This is how you do a classmethod in Python (ie: a method you call on the class itself, this is technically different than a static method, but this would be a static method in other languages)