Saving Data Form In Django Without Editable Property For Admin-django
I want to save the data of a form that user submit. But I don't wanna the admin be able to edit those data at all. I tried the readonly_field stuffs, but that didn't work.
class User(models.Model): first_name = models.CharField(max_length=100) country = CountryField()
from django.contrib import admin from .models import User admin.site.register(User) class MyAdmin(admin.ModelAdmin): readonly_fields=('first_name', 'country')
You have to add class
MyAdmin also into the User for that to work .
from django.contrib import admin from .models import User class MyAdmin(admin.ModelAdmin): readonly_fields=('first_name', 'country') admin.site.register(User,MyAdmin)
- → What are the pluses/minuses of different ways to configure GPIOs on the Beaglebone Black?
- → Django, code inside <script> tag doesn't work in a template
- → React - Django webpack config with dynamic 'output'
- → GAE Python app - Does URL matter for SEO?
- → Put a Rendered Django Template in Json along with some other items
- → session disappears when request is sent from fetch
- → Python Shopify API output formatted datetime string in django template
- → Shopify app: adding a new shipping address via webhook
- → Shopify + Python library: how to create new shipping address
- → shopify python api: how do add new assets to published theme?
- → Access 'HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT' with Python Shopify Module