Auto Create Cards #635

Open
opened 2026-02-04 20:38:37 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @JordanPicton on GitHub (Jan 22, 2025).

Is this a feature for the backend or frontend?

Backend

What would you like?

I would like to be able to setup a certain task and I assume this would be helpful for others too.

The idea is to have a way for automatic creation of a card basically. For example right now I'm using Plankanban to keep track of daily things that I need to do, not in the same way as Notion but I can give an example below.

Image

Before I get told, I know I'm bad at consistency but this is due to change, anyway the thing I'd be looking for is to have an automated way to take the previous day card and then create a new one that removes the checked boxes and transfer the unchecked ones to the new day keeping the cycle going.

I'm sorry if I didn't explain this in an easy way but I'll summarise below:
Todo list card, new card is created for the next day, using the previous card it removes all the items that have been checked (completed) and copies over the unchecked content to this new card.

Thanks in advance,
~Jordan

Why is this needed?

Not really needed but automation is key and having it would save time from duplicating the card manually, changing the title, dragging it to the top, and then removing the checked boxes.

Other information

No response

Originally created by @JordanPicton on GitHub (Jan 22, 2025). ### Is this a feature for the backend or frontend? Backend ### What would you like? I would like to be able to setup a certain task and I assume this would be helpful for others too. The idea is to have a way for automatic creation of a card basically. For example right now I'm using Plankanban to keep track of daily things that I need to do, not in the same way as Notion but I can give an example below. ![Image](https://github.com/user-attachments/assets/2075c33d-e143-42d4-aa27-164c02947253) Before I get told, I know I'm bad at consistency but this is due to change, anyway the thing I'd be looking for is to have an automated way to take the previous day card and then create a new one that removes the checked boxes and transfer the unchecked ones to the new day keeping the cycle going. I'm sorry if I didn't explain this in an easy way but I'll summarise below: Todo list card, new card is created for the next day, using the previous card it removes all the items that have been checked (completed) and copies over the unchecked content to this new card. Thanks in advance, ~Jordan ### Why is this needed? Not really needed but automation is key and having it would save time from duplicating the card manually, changing the title, dragging it to the top, and then removing the checked boxes. ### Other information _No response_
Author
Owner

@batthias commented on GitHub (Jan 24, 2025):

I would kind of assume this (and many other things) could be achieved using something similar to Trello‘s "Automation" features. Having something like that could solve many of those use cases.

Certainly that feature is what still keeps me on Trello instead of just using a self hosted planka instance for everything.

Potentially one could just allow priviledged users to write custom javascript "hooks" per project (instead of having to invent a "user friendly" interface) that get called at certain points.

@batthias commented on GitHub (Jan 24, 2025): I would kind of assume this (and many other things) could be achieved using something similar to Trello‘s _"Automation"_ features. Having something like that could solve many of those use cases. Certainly that feature is what still keeps me on Trello instead of just using a self hosted planka instance for everything. Potentially one could just allow priviledged users to write custom javascript "hooks" per project (instead of having to invent a "user friendly" interface) that get called at certain points.
Author
Owner

@hwelch-fle commented on GitHub (Jan 24, 2025):

Edit: I've added this to the examples directory in the plankapy repo if you want to pull it from there

I've written a python API interface for Planka called plankapy that can accomplish this with some pretty simple scripting:

import plankapy as ppy
from plankapy import Planka, PasswordAuth


from datetime import datetime, timedelta, date

def get_project_by_name(planka: Planka, name: str):
    for project in planka.projects:
        if project.name == name:
            return project
    return None

def get_board_by_date(project: ppy.Project, date: date):
    for board in project.boards:
        if board.name == f"{date.year}":
            return board
    return None

def get_card_by_date(list: ppy.List, date: date):
    for card in list.cards:
        if card.name == f"Todo {date.day}/{date.month}/{date.year}":
            return card
    return None

def get_list_by_date(board: ppy.Board, date: date):
    for list in board.lists:
        if list.name == f"{date.strftime('%B')} {date.year}":
            return list
    return None

def main():
    planka = Planka('http://localhost:3001/', auth=PasswordAuth("demo", "demo"))
    
    today = datetime.now().date()
    yesterday = today - timedelta(days=1)
    
    project = get_project_by_name(planka, "Daily Tasks")
    if not project:
        print("Project not found")
        return

    yesterday_board = get_board_by_date(project, yesterday)
    if not yesterday_board:
        print("Yesterday's Board not found")
        return
    
    yesterday_list = get_list_by_date(yesterday_board, yesterday)
    if not yesterday_list:
        print("Yesterday's List not found")
        return
    
    yesterday_card = get_card_by_date(yesterday_list, yesterday)
    if not yesterday_card:
        print("Yesterday's Card not found")
        return
    
    today_board = get_board_by_date(project, today)
    if not today_board:
        today_board = project.create_board(f"{today.year}")
        print(f"Created board for {today.year}")
    
    today_list = get_list_by_date(today_board, today)
    if not today_list:
        today_list = today_board.create_list(f"{today.strftime('%B')} {today.year}")
        print(f"Created List for {today.strftime('%B')} {today.year}")
        
    today_card = get_card_by_date(today_list, today)
    if not today_card:
        print(f"Creating Card for {today.strftime('%d/%m/%Y')}")
        today_card = yesterday_card.duplicate()
        today_card.move(today_list)
        with today_card.editor():
            today_card.name = f"Todo {today.day}/{today.month}/{today.year}"
            today_card.position = 0
            
        for task in today_card.tasks:
            if task.isCompleted:
                print(f"{task.name} completed on {yesterday.strftime('%d/%m/%Y')}, good job!")
                task.delete()
                
    else:
        print("Today's Card already exists!")
    
    print("Created Today's Card")
    
