I'm sure that you could do it directly with SQL but you also could write a
script that could do it with Django's orm, something like (I haven't tested
this so it may require some tweaking):

from copy import deepcopy

def copy_page(portfolio):

    portfolio_copy = deepcopy(portfolio)
    portfolio_copy.id = None
    portfolio_copy.save()

    for item in portfolio.items.all():
        # replace the next line with actual logic that determines if the
item shouldn't be copied
        if (do_not_copy):
            continue
        item_copy = deepcopy(item)
        item_copy.portfolio = portfolio_copy
        item_copy.save()

If you wanted to get really fancy you could even hook this up to the admin
somehow, rather than running it at the command line

On Tue, Jan 27, 2015 at 1:07 AM, Brygg Ullmer <[email protected]>
wrote:

> Josh,
>
> Many thanks for your message -- warmly appreciated!
>
> Yes, your description is accurate.  After posting my message, I realized
> aspects may be specific to the Codex MezzaTheme.  In a dump of the MySQL
> dbase, I see:
>
> REPLACE INTO `codex_portfolioitem` (`id`, `_order`, `portfolio_id`,
> `content`, `title`, `href`, `featured_image`) VALUES
>
> ... followed by the content of the associations.  While I suspect there
> are both Python and MySQL (PostgreSQL, etc.) ways of doing this, am I
> correct in gathering a SQL query of the existing page items, followed by a
> SQL insertion of said items in association with the new page "copy," may be
> the current "state of the art?"
>
> Warmly appreciated!
>
> Brygg
>
> unfortunately I don't think there is a way to do what you described right
>> now.  To be clear, you would want to do something like:
>>
>> Page 1 | Item 1, Item 2, Item 3, Item 4
>>
>> and then create a copy like:
>>
>> Page 1 Copy | Item 1, Item 3, Item 4
>>
>> Is that correct?
>>
>>  --
> 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 [email protected].
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to