Add programmatically articles / update them

26 views
Skip to first unread message

Robert Kuehn

unread,
Feb 27, 2020, 9:05:56 AM2/27/20
to django-wiki
I am totally amazed of django wiki :-) I have the "problem" that I have some structured data in a seperate database which should be represented as a article. So I want to create automatically articles like a "syncing" them and make revision. is there a function how I can submit new updates / articles to the wiki?

Thanks for your help,
Robert

Benjamin Bach

unread,
Mar 26, 2020, 10:49:06 AM3/26/20
to Robert Kuehn, django-wiki

Hi Robert,

Did you get something cooking? Otherwise, I can encourage to look at the Django Framework that django-wiki is based on:
https://www.djangoproject.com/start/

You would want to do something like this from a Python script:

From terminal, run DJANGO_SETTINGS_MODULE=yourproject.settings python yourscript.py

Here's an outline for yourscript.py

import django
django.setup() # Needs DJANGO_SETTINGS_MODULE to point to a settings module

# Import the Django models AFTER Django is loaded
from wiki import models

# Call the various ORM methods on the articles that you want to create
models.Article.objects.create(...)
Finally, I think what can work well, would be if you dig in to writing your own Django management scripts. That's the typical way of solving a programmatic issue from within a Django project: https://docs.djangoproject.com/en/3.0/howto/custom-management-commands/

Best,
Ben

--
You received this message because you are subscribed to the Google Groups "django-wiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-wiki...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-wiki/9da6c832-1c3b-4727-b365-e2102f58cc3f%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages