darklow / django-suit

Modern theme for Django admin interface
http://djangosuit.com/
Other
2.31k stars 700 forks source link

Django Suit version 2.0 #475

Open darklow opened 8 years ago

darklow commented 8 years ago

Brace yourselves, this is going to be a long post!

I have bad news and good news. The bad news is - Bootstrap 3 branch will be discontinued. The good news is what is coming instead! 

Some history

Some time after i launched the very first Django Suit (DS) version I realised biggest challenge is to keep up with Django admin changes. And bs3 branch version proved that even more. I haven’t finished it yet as Django admin started changing quite a lot. New templates, new features, new styles etc. Third party apps are also changing and evolving a lot, therefore same problem existed with 3rd party apps too. I knew i needed to solve this issue before continuing.

Flexbox

Recently I did a lot of thinking and experimenting and because browsers have evolved significantly I found an answer to my problems - Flexbox. I’ve been working on Django Suit fresh rewrite for few weeks and haven’t overridden a single Django admin template and in the end of the post you can see real screenshot of what i achieved by CSS only.

So this is a short story how Django Suit v2.0 rewrite started.

I will try to avoid any Django admin templates override as long as possible and if needed i will use JS DOM manipulations instead of overriding templates, which gives a few huge benefits: When Django admin templates changes, some minor visual bugs may appear, but it will not break anything.

Without overriding admin templates, we have much wider 3rd party app support. Any app that haven’t modified templates too much and use Django admin markup should work perfectly. This gives us much wider Django version support range, however I think Django Suit will stay with 2-3 recent version support.

What’s new in Django Suit v2

So here is the current state of v2.0 rewrite. No templates overridden except base_site.html:

image

Todo:

If you're ok with incomplete features and missing documentation (demo app with all examples is included) then feel free to install or even use it for production (I personally use it in production for a few projects already):

pip install https://github.com/darklow/django-suit/tarball/v2

In requirements.txt:

 -e git://github.com/darklow/django-suit.git@v2#egg=django-suit

Work in progress links: v2 demo: http://v2.djangosuit.com/admin/ v2 branch: https://github.com/darklow/django-suit/tree/v2 v2 docs: http://django-suit.readthedocs.org/en/v2/

Feel free to share your thoughts.

darklow commented 7 years ago

@uniqe15 In my first post in this issue I wrote how to install v2-dev: https://github.com/darklow/django-suit/issues/475#issue-130059324 however there is no example for inlines in inlines included yet.

geekashu commented 7 years ago

@darklow It seems django-debug-toolbar is not working with v2. Would appreciate if you could please check at your end.

darklow commented 7 years ago

@geekashu It is working but is getting hidden. It bootstrap fault, this line hides it https://github.com/twbs/bootstrap/blob/v4-dev/scss/_reboot.scss#L391 I will look forward to override it somehow.

darklow commented 7 years ago

@geekashu I just fixed Django Debug Toolbar problem, just reinstall v2-dev:

pip uninstall django-suit
pip install https://github.com/darklow/django-suit/tarball/v2
AliPolat commented 7 years ago

thank you,.. hoping for nested inline demo soon..

geekashu commented 7 years ago

yup it works now... thanku...

mzbyszewska commented 7 years ago

I' using Django Suit v2. Is it possible to show Suit menu at frontend?

darklow commented 7 years ago

@mzbyszewska I don't think so, at least not in an easy way, Django Suit is "skin/addon" specifically for Django admin app and highly relies on it's context variables.

mzbyszewska commented 7 years ago

It seems that I should slightly overwritte your get_menu tag in case "if not available_apps" and fake available_apps for frontend. Then the MenuManager will has chance to read custom SuitConfig.

geekashu commented 7 years ago

I am using custom formset for my inline admin, inline formset are doing some custom validation and raises a ValidationError if certain criteria doesn't met for all the forms.

Now it seems triggered error messages are not able to use errorlist css class from suit.css and renders them as plain black colored text.

darklow commented 7 years ago

@geekashu please open new issue and provide a screenshot, I can't reproduce.

dwasyl commented 7 years ago

@darklow this update looks great, just looking into trying this out for the first time. That said, nested inlines is a huge feature for a few projects of mine and it would be great to see support for it. At the moment, I've used dj-nested-inlines before, and it seems that django-nested-admin has support for the current version of django-suit. It would be great to see this continue through a 3rd party module or just be builtin.

While there aren't necessarily a ton of use-cases there are a few where it's pretty indispensable.

darklow commented 7 years ago

Note about v2 support for Django 1.8 (LTE) @gamesbook.

For a few days I've been trying to add support for Django 1.8 and it isn't so easy and I am considering not adding it for upcoming v2. Although 1.8 is long-term release it is missing some important features which made Django Suit v2 so easy and clean to develop.

The thing is in Django 1.9+ template loader was updated and improved which made possible to extend Django admin templates in very simple and clean way without overriding whole change_form.html and other main Django admin templates files, but just few parts of it.

In order to support Django 1.8 I would need to go back to fully copy/pasting full change_form.html and other file content and making appropriate changes, which would make problems supporting 3rd party apps "out-of-the-box" and other issues.

Current Django v2-dev already supports Django 1.9 and Django 1.10.

I think I must look forward this time and not breaking nice and simple things I created to support Django 1.8 for which mainstream support has already ended and only security fixes will be added. https://www.djangoproject.com/download/

By the way Django 1.10 which is already out has support until December 2017 (just 4x months difference to Django 1.8)

For those who need Django 1.8 version support, let me know what you think. PS. Django 1.8 users can still use 0.2.x branch.

darklow commented 7 years ago

@chris-erickson, @gamesbook good news!

Forget my previous post, persistent trying and tests resulted in success and I found a way to support all three Django 1.8, 1.9 and 1.10 versions. I merged inv2-django18 branch into https://github.com/darklow/django-suit/tree/v2 and now you can try it out.

Django 1.8 still have some cosmetic issues and some legacy css classes that need some attention, but so far it works.

Feel free to test it with Django 1.8:

pip uninstall django-suit
pip install https://github.com/darklow/django-suit/tarball/v2
gamesbook commented 7 years ago

That is good news. We are scheduled to update to 1.8 soon and would like to sync this change with Suitv2.

On 29 August 2016 at 17:13, Kaspars Sprogis notifications@github.com wrote:

@chris-erickson https://github.com/chris-erickson, @gamesbook https://github.com/gamesbook good news!

Forget my previous post, persistent trying and tests resulted in success and I found a way to support all three Django 1.8, 1.9 and 1.10 versions. I merged inv2-django18 branch into https://github.com/darklow/ django-suit/tree/v2 and now you can try it out.

Django 1.8 still have some cosmetic issues and some legacy css classes that need some attention, but so far it works.

Feel free to test it with Django 1.8:

pip uninstall django-suit pip install https://github.com/darklow/django-suit/tarball/v2

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/darklow/django-suit/issues/475#issuecomment-243154259, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVm67H1NcSRcmNTWiNZKjMeEfGCIQJKks5qkvcngaJpZM4HP7vt .

keyvanm commented 7 years ago

suit.js:199 Uncaught ReferenceError: Suit is not defined

darklow commented 7 years ago

@keyvanm Please open separate issue with more details, Django version etc.

keyvanm commented 7 years ago

546

heathernicoale commented 7 years ago

Love V2 so far! Convinced my supervisors to user for our development project. Question: are drop down lists for filters feasible for this version? Instead of or in place of the list_filter default?

darklow commented 7 years ago

@heathernicoale Yes, I will reimplement them as well for v2. "Horizontal list filters" checkbox in feature list

heathernicoale commented 7 years ago

@darklow - I see. I overlooked that, I apologize! Can't wait! :)

heathernicoale commented 7 years ago

Just out of curiosity - do you have a general idea of the release date for V2? :) This is such a great product so far!

ganmedia commented 7 years ago

Can you explain how to install version 2 on Digital Ocean Django One-Click Install Image? I have been trying using your tutorial but it never works.

Thanks.

darklow commented 7 years ago

@ganmedia I am not familiar with Digital Ocean and have no idea what One-Click install means. To install django-suit v2 you need to run:

pip install https://github.com/darklow/django-suit/tarball/v2

Or if you're using requirements.txt file then use following line (keeping space as first char):

 -e git://github.com/darklow/django-suit.git@v2#egg=django-suit
ganmedia commented 7 years ago

I did it but I got always the same error:

TemplateSyntaxError at /admin/ 'suit_tags' is not a valid tag library: ImportError raised loading suit.templatetags.suit_tags: No module named apps

darklow commented 7 years ago

@ganmedia please open a separate issue with some more details, full stacktrace, Django & python versions etc.

darklow commented 7 years ago

Two new features just added to v2-dev:

gamesbook commented 7 years ago

Hoping that we'll see an "official" release before year end - this would be a fantastic upgrade to offer clients for next year!

darklow commented 7 years ago

@gamesbook me too :) Funny or not one thing that holds me back for releasing something like public beta is not having done left side navigation. Since I like top/horizontal navigation much more I wouldn't use left side anymore. Hard to make/do something when you don't need it. You will never run out of vertical space, but you will run out of horizontal eventually and left side nav will help you do that even faster and then I got tens of issues about "my inlines doesn't fit in horizontally and wraps" kind of issues.

I've said it couple of times - I am already using v2-dev branch on all my production projects with no issues. In a way it is even more stable than master or discontinued bs3 branch. I guess that is another reason holding back. But I am close to releasing "official" version. As soon as I got my hands on new Documentation.

SanderTuit commented 7 years ago

@darklow Have you considered collapsible side navigation? It seems like that would work great on mobile and smaller screens: that way it wouldn't take up horizontal space if there isn't enough space.

darklow commented 7 years ago

@SanderTuit Yes I have, and that was my intention, but as you know for responsiveness you need extra time to handle all the layout changes, collapses etc. But in terms of essential features it wasn't in my priority list so far. First I wanted to deal with features that doesn't have alternative solutions. Right now list filters as dropdowns are next ones in the list.

gamesbook commented 7 years ago

@darklow In principle, you are right - infinite scrolling. But the trick is to fit the key data into limited vertical space without users having to scroll. I limit the default view to 10 or 15 rows for that reason. An optional "hider" on the sidebar (like bitbucket uses) also makes sense.

darklow commented 7 years ago

Had quite productive day.

Todo:

Suggestions and feedback are welcomed.

pip uninstall django-suit
pip install https://github.com/darklow/django-suit/tarball/v2
#apps.py
class SuitConfig(DjangoSuitConfig):
    layout = 'vertical'

image

gamesbook commented 7 years ago

Very happy to see "Return of the Left Menu". Will the location of the little icons (between the title and the menu itself) be repositionable? In the current version, the menu starts directly below top name; and we need as much vertical space as possible.

ganmedia commented 7 years ago

Great news, but where should I place apps.py to override SuitConfig?

darklow commented 7 years ago

@ganmedia You can put apps.py anywhere you want, but by Django documentation it should be in your main project main app directory.

This is the new way of configuring 3rd party apps which was introduced in Django 1.7 already: https://docs.djangoproject.com/en/1.10/ref/applications/

See example in demo/demo app: https://github.com/darklow/django-suit/blob/v2/demo/demo/apps.py https://github.com/darklow/django-suit/blob/v2/demo/demo/settings.py#L39

darklow commented 7 years ago

