Skip to content

Commit

Permalink
Fix bot fakerun while migrations, install correct package for phonefield
Browse files Browse the repository at this point in the history
  • Loading branch information
merkme-portfolio committed May 6, 2024
1 parent 4a245ee commit fb36c6a
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 10 deletions.
25 changes: 24 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ python-telegram-bot = "^21.1.1"
poetry-plugin-export = "^1.7.1"
django-environ= "^0.11.2"
django-asgi-lifespan = "^0.3.1"
django-phonenumber-field = "^7.3.0"
django-phonenumber-field = {extras = ["phonenumbers"], version = "^7.3.0"}

[tool.poetry.group.dev.dependencies]
ruff = "^0.4.2"
Expand Down
13 changes: 7 additions & 6 deletions src/bot/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ def stop_bot(self, **kwargs):
def ready(self) -> None:
"""Perform actions when the application is ready."""
import os

if os.environ.get("DJANGO_MIGRATE", False):
if os.environ.get("RUN_MAIN", None) != "true":
from bot.bot_interface import Bot

if os.environ.get("RUN_MAIN", None) != "true":
from bot.bot_interface import Bot
self.bot = Bot()

self.bot = Bot()
asgi_shutdown.connect(self.stop_bot)

asgi_shutdown.connect(self.stop_bot)

self.bot.start()
self.bot.start()
2 changes: 1 addition & 1 deletion src/core/config/settings_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"schooling.apps.SchoolingConfig",
]

EXTERNAL_APPS = []
EXTERNAL_APPS = ["phonenumber_field",]

INSTALLED_APPS = DEFAULT_APPS + EXTERNAL_APPS + LOCAL_APPS

Expand Down
2 changes: 1 addition & 1 deletion src/potential_user/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ApplicationForm(models.Model):
)

telegram_id = models.IntegerField("Telegram ID", unique=True)
role = models.CharField(choices=ROLE_CHOICES)
role = models.CharField(choices=ROLE_CHOICES, max_length=20)
name = models.CharField(max_length=20)
surname = models.CharField(max_length=20)
city = models.CharField(max_length=20)
Expand Down

0 comments on commit fb36c6a

Please sign in to comment.