Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Ian Waring
@ianwaring
That covers material and material-frontend but no mention of material-admin...
Btw - the version using MaterializeCSS 1.0 Alpha 2 is from a git clone afaik - hence me trying to unpick it that way
Ian Waring
@ianwaring
Using Django 1.11
Lucas Garcia de Araújo Martins
@lukasgarcya
In the master the Django admin is removed?
django-material includes the admin interface; you simply have to enable it in installed apps...
Lucas Garcia de Araújo Martins
@lukasgarcya
When I install direct from git, this is not working.
In git's repository has this message: [GIT]
Django 2.0 support
Drop Material Admin
Ian Waring
@ianwaring
Is there a straightforward way of enacting a django-material install that works with Django 1.11?
Ian Waring
@ianwaring
(also wondering if it's a requirement to create the app afresh with the manage.py migrate ; documentation refers to myapp.apps.MyAppConfig but unsure whether I tap that in literally or substitute 'myapp' for my own app name?
Mikhail Podgurskiy
@kmmbvnr
@ianwaring pip install django-material
and yep you need to substitute
Ian Waring
@ianwaring
Thank you Mikhail :-)
emihir0
@emihir0
@kmmbvnr is it possible to (without digging through js/css/html) add 'save and add another' and 'save and continue editing' buttons to the forms outside admin? for example here:
Ian Waring
@ianwaring

Stuck on the real basics. I have a project called say "project_fred", have an app in there called "fred", do a pip install of django-material. The project and app already have customisations to have email address as the sole authentication method. Done the addition of material, material.frontend and material.admin to installed apps. Is there a way to scaffold out the material support files if I already have an app defined?

I'm suspect there's a missing fred.apps.fredConfig needed in INSTALLED_APPS along the way too.

