Hi guys,
I am new to Open EDX and Django developments. I have a dumb question.
How can I add a custom field in Studio and access it with the API?
I mean, I have to add a field, Let’s says “Blah”. The instructor need to put text in and, when the course will be save, store it to the DB.
I’m wondering what’s the best way to do that? I saw this topic Add custom field on registration page but still don’t know how to do the same thing to a course.
Thx for your help
Hi @Kent1,
That’s not a dumb question because what you’re asking is definitely not obvious in Open edX.
The answer depends on the scope of the new field. Is it one field (and one value) per course? (If you want it per unit or per component or something, it gets even more tricky).
If the scope is per-course, the easiest way that doesn’t require modifying the platform is to use “Custom Course Settings” as described in this thread: Enabling Custom Course Settings
That is essentially one field per course that can hold whatever custom data you’d like. However, it requires that the data is in JSON format which may be inconvenient for your course authors to use.
Another approach is to modify the platform to add additional fields to CourseFields
, in which case there will be a nicer UI for inputting them on the “Advanced Settings” page of each course in Studio. However, we generally advise against this sort of platform modification as you’ll have to maintain it across all future platform releases.