开发者

What am I doing wrong with reusable Django apps?

Almost always when I try to use a re-usable django app, I e开发者_运维百科nd up doing a lot of integration work and/or the end result is really messy.

A common, simpler case is sending confirmation messages (with link text framework) to the user, for events that take place in the re-usable app. Take for example django-profiles - in order to show a "profile succesfully saved" message, I would typically wrap the original view function, see if it returns a HttpResponseRedirect and show the message if so. Then return the original response.

What I don't like in this is that it's ugly (relying on the return type) and I have to add a whole view just to show the message.

So,

  • what am I doing wrong?
  • Is it not customary to show confirmation messages to users?
  • Would it make sense for re-usable apps to also accept optional user messages as the view parameters?
  • Wouldn't it be nice if re-usable apps used signals a lot more to allow hooking custom functionality?


Is it not customary to show confirmation messages to users?

Yes, it is.

Would it make sense for re-usable apps to also accept optional user messages as the view parameters?

Possibly, yes.

Wouldn't it be nice if re-usable apps used signals a lot more to allow hooking custom functionality?

Most certainly, yes.

what am I doing wrong?

You are using an app that does not meet the above criteria as well as it should. This is not entirely hard to fix. You could always roll your own app that meets the criteria you have set above. Alternately you can submit patches to the app in question.

As Eric Florenzano recently pointed out there are warts in the Django ecosystem. Several of them. Tightly coupled "reusable" apps is one of them. Eric also suggested remedies but they will take time to get rolling. In the meantime you can help accelerate the process by setting examples one way or the other.

I know, this answer is not too helpful. I wish I had a better answer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