tomchristie/django-rest-framework — pull request #492 by annacoder (2012-12-11 01:51:30+00:00)
Title: Making sure the assert does not fail  when required=False, read_only=True

Currently when you pass in required=False and read_only=True , you erroneously get an error saying ""Cannot set required=True and read_only=True" . This is because the assert is only checking for the read_only field in the else clause and assumes required is True in this clause but the if check is only for None and so it'll fail when the required is set to False and read_only is set to True. By making this assert explicitly check the complete condition, this case of required=False, read_only=True is handled.