369 class CopyFormView(EditionFormView): |
369 class CopyFormView(EditionFormView): |
370 """display primary entity creation form initialized with values from another |
370 """display primary entity creation form initialized with values from another |
371 entity |
371 entity |
372 """ |
372 """ |
373 id = 'copy' |
373 id = 'copy' |
|
374 warning_message = _('Please note that this is only a shallow copy') |
|
375 |
374 def render_form(self, entity): |
376 def render_form(self, entity): |
375 """fetch and render the form""" |
377 """fetch and render the form""" |
376 # make a copy of entity to avoid altering the entity in the |
378 # make a copy of entity to avoid altering the entity in the |
377 # request's cache. |
379 # request's cache. |
378 entity.complete() |
380 entity.complete() |
379 self.newentity = copy(entity) |
381 self.newentity = copy(entity) |
380 self.copying = entity |
382 self.copying = entity |
381 self.initialize_varmaker() |
383 self.initialize_varmaker() |
382 self.newentity.eid = self.varmaker.next() |
384 self.newentity.eid = self.varmaker.next() |
383 self.w(u'<script type="text/javascript">updateMessage("%s");</script>\n' |
385 self.w(u'<script type="text/javascript">updateMessage("%s");</script>\n' |
384 % self.req._('Please note that this is only a shallow copy')) |
386 % self.req._(self.warning_message)) |
385 super(CopyFormView, self).render_form(self.newentity) |
387 super(CopyFormView, self).render_form(self.newentity) |
386 del self.newentity |
388 del self.newentity |
387 |
389 |
388 def init_form(self, form, entity): |
390 def init_form(self, form, entity): |
389 """customize your form before rendering here""" |
391 """customize your form before rendering here""" |