Created
October 1, 2011 04:45
-
-
Save madzak/1255602 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CompanyWorkNotes(models.Model): | |
class Meta: | |
managed=False | |
oe_id = models.IntegerField(primary_key=True) | |
notes = models.TextField() | |
def __init__(self, company_id): | |
request = OeWebRequest("notes", "4242") | |
data = request.getData() | |
for field in CompanyWorkNotes._meta.fields: | |
setattr(self, field.name, dataValue) | |
def save(self, *args, **kwargs): | |
request = OeWebRequest("notes", self.oe_id) | |
dict = {} | |
for field in CompanyWorkNotes._meta.fields: | |
fieldVal = getattr(self, field.name) | |
if(fieldVal != ''): | |
dict[field.name] = getattr(self, field.name) | |
data = simplejson.dumps(dict) | |
request.sendData("PUT", data) | |
return self |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment