Set editable
to False
and default
to your default value.
http://docs.djangoproject.com/en/stable/ref/models/fields/#editable
b = models.CharField(max_length=7, default="0000000", editable=False)
Also, your id
field is unnecessary. Django will add it automatically.
More Related Contents:
- Django auto_now and auto_now_add
- Can “list_display” in a Django ModelAdmin display attributes of ForeignKey fields?
- Django Admin nested inline
- How to display uploaded images in “Change List” page in Django Admin?
- Nested inlines in the Django admin?
- Django admin file upload with current model id
- one-to-many inline select with django admin
- Override a form in Django admin
- Resize fields in Django Admin
- Django Multiple Databases – relation does not exist; LINE 1: SELECT COUNT(*) AS “__count” FROM
- Django admin: How to display the field marked as “editable=False” in the model?
- Add custom form fields that are not part of the model (Django)
- Django admin – inline inlines (or, three model editing at once)
- How to query as GROUP BY in django?
- How to override and extend basic Django admin templates?
- How do I filter query objects by date range in Django?
- Programmatically saving image to Django ImageField
- Django FileField with upload_to determined at runtime
- In Django, how does one filter a QuerySet with dynamic field lookups?
- Custom Filter in Django Admin on Django 1.3 or below
- Django Aggregation: Summation of Multiplication of two fields
- Default filter in Django admin
- What is the most efficient way to store a list in the Django models?
- Django – How to rename a model field using South?
- How to have a Python script for a Django app that accesses models without using the manage.py shell?
- How to monkey patch Django?
- models.py getting huge, what is the best way to break it up?
- matching query does not exist Error in Django
- How can I set two primary key fields for my models in Django?
- How to delete a record in Django models?