I've read some other posts regarding this issue as well as the
following article: http://www.b-list.org/weblog/2007/nov/03/working-models/.
I cannot seem to get this thing to work.  Thank you in advance for any
help.  Here is my code.

---------- view ----------
from django.db.models import get_model

def blah():
    c = get_model('conferences', 'conference')
    uc = c.upcoming()

---------- model ----------
class Conference(models.Model):
.
.
.

    def upcoming(self):
        today = datetime.today()
        return self.objects.filter(date__gte=(today))

I've also tried the following in my view code:


def blah():
    c = Conference()
    uc = c.upcoming()

I cannot stop the following error from displaying:

TypeError at /scientists/portal

unbound method upcoming() must be called with Conference instance as
first argument (got nothing instead)

Request Method:         GET
Request URL:    http://127.0.0.1:8000/scientists/portal
Exception Type:         TypeError
Exception Value:

unbound method upcoming() must be called with Conference instance as
first argument (got nothing instead)

Exception Location:     /home/guy/DjangoApps/scinet/scientists/views.py
in portal, line 20
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to