if __name__ == '__main__':
    main()

This script will also handle the creation of new boards and lists as needed if the previous day falls on a different month or year (utilizing the timedelta object in the python standard datetime package)

Initial State:
Image

State after running script:

Image

To use this, just pip install plankapy and run this in your terminal manually or set up a chron job to run it every morning!

@hwelch-fle commented on GitHub (Jan 24, 2025): Edit: I've added this to the [`examples`](https://github.com/hwelch-fle/plankapy/blob/main/examples/rolling_todo_cards.py) directory in the plankapy repo if you want to pull it from there I've written a python API interface for Planka called [plankapy](https://github.com/hwelch-fle/plankapy) that can accomplish this with some pretty simple scripting: ```python import plankapy as ppy from plankapy import Planka, PasswordAuth from datetime import datetime, timedelta, date def get_project_by_name(planka: Planka, name: str): for project in planka.projects: if project.name == name: return project return None def get_board_by_date(project: ppy.Project, date: date): for board in project.boards: if board.name == f"{date.year}": return board return None def get_card_by_date(list: ppy.List, date: date): for card in list.cards: if card.name == f"Todo {date.day}/{date.month}/{date.year}": return card return None def get_list_by_date(board: ppy.Board, date: date): for list in board.lists: if list.name == f"{date.strftime('%B')} {date.year}": return list return None def main(): planka = Planka('http://localhost:3001/', auth=PasswordAuth("demo", "demo")) today = datetime.now().date() yesterday = today - timedelta(days=1) project = get_project_by_name(planka, "Daily Tasks") if not project: print("Project not found") return yesterday_board = get_board_by_date(project, yesterday) if not yesterday_board: print("Yesterday's Board not found") return yesterday_list = get_list_by_date(yesterday_board, yesterday) if not yesterday_list: print("Yesterday's List not found") return yesterday_card = get_card_by_date(yesterday_list, yesterday) if not yesterday_card: print("Yesterday's Card not found") return today_board = get_board_by_date(project, today) if not today_board: today_board = project.create_board(f"{today.year}") print(f"Created board for {today.year}") today_list = get_list_by_date(today_board, today) if not today_list: today_list = today_board.create_list(f"{today.strftime('%B')} {today.year}") print(f"Created List for {today.strftime('%B')} {today.year}") today_card = get_card_by_date(today_list, today) if not today_card: print(f"Creating Card for {today.strftime('%d/%m/%Y')}") today_card = yesterday_card.duplicate() today_card.move(today_list) with today_card.editor(): today_card.name = f"Todo {today.day}/{today.month}/{today.year}" today_card.position = 0 for task in today_card.tasks: if task.isCompleted: print(f"{task.name} completed on {yesterday.strftime('%d/%m/%Y')}, good job!") task.delete() else: print("Today's Card already exists!") print("Created Today's Card") if __name__ == '__main__': main() ``` This script will also handle the creation of new boards and lists as needed if the previous day falls on a different month or year (utilizing the `timedelta` object in the python standard `datetime` package) Initial State: ![Image](https://github.com/user-attachments/assets/0c4b4af1-40c2-46b0-8c72-b5df65004a33) State after running script: ![Image](https://github.com/user-attachments/assets/7ce25f5a-7840-47d8-a4d8-f9af755f7736) To use this, just `pip install plankapy` and run this in your terminal manually or set up a chron job to run it every morning!
Author
Owner

@JordanPicton commented on GitHub (Jan 26, 2025):

I'll have to give this a look when I'm back home, though how would this work when it comes to running Planka via docker compose?

@JordanPicton commented on GitHub (Jan 26, 2025): I'll have to give this a look when I'm back home, though how would this work when it comes to running Planka via docker compose?
Author
Owner

@hwelch-fle commented on GitHub (Jan 26, 2025):

I'll have to give this a look when I'm back home, though how would this work when it comes to running Planka via docker compose?

It's interacting with Planka using a user account and an endpoint. You'd just have to run the script from a computer that can access your planka instance and it'll work.

This is entirely standalone from Planka itself, so you don't need to do any additional setup beyond pip install plankapy, writing your script, then running it.

@hwelch-fle commented on GitHub (Jan 26, 2025): > I'll have to give this a look when I'm back home, though how would this work when it comes to running Planka via docker compose? It's interacting with Planka using a user account and an endpoint. You'd just have to run the script from a computer that can access your planka instance and it'll work. This is entirely standalone from Planka itself, so you don't need to do any additional setup beyond `pip install plankapy`, writing your script, then running it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/planka#635