You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Oh yeah, looks like we have a problem with documentation :(
But even when documentation somewhere sucks, tests could save the day. E.g. you can see some examples of declarations in test project's models.py.
In case you are sick of reading of the docs, let me show a small example. Wrote right here, didn't check.
fromdjango.dbimportmodelsfromgeneric_helpers.fieldsimportGenericRelationFieldclassJustModel(models.Model):
passclassModelHavingGenericRelations(models.Model):
gr_required=GenericRelationField()
gr_optional=GenericRelationField(blank=True)
gr_custom_content_type_field=GenericRelationField(ct_field="my_content_type")
gr_custom_fk_field=GenericRelationField(fk_field="my_obj_id")
gr_whitelist=GenericRelationField(
allowed_content_types=[
"JustModel", # For models in the same app"contenttypes.ContentType", # standard django app_label.model_name notation
])
gr_blacklist=GenericRelationField(
denied_content_types=[
JustModel# Model classes also available (AFAIR)
])
This feature is exactly what I've been looking for, but there's a problem.
From README:
That sounds great, but is there any documentation explaining how to use those features? The example in the README doesn't include any arguments.
The text was updated successfully, but these errors were encountered: