David Larlet is sharing code with you

Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.

Don't show this again

david / django-roa http://welldev.org/

Turn your models into remote resources that you can access through Django's ORM. ROA stands for Resource Oriented Architecture.

Clone this repository (size: 579.8 KB): HTTPS / SSH
hg clone https://bitbucket.org/david/django-roa
hg clone ssh://hg@bitbucket.org/david/django-roa

Issues

#5 save() doesn't send field data

Reported anonymously

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.

Status: new Responsible: nobody Type: bug Priority: major
Milestone: none Component: none Version: none

Attachments

No attachments added for this issue yet.

Comments and changes

  1. #1 Anonymous

    written

    This was caused by extending a subclass rather than the roa Model class directory in my models, which breaks field mapping.

  2. #2 David Larlet

    written

    Can you paste your Form too? (and reformat your original issue?)

Add comment / attachment

Verification: Please write the text from the image in the box (letters only)

captcha

Is that you, Humanoid? Is this me?