django-wiki icon indicating copy to clipboard operation
django-wiki copied to clipboard

Adding various custom extra fields for articles

Open martibosch opened this issue 9 years ago • 4 comments

Hello,

I would be interested in using django-wiki to create a wiki of art work. I would need to define some sort of 'field structure' for my articles, further than just the contents textarea. This means that each article would correspond to an art work, so it would have to include some extra fields, i.e. :

  • art_type which would be a models.CharField with choices=['sculpture', 'painting', ... ]
  • date which would be a models.DateField
  • artist which would be a models.CharField or maybe even a models.ForeignKey so we can see a list of articles by such artist
  • localization which ideally would be something like a LocationField https://github.com/caioariede/django-location-field
  • ...

I would like the wiki functioning, so all the extra fields could have revisions according to some user permissions and with the notifications working in the same way as well.

My question is: is there any plugin that does that already? Could you give me any guidelines on how to do this? I could not find anything in Read The Docs, all the related useful information I could find is this: https://github.com/django-wiki/django-wiki/issues/385#issuecomment-183320491

I am willing to spend time on that and even create a reusable plugin (with tests) if you think that allowing to structure the articles with custom fields would be an interesting functionality to extend django-wiki.

Martí

martibosch avatar Dec 02 '16 09:12 martibosch

There is nothing, for now.

But it would be good something cone "wikidata"

teury avatar Dec 18 '16 23:12 teury

@martibosch sounds like a useful plugin.

What I would suggest would be to create and share a plugin that does exactly what you want it to do. That way you will have ultimate control of the way the fields are displayed and how forms behave etc.

Ultimately, the fairly undocumented plugin system was designed for people to be able to add their own extra data, hence the slogan Store your knowledge with style: Use django models. - meaning create a plugin that inherits from the revisioning models.

benjaoming avatar Dec 27 '16 00:12 benjaoming

A project I am working on faces this issue as well.

We are thinking that we can create a plugin that adds new fields in a model object linked to an article with a foreign key, forks the standard article view/template for customization, and adds HTML controls in the sidebar of the edit article page for entering the data.

However, we'd also like to be able to view the change history of these metadata fields, and the path for that is less clear. Has anybody experimented with https://github.com/etianen/django-reversion? Could this be made to play nicely with the Changes page?

nschneid avatar Apr 15 '17 21:04 nschneid

@nschneid django-reversion is not really my cup of tea.. I've had it integrated before with no benefit, just disadvantages.. will give you loads of huge JSON blob garbage with no schema migrations. A wiki is made for having history and transparency of structured data, django-reversion is a backup solution.

However, look at extending RevisionPlugin like wiki.plugins.attachments does, the base model is here: https://github.com/django-wiki/django-wiki/blob/master/wiki/models/pluginbase.py

benjaoming avatar Apr 15 '17 21:04 benjaoming