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: 
Here is my solution for this task with Hibernate. I marked hibernate releation with @JsonIgnore and use custom field for jackson, in which I check if the field is loaded. If you need serialize collection to json then you should manualy call collection getter during hibernate transaciton.

```
@JsonIgnore
@OneToMany(mappedBy = "myorder")
private List<OrderItem> orderItems = new ArrayList<>();

@JsonProperty(value = "order_items", access = JsonProperty.Access.READ_ONLY)
private List<OrderItem> getOrderItemsList() {

    if(Hibernate.isInitialized(this.relatedDictionary)){
        return this.relatedDictionary;
    } else{
        return new ArrayList<>();
    }
}

@JsonProperty(value = "order_items", access = JsonProperty.Access.WRITE_ONLY)
private void setOrderItemsList(List<OrderItem> orderItems) {
    this.orderItems = orderItems;
}

```
"You don't serialize in your JSON the children entities by using the `com.fasterxml.jackson.annotation.JsonIgnore` property"

Add `@JsonIgnore` for hibernate lazy loading properties eg. `@ManyToOne`. That should work