Quick way is create one model with fields, that equals all params. I.e. for
your example - field with welcome text, two fields with banners and 3 fields
for links. So you'll have one record in table with all needed parametrs.
Of course this way isn't acceptable if you'll have over hundred params, but if
it is ~10-20 params - it is the easiest and most suitable option.
> Hi,
>
> Could please somebody advice how to store application settings and allow to
> edit them via admin panel? Settings are used site-wide, not on per user
> basis.
>
> This settings have different types ( text, ineteger, images aka banners )
> therefore it looks impossible to create "settings" model and store it in
> "item" - "value" fields.
>
> From the other hand it looks unreasonable to make a lot of models and put
> one or two rows into each of them.
>
> What is the best practice for that?
>
> ps. For example I have to allow configure following things: welcome text, 2
> banners and 3 links to item from foreign application. It is easy to
> hardcode them into template, but it would be very a bit annoying to edit
> the code each time to modify something from it.
> --
> wbr,
> rush.
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group. To unsubscribe from this group and stop receiving
> emails from it, send an email to django-users+unsubscribe@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com. Visit
> this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment