[mezzanine-users] Re: Does Orderable / Sortable Work on Editable Template Tag?

2017-09-17 Thread Matt Mansour


On Friday, September 15, 2017 at 8:55:00 AM UTC-7, Matt Mansour wrote:
>
> Hi All -
>
> I am looking to create a page of images that are both sortable and in a 
> grid format - instead of each image stacked in rows like in the admin 
> inlines. 
>
> I am digging into jQuery's sortable and breaking apart how it's used in 
> Mezzanine. I am making progress but I am curious if I could achieve the 
> sorting I am looking for by simply wrapping a list of  images in an 
> editable template tag?  Something like
>
> {% editable page.sort_images %}
>
> Code to render list of images to be sorted
>
> {% endeditable %}
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Re: Does Orderable / Sortable Work on Editable Template Tag?

2017-09-18 Thread Melvyn Sopacua
Well, the key is to update only those that have changed. Any form
field has a has_changed() method you may be able to use, something
like:

for k, v in [k, v for k,v in data_dict.items() if v.has_changed()]

assuming data_dict is form.cleaned_data.

On Sun, Sep 17, 2017 at 11:44 PM, Matt Mansour  wrote:
>
>
> On Friday, September 15, 2017 at 8:55:00 AM UTC-7, Matt Mansour wrote:
>>
>> Hi All -
>>
>> I am looking to create a page of images that are both sortable and in a
>> grid format - instead of each image stacked in rows like in the admin
>> inlines.
>>
>> I am digging into jQuery's sortable and breaking apart how it's used in
>> Mezzanine. I am making progress but I am curious if I could achieve the
>> sorting I am looking for by simply wrapping a list of  images in an editable
>> template tag?  Something like
>>
>> {% editable page.sort_images %}
>>
>> Code to render list of images to be sorted
>>
>> {% endeditable %}
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mezzanine-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Re: Does Orderable / Sortable Work on Editable Template Tag?

2017-09-18 Thread Melvyn Sopacua
On second thought, that wouldn't work with cleaned_data, as
has_changed() is a method of BoundField so it's a little more complex
and you need to keep the form around:

 for k, v in [k, v for k,v in data_dict.items() if form[k].has_changed()]

On Mon, Sep 18, 2017 at 9:14 AM, Melvyn Sopacua  wrote:
> Well, the key is to update only those that have changed. Any form
> field has a has_changed() method you may be able to use, something
> like:
>
> for k, v in [k, v for k,v in data_dict.items() if v.has_changed()]
>
> assuming data_dict is form.cleaned_data.
>
> On Sun, Sep 17, 2017 at 11:44 PM, Matt Mansour  wrote:
>>
>>
>> On Friday, September 15, 2017 at 8:55:00 AM UTC-7, Matt Mansour wrote:
>>>
>>> Hi All -
>>>
>>> I am looking to create a page of images that are both sortable and in a
>>> grid format - instead of each image stacked in rows like in the admin
>>> inlines.
>>>
>>> I am digging into jQuery's sortable and breaking apart how it's used in
>>> Mezzanine. I am making progress but I am curious if I could achieve the
>>> sorting I am looking for by simply wrapping a list of  images in an editable
>>> template tag?  Something like
>>>
>>> {% editable page.sort_images %}
>>>
>>> Code to render list of images to be sorted
>>>
>>> {% endeditable %}
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to mezzanine-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Melvyn Sopacua



-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Re: Does Orderable / Sortable Work on Editable Template Tag?

2017-09-18 Thread Matt Mansour
Hmm. You definitely gave me an approach to think about.
I'll dig in and report back.

Thanks Melvyn.

On Mon, Sep 18, 2017 at 12:18 AM, Melvyn Sopacua 
wrote:

> On second thought, that wouldn't work with cleaned_data, as
> has_changed() is a method of BoundField so it's a little more complex
> and you need to keep the form around:
>
>  for k, v in [k, v for k,v in data_dict.items() if
> form[k].has_changed()]
>
> On Mon, Sep 18, 2017 at 9:14 AM, Melvyn Sopacua 
> wrote:
> > Well, the key is to update only those that have changed. Any form
> > field has a has_changed() method you may be able to use, something
> > like:
> >
> > for k, v in [k, v for k,v in data_dict.items() if v.has_changed()]
> >
> > assuming data_dict is form.cleaned_data.
> >
> > On Sun, Sep 17, 2017 at 11:44 PM, Matt Mansour 
> wrote:
> >>
> >>
> >> On Friday, September 15, 2017 at 8:55:00 AM UTC-7, Matt Mansour wrote:
> >>>
> >>> Hi All -
> >>>
> >>> I am looking to create a page of images that are both sortable and in a
> >>> grid format - instead of each image stacked in rows like in the admin
> >>> inlines.
> >>>
> >>> I am digging into jQuery's sortable and breaking apart how it's used in
> >>> Mezzanine. I am making progress but I am curious if I could achieve the
> >>> sorting I am looking for by simply wrapping a list of  images in an
> editable
> >>> template tag?  Something like
> >>>
> >>> {% editable page.sort_images %}
> >>>
> >>> Code to render list of images to be sorted
> >>>
> >>> {% endeditable %}
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Mezzanine Users" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an
> >> email to mezzanine-users+unsubscr...@googlegroups.com.
> >> For more options, visit https://groups.google.com/d/optout.
> >
> >
> >
> > --
> > Melvyn Sopacua
>
>
>
> --
> Melvyn Sopacua
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mezzanine-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.