Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Computed properties #89

Open
submarcos opened this issue Feb 12, 2021 · 0 comments
Open

Computed properties #89

submarcos opened this issue Feb 12, 2021 · 0 comments
Assignees

Comments

@submarcos
Copy link
Member

submarcos commented Feb 12, 2021

  • Rajouter un Charfield Facultatif sur les CrudViewProperty

    • ne doit etre rempli qui si editable = false
    • la valeur doit correspondre au python path d'une fonction existante (ex : project.function.my_function) (çà peut etre import_module)
  • rajouter des signaux dans terra-geocrud sur les save des features (voir geostore) pour rgearder si des fonctions sont définies et les executer.

  • une fonction aura la feature en parametre (ex : def my_function(feature): )

  • faut faire attention aux types (ex: màj de la longueur qui doit etre un int -> n'enregistrer qu'un int)

def get_feature_length(feature):
    feature.properties['length'] = feature.geom.length
    feature.save()

def get_feature_cities(feature):
    feature.properties['cities'] = ','.join(list(feature.relation.get('cities').values_list('name', flat=True)))
    feature.save()

attention a faire un try / except lors de l'executio ndes fonctions, et mettre logger.error les exceptions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants