« Return to Thread: Beginner's problems - class mapping

Beginner's problems - class mapping

by kwestooor :: Rate this Message:

Reply to Author | View in Thread

Hello everyone,
i've just started with django/flex and desperately need few explanations to move on.

Been doing django tutorial from djangoproject site and i wondered to make interface for it in flex, but i stuck at the beginning though.

I dug for examples suitable for my needs, but havent found much of basic configuration of class mapping :(


Maybe someone will explain how to set this up? (basics, basics...)

(I suppose i messed with views.py (should use gateway.py apart from it? :)

models.py
-------------

class Poll(models.Model):
    question = models.CharField(max_length=200)
    pub_date = models.DateTimeField('date published')


views.py
------------
from pyamf.remoting.gateway.django import DjangoGateway
from sample_proj.polls.models import Poll

def get_polls(self):
    return Poll.objects.all()

services = {
    'reportxservice': reportxservice.reportxservice(),
}

reportxGateway = DjangoGateway(services)



reportxApp.mxml
---------------------
<mx:Script>
        <![CDATA[

public function getPollsResult(event:ResultEvent){
    outputField.text = event.result.toString();
    resultField.text = event.toString();
}
        ]]>
       
</mx:Script>

<mx:RemoteObject id="ro" endpoint="http://localhost:8000/reportx/"
        destination="reportxservice"
        result="getPollsResult(event)"
  fault="Alert.show('some errors?')"/>

<mx:Button x="178" y="148" label="Get polls" click="ro.get_polls()"/>  

---------------------------------------

I have 3 Polls in database, and i receive at outputField:
[object Object],[object Object],[object Object],
so it works at kind a way :)

My question is how to receive fields values of Poll object from db?


Please help!

Regards, Artur
_______________________________________________
PyAMF users mailing list - users@...
http://lists.pyamf.org/mailman/listinfo/users

 « Return to Thread: Beginner's problems - class mapping