Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
emihir0
@emihir0
I'm sure I saw an example somewhere in the docs/demos in past with a navigation menu (block sidenav_items) with nested items. Can someone point me to it please?
Mikhail Podgurskiy
@kmmbvnr
emihir0
@emihir0
thanks!
@kmmbvnr do you have an example where you use ModelFormSetField with some initial queryset? when I use modelformset_factory (django's inbuilt), I can simply pass queryset argument there to instantiate it. The problem is that when I use this modelformset_factory's instance in material's form as a field (ModelFormSetField), I guess I need to instantiate it at that form's init method, but I'm not sure how
basically what I want to achieve is pretty simple - e.g. classic 'books & authors' example: make a view which shows all books of some author (filtered Queryset) as ModelFormSetField and so we can update/create new ones in bulk
emihir0
@emihir0
so I found a way... but it's not nice: https://dpaste.de/jmtb . would there be a nicer way?
Mikhail Podgurskiy
@kmmbvnr
emihir0
@emihir0
fml, wasted so much time on this, thanks Mikhail
emihir0
@emihir0
When I use InlineFormSetField, the form for individual model's instances does not get rendered according to the layout I specify. Is this intended?
astarrh
@astarrh
I'm getting tripped up getting model data to populate my ModelForm. It seems to work through UpdateView, but not when I create a custom form.
Never mind. Got it
astarrh
@astarrh
Any quick fix for $(...).formset is not a function ?
jquery.formset.js is showing up in my sources. I'm not sure what's wrong.
astarrh
@astarrh
Finally got it.,.. same problem @nambug had. Including templates on various parts of the page was a new concept for me. I couldn't tell how to do it until I found the sample.
emihir0
@emihir0
@kmmbvnr the description on 'get_template_names' of 'DeleteModelView' is wrong - it doesn't look for '<app_label>/<model_label>_delete.html' template but rather '<app_label>/<model_label>_confirm_delete.html' template as the default template_name_suffix = '_confirm_delete' and not '_delete'
astarrh
@astarrh
Material Forms' jQuery seems to break my CSRF delivery for my other AJAX calls. I'm following the method suggested by Django's docs. How does everyone else handle CSRF?
Mikhail Podgurskiy
@kmmbvnr
I don't think that's jquery
emihir0
@emihir0
Is it possible to use AjaxModelSelect inside django_filters.FilterSet? I see the request coming in, but response is empty (no suggestions). (using simple ModelViewSet here with default view classes)
e.g. list_display = ('employee'), list_filter_class = filters.MyFilter; and MyFilter has has employee = django_filters.ChoiceFilter(widget=AjaxModelSelect(lookups=['first_nameicontains', 'last_nameicontains']))
Mikhail Podgurskiy
@kmmbvnr
mm.. that's intresting idea, but i'm afraid it's not supported
emihir0
@emihir0
I've implemented it. A small change is required in get_ajax_suggestions and ListModelView needs a def options to support the change (similar to FormAjaxCompleteMixin's but not quite as we don't have 'form' but rather 'filterset' where the fields are stored
emihir0
@emihir0
I've just noticed that material's ModelChoiceField does not have a 'clear' X button. It is super convenient in some use cases to have it. Is there a way to add it?
emihir0
@emihir0
something like this: https://codepen.io/pranesh-r/pen/yawzbW?editors=0010 but 'X' is more than enough
astarrh
@astarrh
@kmmbvnr hmm when I comment out these: <script src="{% static 'material/js/jquery.js' %}"></script> {% include 'material/includes/material_js.html' %} the issue goes away.
Sidon Duarte
@Sidon

CRUD ERROR!
I'm trying to implemnent a CRUD view
My model: Item

app/urls.py
urlpatterns = [ url('^$', generic.RedirectView.as_view(url='./itens/', permanent=False), name="index"), url('^itens/', include(ItemViewSet().urls)), ]
Global Urls
urlpatterns = [ url(r'', include(frontend_urls)), ]
When I try to access the url /itens, I get the error:

Reverse for 'item_add' not found. 'item_add' is not a valid view function or pattern name.

what is my mistake?

Mikhail Podgurskiy
@kmmbvnr

frontend registers all urls under own namespace, same as app label

so, i guess, the reverse should be app:item_add

Sidon Duarte
@Sidon
Ok, but I'm not referencing the reverse, I'm just trying to access the url /items
Sidon Duarte
@Sidon
With django-material is possible to implement (without use admin) a table like this?
https://codepen.io/Sidon/pen/dZyMyM
Marco Schanz
@fuuman
Hey guys, what is the difference between django-material and just using the CDN for the "standard" material stylesheets?
Mikhail Podgurskiy
@kmmbvnr
Django-material provides integration with django
You can read more about provided functionality in the documentation
Sidon Duarte
@Sidon
Hi @kmmbvnr could you answer my question about mdl-table?
Mikhail Podgurskiy
@kmmbvnr
For the samples what can be done with django-material you can check the demo
Marcos Hass Wakamatsu
@marcoshass
Hi @kmmbvnr, thank you for building such awesome project! It's really a time-saver for material gui buinding ....
I'm trying to understand the class design under the form generator but unfortunately I'm not a python developer ... I "think" the code that generates the material form markup is under django-material/material/base.py am I correct?
Mikhail Podgurskiy
@kmmbvnr
emihir0
@emihir0
@kmmbvnr Mikhail - the material frontend uses templates that are 'dashboard' like type of templates. Do you have some templates for regular user site? For example: at some point I will have to build a catalogue type of view for our products for anonymous users; then if they register they can put the prodcuts in their carts and from that point the dashboard style will be useful
but for 'about', 'home', 'info', 'catalogue', 'product detail' etc type of views, the dashboard kind of view is kind of overkill I think as the topbar and navitems take too much space
Mikhail Podgurskiy
@kmmbvnr
That's the reason why have separated js and css inclusion templates. {% include 'material/includes/material_css.html' %} {% include 'material/includes/material_js.html' %} You can just use it inside your custom base.html
emihir0
@emihir0
Yes, I know; I meant it more as - whether you have some basic templates for the use cases I mentioned above (they are common in like 50%+ of all projects) so that I don't have to start from scratch =). One of the reasons why I use your framework is so that I don't have to touch html/js/css, and when I do, it's just to do some quick/small adjustments.
Ian Waring
@ianwaring
Hiya - looks a great piece of work. I'm using Django 1.11 and MaterializeCSS V1.0 Alpha, but have done a mod to base user authentication based on email address alone. Now adding your work in. Do I need to change your forms code to not ask for the Username?
Mikhail Podgurskiy
@kmmbvnr
no, you don't need any change, everything should works out of the box
Ian Waring
@ianwaring
Lovely - thank you
Ian Waring
@ianwaring

Sorry for the relatively noob question - just trying to decode how to bolt things into an existing app. Django 1.11, Python 3, using MaterializeCSS 1.0 Alpha. I've cloned the demo over from Github. Looks like I replicate the whole tree under app Material into my project, replicate demo.py to get a material.base import and 3 class definitions as my own appname.py, put material, material.frontend and material.admin as INSTALLED_APPS up front in my apps settings.py and - is that it?

Just agonising over bits and bobs in the demo as it's still referencing jQuery in places, which I thought had gone away as a MaterializeCSS dependency. And wondering if I put the materialize/1.0.0-alpha.2 minified CSS and js includes off their CDN or use the ones left in the material/admin/css and /js directories?

Any help or guidance really appreciated.

emihir0
@emihir0
You should install django-material as a third app, just the same way you install any other app. So pip install django-material and then follow: http://docs.viewflow.io/material_frontend.html
you dont 'copy paste' your already existing project as the demo of the git...
@kmmbvnr do you have some ETA on when will django-material be compatible with django 2 release?