On Sunday, 31 May 2015 11:36:51 UTC+2, riccardo.magliocchetti wrote:
>
> Il 31/05/2015 11:00, Emil Stenström ha scritto: 
> > On Sunday, 31 May 2015 10:27:24 UTC+2, riccardo.magliocchetti wrote: 
> >     Il 30/05/2015 18:52, Emil Stenström ha scritto: 
> >     But your proposal keeps html and js separated. I think you are 
> solving a 
> >     problem 
> >     for the one that just want to use a component but you are not 
> solving the 
> >     problem for the one that is writing components. At least not in the 
> react.js 
> >     way, especially from such a bold premise :) 
> > 
> > I agree that I don't quite do it the same way as React. But that's not 
> the point 
> > here either, to somehow bundle Reacts ideas inside Django. My point is 
> that 
> > keeping the four parts that make a component closely together in the 
> project 
> > source, would make for a better structure. They only idea that comes 
> from React 
> > is thinking in components rather than nested templates and template 
> tags, which 
> > are Django's current way of solving this. 
>
> I see, but who are going to do a big js app without using a framework like 
> angular / react.js / ember / whatever? I'm not saying your Component 
> proposal is 
> without merit but i can't see how it can fit where the js app is done with 
> a 
> framework. 
>

The idea is simply to keep interface components together in the Django 
project tree. That wouldn't change your options in regards to what 
javascript framework to use, just give you some help with organizing your 
code.

Say you decide to use React as just JS framework. Since React puts the HTML 
inside your javascript your Django component would simply be:

class ReactCalendar(component.Component):
    def context(self, date):
        return {"date": date}
    class Media:
        template = None
        css = {'all': ('app/components/calendar/calendar.css',)}
        js = ('app/components/calendar/calendar.js',)

Since React doesn't handle CSS the component model would give you a way of 
tying thing together anyway. And with the component template tag you would 
be able to decide where to include your React component.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/a05f2dc1-3515-4b23-96f5-479d2722b82c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to