Question: My django app displays the objects from database in table view. The problem is that these objects (models) are pretty complex: the have 50+ fields. Nearly for each field I have to do some formatting:

* conver phone numbers from int 71234567689 to "+7 (123) 456789"
* display long prices with spaces: "7 000 000" instead of "7000000"
* construct full address from several fields like "street", "house" and so on (logic if pretty complex with several if-else-s)
* and so on

Django templating language has several useful tags for simple cases but I guess is not suitable in general case (like mine) for serious formatting.

Create the @property-s in model class is also not an option because the question is about rendering and is not related to model.

So I guess I should do my conversions in view: create dict for each obj, fill with converted data and pass to template. 

But! The model has a lot of fields and I don't want to copy them all :) Moreover, it would be great to preserve model structure to use it in django template (say, regroup) and query set laziness.

**So the greatest way would be to instruct django "how to render". Is it possible?**

Answer: 
This is the normal Hibernate behaviour

In one to many relations, hibernate loads the father entity (Catalog in your case) but it will load the children entities List (List items and List orders in your case) in a LAZY mode

This means you can't access to these objects because they are just proxies and not real objects

This is usefull in order to avoid to load the full DB when you execute a query

You have 2 solution:

1. Load children entities in EAGER mode (I strongly suggest to you to not do it because you can load the full DB.... but it is something related to your scenario
2. You don't serialize in your JSON the children entities by using the com.fasterxml.jackson.annotation.JsonIgnore property

Angelo
I had the same problem but a fixed by:

```
@OneToMany
@JoinColumn(name = "assigned_ingredient", referencedColumnName = "ingredient_id")
@Fetch(FetchMode.JOIN) // Changing the fetch profile you can solve the problem
@Where(clause = "active_ind = 'Y'")
@OrderBy(clause = "meal_id ASC")
private List<Well> ingredients;

```

you can have more information here: <https://vladmihalcea.com/the-best-way-to-handle-the-lazyinitializationexception/>