Skip to content

A very simple django project that helps understanding some concepts about the Django Q implementation. It uses a telegram API to create Clients and make subscriptions via a task management system.

License

Notifications You must be signed in to change notification settings

abxsantos/myscheduler

Repository files navigation


My Django Q Scheduler

A very simple django project that helps understanding some concepts about the Django Q implementation. It uses a telegram API to create Clients and make subscriptions via a task management system.

Report Bug **·** Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About The Project

This is a very simple Django to demonstrate how to implement the task manager and scheduler Django Q.

This application also uses the Telegram API to provide an interacting interface with users.

The main logic behind this application is to register a Client into the database, using information from the telegram context. To register, the person must use the command /register <provided cpf numbers> passing in a valid CPF. This will create a Client into the database with a pending cpf validation status.

The CPF will be validated using a Django Q Task, that is also created with the Client. This task, will request the 4devs API sending the registered client CPF and return a message to the user via telegram informing the CPF validation status.

A registered Client can also subscribe to receive an hourly message containing an activity from the bored API.

This is managed via a Django Q hourly Scheduler, that will request the bored API for a new activity

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

This project needs a valid telegram token to run successfully. For that you can access the telegram bots documentation.

To run this project you must either run it using docker, or use python version 3.9.5 in your local environment.

If you are running locally, you must also provide a PostgreSQL database!

  • Running with docker
    docker-compose up --build app
  • Running locally
    pip install poetry
    poetry install
    bash scripts/start.sh

Usage

After cloning the repository you need to start the application. To do that, you need to run the start.sh script.

If you used docker-compose, when using docker-compose up --build app the command will already run the start script

The application interface is on the telegram app.

  1. Add the @myscheduler_django_bot in the telegram app.

  2. Use the /register <cpf> command passing in a CPF number in the <cpf> field.

    Ex.: /register 12345678910

  3. Subscribe to receive an hourly message with the /subscribe command. For this to work you must have a used a register command.

  4. To unsubscribe simply use the /unsubscribe command

  5. To unregister, simple use the /unregister command.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/my_awesome_feature)
  3. Commit your Changes (git commit -m 'feat: adds some Amazing Feature')
  4. Push to the Branch (git push origin feature/my_awesome_feature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Alexandre Xavier - ale.bxsantos@gmail.com

Project Link: https://github.com/abxsantos/my-djangoq-scheduler

About

A very simple django project that helps understanding some concepts about the Django Q implementation. It uses a telegram API to create Clients and make subscriptions via a task management system.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published