I\'ve got a model similar to this:
class Product(models.Model):
third_party_id = models.CharField(max_length=64, blank=False, unique=True)
The above is helpful (shanyu's answer using get_readonly_fields), however it does not work properly if used in "StackedInline". The result is two copies of whatever field is marked readonly, and it is not editable in the "add" instance. See this bug: https://code.djangoproject.com/ticket/15602
Hope this saves someone some searching!