sqladmin icon indicating copy to clipboard operation
sqladmin copied to clipboard

Add messages support

Open jonocodes opened this issue 1 year ago • 11 comments

Checklist

  • [X] There are no similar issues or pull requests for this yet.

Is your feature related to a problem? Please describe.

I would like to display feedback to users after a form submission, not just error messages. This would allow for warnings and success messages.

Describe the solution you would like.

Django Admin uses this https://docs.djangoproject.com/en/dev/ref/contrib/messages/#django.contrib.messages.add_message

Describe alternatives you considered

No response

Additional context

I may be willing to work on this, if there is interest.

jonocodes avatar Jan 19 '24 23:01 jonocodes

@jonocodes Feel free to contribute to this if you want.

aminalaee avatar May 08 '24 13:05 aminalaee

Do you mean "flash" messages from Flask?

hasansezertasan avatar May 08 '24 17:05 hasansezertasan

Do you mean "flash" messages from Flask?

I have not used Flask, but looking at that it does seem to be what I'm talking about.

jonocodes avatar May 08 '24 18:05 jonocodes

Do you mean "flash" messages from Flask?

I have not used Flask, but looking at that it does seem to be what I'm talking about.

I recommend you to check starlette-flash package.

It's very light but depends on SessionMiddleware to work.

hasansezertasan avatar May 08 '24 23:05 hasansezertasan

Thanks. I got this working in my project. Here is what is looks like:

image

I roughly followed this: https://medium.com/@arunksoman5678/fastapi-flash-message-like-flask-f0970605031a

Which works with like your middleware suggestion above. And then it uses tabler's alert components.

Once I figure out how to get a dev setup in sqladmin I will submit it there.

jonocodes avatar May 14 '24 18:05 jonocodes

Perfect, thanks

aminalaee avatar May 14 '24 19:05 aminalaee

In practice how does one go about developing a feature in the core project? Do I start a demo project locally and link in the local sqladmin libs to see the changes there? Is there a particular demo to work off?

jonocodes avatar May 14 '24 22:05 jonocodes

You can check this: https://github.com/aminalaee/sqladmin/blob/main/CONTRIBUTING.md Chances are some steps might be old or wrong, but it should give you the idea how to contribute.

aminalaee avatar May 15 '24 08:05 aminalaee

You can check this: https://github.com/aminalaee/sqladmin/blob/main/CONTRIBUTING.md Chances are some steps might be old or wrong, but it should give you the idea how to contribute.

That doc explains how to checkout and build. But where do I actually run something to see my changes?

jonocodes avatar May 15 '24 11:05 jonocodes

You can see the tests. You setup an example application within the project and when you run that example app it shows your changes.

aminalaee avatar May 15 '24 15:05 aminalaee

WIP: https://github.com/aminalaee/sqladmin/pull/770

jonocodes avatar May 15 '24 20:05 jonocodes