Ian Waring
@ianwaring
I also guess something must scaffold out the material directory tree under static?
Ian Waring
@ianwaring
Have the module set for the front end ok. The demo makes it look like an app called "material" is created somehow, but no mention in the docs...
emihir0
@emihir0
simple question - does your app, fred work on its own without django-material?
for example, does fred contain models, views, urls, templates? is it in your project settings?
if yes, then all you need to do (more or less), is follow these steps: http://docs.viewflow.io/material_frontend.html
so add material to your isntalled apps (after pip installing it), add mixin go your fred config, add material urls to your frontend and then go to your fred urls, make an 'index' url (e.g. yourdomain.com/fred/home -> this could be your index) and make the menu.html file in your fred templates
emihir0
@emihir0
you do not pull the git directory of django-mateirla and try to plug in your app into a demo or such; that's not a good idea (how are you going to update/upgrade django-material in future)?
Ian Waring
@ianwaring
I’m just looking over the fence at the material demo but otherwise not touching it.
Ian Waring
@ianwaring
Fred works fine for both localhost:8000 and /admin. Added the mixin and fred.app.FredConfig, material, material.frontend and material.admin to my apps. Had to knock out the app called fred as that caused duplicate errors in the migrate. Migrate worked fine. The very last part wasn’t clear - where to put the index file (it refers to base but unsure where I had to place that in the hierarchy).
Also not clear if I just leave the fred.app.FredConfig Line in the installed apps or if I need to revert back to what it was before once the migration is done...
Ian Waring
@ianwaring
I’m documenting the complete process from installing the cloud instance to having Django 1.11 running atop PostgreSQL, Python3 and MaterializeCSS - Auth changed to email instead of usernames - with the Django-Materialize work. I’ll get there in the end :-)
On both my Mac for dev and Digital Ocean Ubuntu 16.04 LTS production. VS code and Github in there too.
Fwiw I thought the base.html was going to go under the projects main /static.
Ian Waring
@ianwaring
However, the process I followed didn’t leave them there - so I was wondering if I had to install materializeCSS and place the files in my static hierarchy myself. 75km away from my Mac at a Django meetup, but will look in the morning.
emihir0
@emihir0
the supplied templates are just.. templates. However you setup your templates is up to you and it can be changed in project settings TEMPLATES. As for the static files, you have to run manage.py collectstatic in your production. Regarding the FredConfig, well, before installing django-material you should have had FredConfig in the installed apps already, otherwise your project would not know that it should use/display the fred app.
lastly, the index is not a file but a view, or rather a name that can be resolved into a view (e.g. it can be a redirect to other view). the specific example shown in the guide uses actual index.html, not a redirect. That index.html is simply a template and usually you put it in project/fred/templates/fred/index.html OR project/templates/fred/index.html. I suggest the first one as it means you will be able to locate all your app templates quickly (ie. each app has template folder), as opposed to having 1 massive templates folder in your project directory (it's still useful to have it, for some project wide stuff).
emihir0
@emihir0
the demo is a bit confusing, it should have called the app not MyAppConfig but SalesConfigso it's clear it's a sales app and so it refers to sales/index.html for template and for views as sales:index
also, if you prefer to refer to your fred app as simply fred instead of 'fred.apps.FredConfig'in your settings, then you can, in your __init__.py file in your fred app add line: default_app_config = 'fred.apps.FredConfig'
(that's why you only have to refer to django.contrib.admin for example instead of django.contrib.admin.apps.AdminConfig because the __init__.py file contains default_app_config = 'django.contrib.admin.apps.AdminConfig' - but it doesn't matter in the end
Ian Waring
@ianwaring
Really helpful, thank you. I have everything working on admin, just got to tweak the URL defs to pick up the index view. Agree with you about the demo SalesConfig name. Happy to publish the whole process end to end (from firing up a Dev Mac+ Production Digital Ocean Ubuntu instance through to having Django + PostgreSQL + Python 3 + MaterializeCSS + Django-Material + Nginx http/HTTPS working) - if indeed it would be useful to anyone.
Digital Oceans one click install of Nginx, PostgreSQL, Python, Django was good - 30 mins from running it up to being able to add template code - but Django 1.8 and Python 2.7, hence having to build it piecemeal instead. It'd be nice to automate things a bit :)
emihir0
@emihir0
why do you run a new project on python 2.7? it's not supported in django 2.0
and yes, publish it; I'll gladly check it out later when I have some time. I'm myself new to django in general, so I'm curious to see how/what other people do
Ian Waring
@ianwaring
Exactly - it was old version city, so I scrapped it and built the whole thing bit by bit from the ground up. Now Ubuntu 16.04 LTS, Django 1.11 - and hopefully Django-Material when it supports 1.11 and 2.0
And Python 3.5 or 3.6 of course
emihir0
@emihir0
I want to switch to django 2 ASAP as there are some neat features available that make life easy. Pretty much the last major library i'm working with that is not updated to 2.0 is django-material
so I'm waiting patiently :D
Ian Waring
@ianwaring
It's a moving target. I first looked at Django years ago - nice Apress book but the pre-1.0 releases kept slipping. Only back now after doing some Python work in Dash (by the authors of D3 based Library Plot.ly) - and a stint around building my personal home project single page app in JavaScript on AWS, then using Polymer, then Firebase. Django looking good.
Ian Waring
@ianwaring
Anyone got an example of a project with one app that can display one template (and the admin page with /admin) with Django-material in place? I’m trying to add routing in but seem to have screwed up name spaces or view types - getting name errors on generic.TemplateView.as_view in my app
Ian Waring
@ianwaring
Think I just need to get my head around FBV's vs CBV's.
Ian Waring
@ianwaring
Back on it doing the whole app using CBVs in the morning.
Ian Waring
@ianwaring
All working now :-). Reconciled all the flow against the directory structure, now seeing MaterializeCSS on both the app and admin panel. Just updating my procedure documentation accordingly.
Ian Waring
@ianwaring
Submitted it to Digital Ocean - happy to share if anyone wants a copy or to improve it. ian.waring@software-enabled.com
emihir0
@emihir0
well, you can use both fbv and cbv, it doesn't really matter although fbv is somewhat limited in a sense that you keep repeating stuff over and over