python - Elixir reflection -


I define some entities that work fine; For meta programming issues now need to reflect the field properties defined in the model.

For example:

  square fu (unit): bar = one time ('bar') baz = ManyToMany ('falcon')  

What type of relationship is determined: "many people", "vanity" or even a plain "area", and relationship goals?

Is there any easy way to reflect Alkiseer units?

You can introspect in alixir because you have anywhere in Python - class Foo dir (Foo) with code>, get a character named , with getattr (Foo, thename) type Check the type of attribute with (theater) or isinstance etc. Any relationship subclass ( OneToMany ) as the r.of_kind attribute, which you pass on the string 'bar' And the ManyToMany ) R. Example of the relative subclass of the attribute to the manufacturer. As a result,

module inspection Python can be a friendly way of introspecting in the standard library, but dir / getattr / isinstance and c can be perfectly acceptable in many cases .


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -