I have a simple model:
class Field(ROAModel):
created_at = models.DateTimeField()
updated_at = models.DateTimeField()
name = models.CharField(max_length=60)
type = models.CharField(max_length=60)
label = models.CharField(max_length=60)
options = models.CharField(max_length=1000, blank=True, null=True)
parent_id = models.IntegerField(null=True, blank=True)
template_id = models.IntegerField()
@staticmethod
def get_resource_url_list():
return ROAModel.location() + 'field'
ROAModel is a wrapper class I have that sets some defaults to help when juggling these models between different sites and API base URLS.
For some reason, the following only sends "id" and "format" in the POST body:
def templates(req):
if req.method == 'POST':
form = TemplateForm(req.POST)
if form.is_valid():
t = Template.objects.create(name=form.cleaned_data['name'])
Here is the value of req.POST:
<QueryDict: {u'name': [u'new template']}>
name is defined right there in the ROA model, so I don't understand why the "name" attribute is not sent in the POST body.
Could someone please help with this? I'm very stuck.