Skip to content

Add context based on models

Model developers should be able to define the context that define its field.

They should be able to set it through a Meta option:

class MyModel(Model):
    first_name = models.CharField(max_length=50)
    class Meta:
        rdf_context = {'foaf': "http://xmlns.com/foaf/0.1/", 'first_name': "foaf:firstname"}

or they should be able to set it field by field:

class MyModel(Model):
    first_name = models.CharField(max_length=50, rdf_type="foaf:firstname")
    class Meta:
        rdf_context = {'foaf': "http://xmlns.com/foaf/0.1/"}

djangoldp.models.Model should provide a method to get a full model of the model.

Edited by Sylvain Le Bon