Below is what I have the model in django. I can do the ListField() in 
web2py using "list:string" I believe but I am having problem with how to do 
EmbeddedModelField! in web2py. I don't understand what you mean by "do it 
independently of backend"! Do you mean to insert the table in mongodb 
independently and somehow then call from web2py to create the DAL object? 




from django.db import modelsfrom django.core.urlresolvers import reverse
from djangotoolbox.fields import ListField, EmbeddedModelField

class Post(models.Model):
    created_at = models.DateTimeField(auto_now_add=True, db_index=True)
    title = models.CharField(max_length=255)
    slug = models.SlugField()
    body = models.TextField()
    comments = ListField(EmbeddedModelField('Comment'), editable=False)

    def get_absolute_url(self):
        return reverse('post', kwargs={"slug": self.slug})

    def __unicode__(self):
        return self.title

    class Meta:
        ordering = ["-created_at"]

class Comment(models.Model):
    created_at = models.DateTimeField(auto_now_add=True)
    body = models.TextField(verbose_name="Comment")
    author = models.CharField(verbose_name="Name", max_length=255)






On Thursday, May 7, 2015 at 3:26:00 AM UTC-4, Paolo Valleri wrote:
>
> I don't see any problem at all in implementing a common post-comment page 
> in web2py.
> You can code it independently from the backend. 
>
> On Wednesday, May 6, 2015 at 8:28:08 PM UTC+2, Ron Chatterjee wrote:
>>
>> Here is another tutorial from django:
>>
>>
>> *http://docs.mongodb.org/manual/tutorial/write-a-tumblelog-application-with-django-mongodb-engine/
>>  
>> <http://docs.mongodb.org/manual/tutorial/write-a-tumblelog-application-with-django-mongodb-engine/>*
>>
>>
>> Pretty cool. Wondering if we can have a web2py version implementing the 
>> same with mongodb.  Any thoughts any one?
>>
>>
>>
>> On Tuesday, May 5, 2015 at 4:49:08 PM UTC-4, Ron Chatterjee wrote:
>>>
>>> I was wondering about creating an object inside an object. As shown in 
>>> the link above:
>>>
>>> {
>>>   'created_on': ISODate('...'),
>>>   'author_name' : 'Bob',
>>>    'author_email': 'b...@example.org',
>>>   'text' : 'The cake is a lie'
>>> }
>>>
>>>
>>> instead of that dict someone can also write it as:
>>>
>>>
>>> {
>>>   'created_on': ISODate('...'),
>>>   'author' : {
>>>     'name': 'Bob',
>>>     'email': 'b...@example.org'
>>>   },
>>>   'text' : 'The cake is a lie'}
>>>
>>>
>>>
>>> Django handles with "EmbeddedModelField". How does web2py handles that? 
>>> I am thinking there must be a way.
>>>
>>>
>>> On Tuesday, May 5, 2015 at 12:58:48 PM UTC-4, Cássio Botaro wrote:
>>>>
>>>> Actually DAL have experimental mongodb support.
>>>> You can see 
>>>> http://www.web2pyslices.com/slice/show/1580/save-the-earth-from-a-total-data-mess-with-mongodbadapter
>>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to