Hi --

I am new to Django programming, and need a few tips on how to accomplish
something.

What I need is to have a model that provides a data access layer to
multiple databases. Something like what I have pseudocoded below.  The
idea is to just use the DataAccess layer (class) to access various files
and objects.
So --
da = DataAccess()
result = da.search('Jones')

class DataAccess:
    def search(self, searchterm):
       if somecondition:
           se = SearchEngine()
           se.search(searchterm)
          """some more code here"""
       else:
          People.objects.filter(last_name=searchterm)

    def add(self, obj):
       """add to search engine, AND add to database"""

    def select(self, id)
       """select id from database"""
         
class SearchEngine:
    def search(self, searchterm):
       """look in a SOLR server for searchterm"""
    def add(self, obj):
    def select(self, id)

class Person(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=30)
    file_name=models.FileField(...)

But I'm wondering if this isn't a place I should be using a Model
Manager class.

Any ideas about how I should implement a DAO in Django?

Liam

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to