shacker / django-todo

A multi-user, multi-group todo/ticketing system for Django projects. Includes CSV import and integrated mail tracking.
http://django-todo.org
BSD 3-Clause "New" or "Revised" License
823 stars 286 forks source link

Assign task to multiple people #65

Open james1293 opened 5 years ago

james1293 commented 5 years ago

Hello all, I just started using Django todo, and I love the simplicity of it. I recently hacked together a fork (locally, not on GitHub) that allows a task to be assigned to multiple users. It's not perfect yet, but would this be something worth sharing? If so, would it be the sort of thing that would stay as a fork, or could it be incorporated into the main project repo? (I haven't contributed much on GitHub, so that's why I'm asking for etiquette advice.) Thanks!

shacker commented 5 years ago

Hi James - this is a great idea. It should be as simple as converting the ForeignKey from Task to User to a ManyToMany field, and modifying the UI to allow multi-assignment. It would also have to ensure that emails are sent to all of the right parties.

The general process for contributing to open source on github is this:

1) Fork the project (you already have) 2) Make your changes in a branch and push the branch to your fork's repo 3) Make a pull request for that branch, targeted at this repo 4) We'll go through the review process - I'll suggest changes, you'll push additional commits 5) I'll merge it and it will be in!

Thanks.

GoldenBookCover commented 5 years ago

I tried simply converting the ForeignKey from Task to User to a ManyToMany field, it worked almost correctly, except the task_detail view, where i couldn't update the "Assigned to:" column. However it worked fine when creating a new task, or editing the task from the admin panel. Any suggestion?

james1293 commented 5 years ago

Two things - You have to add form.save_m2m() For the list display, I did .join(", ")

shacker commented 5 years ago

@MonstreCharmant You would need to replace the Assigned To dropdown with some sort of multiple-choice selection widget. Or did you do that already and I'm misunderstanding the question?

GoldenBookCover commented 5 years ago

Thank you guys, I just added form.save_m2m(), it worked fine. The code looks like this now, I'm not sure if there is any impact to my data?

# from task_detail.py --> def task_detail() --> # Save task edits
if form.is_valid():
            item = form.save(commit=False)
            item.note = bleach.clean(form.cleaned_data["note"], strip=True)
            item.save()
            form.save_m2m()
            messages.success(request, "The task has been edited.")
            return redirect(
                "todo:list_detail",
                list_id=task.task_list.id,
                list_slug=task.task_list.slug,
            )
james1293 commented 5 years ago

@MonstreCharmant I added form.save_m2m() in the same place, and it seems to be working. Would you like to share your fork, or do you want me to share mine? Mine is messy (I commented tests that didn't work any more, and I disabled the email notifications) but I could share it as-is anyway...

shacker commented 5 years ago

Still hoping that one of you can share your changes back to the mother project here! Pull request please?

GoldenBookCover commented 5 years ago

Yes, will do that. Working on some jobs now, but I'll share my changes once I got some time.

f4i5i commented 3 years ago

Yes, will do that. Working on some jobs now, but I'll share my changes once I got some time.

can you share your changes

james1293 commented 3 years ago

I'm sorry that I never did share mine. I'm no longer working at the job where I was working on this, so I don't think that I would be able to access the code easily. If you decide to reimplement it, I wish you the best of luck.

f4i5i commented 3 years ago

can you guide me how you done the task few tips

james1293 commented 3 years ago

It has been 2 years, so I don't remember a lot of the details. It was something like this:

Feel free to ask follow-up questions. :slightly_smiling_face:

f4i5i commented 3 years ago

okay what for selection of users from template

james1293 commented 3 years ago

I think I started by making sure it worked using the default multi-select interface. Then, once I was sure that that worked, I figured out how to use the pretty widget from the Django admin. There's some advice here (I recommend reading the comments on that answer).

Does that make sense?

f4i5i commented 3 years ago

todo

f4i5i commented 3 years ago

it show something like this and the values not saving in db and i want to make check box to select multiple users

f4i5i commented 3 years ago

one error is this that it show account.customuser.none task 2

james1293 commented 3 years ago

Did you add form.save_m2m() as discussed earlier in this thread? That may be the reason why it's not saving.

I've never tried doing the checkboxes.

f4i5i commented 3 years ago

yes i do

james1293 commented 3 years ago

I don't think there's much more I can do to help right now.

diogne commented 3 years ago

one error is this that it show account.customuser.none task 2

I had the same issue of m2m fields being rendered with this "none" thing in a table. Have you tried to add something like this in the template ? <td> {% for customuser in accounts.customuser.all %} {{ customuser.name }} {% endfor %} </td>

This loop worked fine for me, I hope it will help you ! ps : first comment ever on GitHub - please let me know if I broke any etiquette ^^

james1293 commented 3 years ago

@diogne thank you, hopefully @f4i5i finds that helpful! :slightly_smiling_face:

If you want, you can submit a pull request to accomplish what I never succeeded in finishing :sweat_smile:

By the way, just so you know about the feature: if you want to put multiple lines of code, a way to do it is to indent them, like this:

these words have four spaces before them
which makes them render as monospace font
diogne commented 3 years ago

Many thanks for your kind reply and the tips ! I appreciate it !

bernd-wechner commented 3 years ago

This is a great idea and it would rock if someone PRed it.

palrohitg commented 3 years ago

@bernd-wechner what is the credentials to log

bernd-wechner commented 3 years ago

@bernd-wechner what is the credentials to log

Sorry, but I'm not sure what you're asking. Can you clarify?