Feat/update django telegram app 1 0 0#53
Merged
Conversation
This app contains base classes to be used in this project. They subclass the base classes of django_telegram_app, but with project-specific fields and behaviour. The settings have also been update to include telegram in INSTALLED_APPS, use a swapped telegram_settings model and hide the ModelAdmin for telegram_settings model as we use the inlined one on the user
These references have been replaced to point to the custom TelegramCommand and TelegramStep for better type inference. Management commands now point to IdaBaseManagementCommand to ensure it's localized and only ran for active users
django-telegram-app renamed their BaseCommand and BaseTelegramCommand to BaseBotCommand and BaseManagementCommand respectively
for management commands we just update references to BaseManagementCommand. for bot commands we change the calls to create callbacks to the new style where we pass original_data and then kwargs
Owner
Author
|
This has some breaking changes and we reintroduce telegram app, so we need to run some custom scripts on the instance again. 1. Run thisimport sqlite3
# Connect sqlite3 db.sqlite3
conn = sqlite3.connect("db.sqlite3")
cursor = conn.cursor()
# Reset django_migrations entries for telegram
cursor.execute("""
DELETE FROM django_migrations
WHERE app='telegram';
""")
# Commit and close connection
conn.commit()
conn.close()2. Run migrations3. Run thisimport sqlite3
# Connect sqlite3 db.sqlite3
conn = sqlite3.connect("db.sqlite3")
cursor = conn.cursor()
# Move data from django_telegram_app_telegramsettings to telegram_telegramsettings
cursor.execute("""
INSERT INTO telegram_telegramsettings (id, chat_id, data, updated_at, user_id)
SELECT id, chat_id, data, updated_at, user_id FROM django_telegram_app_telegramsettings;
""")
# truncate django_telegram_app_telegramsettings table
cursor.execute("""
DELETE FROM django_telegram_app_telegramsettings;
""")
# Commit and close connection
conn.commit()
conn.close() |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.