Задать вопрос

Тел: +7 965 3737 888

497

Просмотров

0

Ответов

Custom model field for Frame or Box

Purpose

We often need to store x,y, width and height for a model, we can store all these values in same field by having custom field.

How to Use

Save this code in customfields.py and in your model

from customfields import FrameField class MyModel(models,Model) frame = FrameField()

And in your in views, you can use as follows

model = MyModel.objects.get(1) print model.frame.x, model.frame.y, model.frame.width, model.frame.height

Вопрос полезен? Да0/Нет0
file_5130.py(1.4Кб)
None