I am looking for a package or hints on how to track each field and the ability to accept or reject editing
i using Django 1.11 and python3
Package like:
django_monitor not working
django_approve not working
It sounds like django-moderation should fit you need. I haven't used it personally, but the docs mention that it's possible to have changes displayed only after a moderator accepts them, and there is also an option (keep_history) to maintain the history of the changes made to a model.
Related
I need to make objects editable in frontend by clicking on it and enable a form field to edit the text. i.e. in a ToDo-list which tasks can be edited by clicking on the task like shown in the following graphics:
I am working with Django 2.x and unfortunately, I'm a little inexperienced.
Is it a good practice to realize this with REST API and/or Angular/React?
I would be glad about a few experiences, how something is feasible.
I have found a good solution to implement the desired functionality with Jeditable
https://github.com/NicolasCARPi/jquery_jeditable
I'm working on a web page which uses Django-quiz app. When you install the django-quiz, you can create quizes, questions etc. in Admin.
Unfortunately, there is no way, how to assign Quiz to my model Language so I'm looking for a way, how to add field Language into the model Quiz.
I've tried this but it does not work. I've tried already to create a proxy model with additional field but I realised that it is not possible in proxy models.
from quiz.models import Sitting,Quiz
class QuizAddLanguage(models.Model):
quiz = models.OneToOneField(Quiz)
language = models.ForeignKey(Language)
Do you know what to do to add field to third party app model?
For this time, OneToOne should be enough - for each language there will be one quiz
Since its one to one then you can just define the relationship on your own language class, django by default, will provide you the reverse lookup meaning
language_obj.quiz
quiz_obj.language
will both be valid.
Here is a relevant Django ticket, which was closed with a resolution of "wontfix" six years ago:
https://code.djangoproject.com/ticket/14969
I think this comment provides some good information:
Comments gives you the *right* way to handle this problem -- you define an interface, and make the model itself pluggable. Not all Django's contrib apps follow this approach, but that doesn't mean we bake monkeypatching into the core -- we fix the contrib apps.
django.contrib.comments is now a standalone app, but it still makes itself relatively easy to customize. Here is the relevant documentation:
https://django-contrib-comments.readthedocs.io/en/latest/custom.html
If a third party app doesn't make itself easy to customize, I would suggest asking the developer to update it and point them to the above links for examples on how to go about doing it.
I've recently started tampering with Mezzanine and I am trying to add 2 new fields to the Blog Post admin -- keywords, and meta title.
I did it by editing my admin.py file and adding the following:
from mezzanine.blog.admin import BlogPostAdmin
from mezzanine.generic.models import Keyword, AssignedKeyword
BlogPostAdmin.fieldsets[0][1]["fields"].extend(["keywords"])
BlogPostAdmin.fieldsets[0][1]["fields"].extend(["_meta_title"])
admin.site.register(Keyword)
admin.site.register(AssignedKeyword)
I see the fields in the blog post manager, but when I edit them specific to a blog post, they don't save to that post. However, if I am adding keywords, the keywords get saved to the overall site keywords (generic_keyword table).
Is there any way to make them also update the blog post such that _meta_title and keywords_string gets updated in blog_blogpost? Thanks for any help.
EDIT: After looking into this further, it doesn't seem that I need to do anything to get the "Meta Data" section to be expandable. However, in my copy, it cannot be expanded. Is there any particular reason for this?
The answer above is a bit incomplete, and will be misleading for anyone who comes across the same problem.
My guess is that at some point you copied the admin's base_site.html template into your project, from an older version of Mezzanine. You've then later upgraded to a newer version of Mezzanine, which refers to an upgraded version of chosen - you can see the commit from 3 months ago here where that occurred here: https://github.com/stephenmcd/mezzanine/commit/f4e33282eaac44ef8ebbadb9b0157d910c67973a
If anyone experiences this issue, check your javascript console. In my case, for whatever reason, the Admin section was trying to load mezzanine/chosen/chosen-0.9.12.jquery.js which doesn't exist. I edited blog/templates/admin/base_site.html and updated it to mezzanine/chosen/chosen.jquery.js and the Meta Data section became expandable/collapsible again.
I have a set of top-level configuration data fields that I want to be able to set within django admin for each deployment of my django app. I only want one set of these.
Example fields: site_logo, contact_person, address, facebook_url, twitter_url
The problem is that Django Admin is geared towards tables (lists) of models, so its not a good fit for this type of singular configuration model. I really only want one of these models to exist for the whole site, and to be able to click into it from admin and edit the various fields.
It seems i've come across a 3rd party app in the past to accomplish this but can't find it anywhere. Part of the problem is I'm finding it difficult to find the right words to google. Any ideas?
It looks like django-values will do what you're looking for.
Other possible contenders:
http://github.com/sciyoshi/django-dbsettings (doesn't look maintained)
http://github.com/jqb/django-settings
Have a look at django-livesettings it sounds like it might fit.
Not that i have used it, but i have heard good things about django-constance.
And there are even some more options listed in the Configuration-Grid on Django Packages.
I am building a site where users can make changes to their publicaly displayed profile. However I need all changes to be approved by an admin before going live. Until the changes are approved their old profile will be displayed. In the admin there should be a list of profiles awaiting approval. It is preferable, but not required, to keep a history of versions.
I have looked at django-reversion, but don't think that will handle showing an old version while keeping a new one under-approval.
I'm looking for ways to achieve this with django...
Two from-the-hip ideas. How about...
Use reversion and add logic which auto-marks a profile as 'unapproved' on save() if the save is not performed by an administrator, then add a custom accessor to your code that gets the latest approved profile from the reversion archive.
Or, if reversion won't play nicely, have a 'current profile' and 'pending profile' for each user and update the FKs when the profile is approved...
This apps do exactly what you need
http://github.com/dominno/django-moderation
I've had some problems using django-moderation from dominno, which are:
Using a unique model for tracking changes in several others, with a GenericForeignKey reduces the amount of tables needed to monitor things, but it's a pain to manage. And I don't trush GenericForeignKeys for this type of task.
Deserialization of sandboxed values would invariably fail if I changed one field's name in the model. (for example, if I migrated a field change of name after monitoring it in moderation). It should at least be able to recover non bogus field values.
So I made my own app, which tackles the problems mentioned above.
It should give you what you're looking for.
https://github.com/artscoop/django-approval
It has auto approval mechanism, field selection (you can always ignore some fields, and put others to validation) and default values (for example, automatically set an object to hidden when it's created, so that it can be moderated without being visible in the first place)