Custom Model action in Django Admin

29 views
Skip to first unread message

Anubhav Madhav

unread,
May 27, 2020, 4:31:28 AM5/27/20
to Django users
Hello everyone!!

I have stuck in the middle of my project. Please help.


I have created a custom function within a model, which sends a newsletter email to the subscribed users. I registered this model action in admins.py , so that I can perform that action using admin panel.

After that, when I go to django admin panel, and perform the action , it shows me an error:

ValueError at /admin/blog/post/

not enough values to unpack (expected 2, got 1)

How can I fix this? Please help!!

Anubhav Madhav

unread,
May 27, 2020, 5:00:10 AM5/27/20
to Django users
Please refer to this to understand the doubt more clearly: https://stackoverflow.com/questions/62038925/custom-model-action-function-in-django-admin 

Anubhav Madhav

unread,
May 27, 2020, 6:31:34 AM5/27/20
to Django users
Okay!! I have solved it myself:
the mistake was that 'subscribers' is itself a list, so 'to_email' should be 'sub' instead of '[sub]'.

Thank You 

On Wednesday, 27 May 2020 14:01:28 UTC+5:30, Anubhav Madhav wrote:
Reply all
Reply to author
Forward
0 new messages