@gamesbook Currently both horizontal and vertical layouts use same template and CSS is what puts them left or top. To manipulate position of .header .user-tools template you could override base-site.html although not too much places elsewhere where you could put them. I really didn't wanted to introduce another header inside center column as it was in v1. Another option is - you can just override CSS and make these icons position: absolute and move them to the bottom of the left column, would that work to you?

gamesbook commented 7 years ago

@darklow I think bottom of the menu (left column) would be fine; but I should also get feedback from some of the users.

On 14 November 2016 at 12:14, Kaspars Sprogis notifications@github.com wrote:

@gamesbook https://github.com/gamesbook Currently both horizontal and vertical layouts use same template and CSS is what puts them left or top. To manipulate position of .header .user-tools template you could override base-site.html although not too much places elsewhere where you could put them. I really didn't wanted to introduce another header inside center column as it was in v1. Another option is - you can just override CSS and make these icons position: absolute and move them to the bottom of the left column, would that work to you?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/darklow/django-suit/issues/475#issuecomment-260297150, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVm6-28fMe-rPjxzjSNaJTDJiyYOBByks5q-DR8gaJpZM4HP7vt .

heathernicoale commented 7 years ago

@darklow - this is shaping up great so far! :) Question though - I followed the uninstall, install instructions, however the vertical menu isn't display even after restarting the server. Any ideas what may cause it to not display? It's also been added to the SuitConfig.

ganmedia commented 7 years ago

@heathernicoale In settings.py add this line to INSTALLED_APPS: 'django_project.apps.SuitConfig'

Then add a file called apps.py in the root of your project directory (same where settings.py is) and add this:

from suit.apps import DjangoSuitConfig
class SuitConfig(DjangoSuitConfig):
    layout = 'vertical'
heathernicoale commented 7 years ago

@ganmedia Hey! :) Thanks for the response! I have done this. I had my menu already configured and set up. so all of the parent / child items are in place already. Everything is there, the apps.py, DjangoSuitConfig, InstalledApps, etc...

darklow commented 7 years ago

@heathernicolae read carefully my commet, v2 vertical is on another branch: https://github.com/darklow/django-suit/issues/475#issuecomment-260138558

juanpestana96 commented 7 years ago

Hi @darklow is really great the job you have done. I have been using suit v2 for almost 4 months and it has been outstanding. I was expecting the left menu and now I will wait the responsiveness feature. I want to use it in a recent project I am working on. Just wanted to thank you.

AliPolat commented 7 years ago

Thank you for this beautiful admin interface.

I couldn't make work 'show_change_link' option of InlineModelAdmin .

darklow commented 7 years ago

@AliPolat just fixed in e997f71a165356dca1f4bd75b202af8767106a9c #553 Now there is global config form_inlines_hide_original = False for SuitConfig configuration class which may be overridden per individual Inlines as suit_form_inlines_hide_original = True Demo with show_change_link: http://v2.djangosuit.com/admin/demo/continent/7/change/

AliPolat commented 7 years ago

Thank you, It has very nice appearance...

heathernicoale commented 7 years ago

@darklow - absolutely LOVE Django Suit V2 - your development has significantly progressed our own development on our company's project.

Question - have you considered adding 'Print' actions or ability in Django Suit V2? I'm surprised this isn't already included in Django Admin anyhow. Working on creating a custom one for our project. But it made me think to ask. :) Keep up the great work!

darklow commented 7 years ago

@heathernicoale Thanks, glad you like v2 and it helps you so much. I don't think many users need visible Print actions and print actions are always available from browser menus. However having print styles (hiding redundant menus) to improve printing of lists and forms is a good idea. I'll add it to the feature list.

darklow commented 7 years ago

v2-vertical branch has been merged into v2.

darklow commented 7 years ago

@gamesbook Is Django 1.8 support really so necessary for you? I keep fighting issues with Django 1.8 and circular imports because of outdated template loaders, which were fixed and rewritten in Django 1.9. Keep spending time, which could be spent on moving forward with v2 :/