Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6153749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:08:40+00:00 2026-05-23T20:08:40+00:00

I’m working on a calendar via Python’s HTMLCalendar and Django. The functions I’m using

  • 0

I’m working on a calendar via Python’s HTMLCalendar and Django. The functions I’m using to input data into the calendar are showing up as unbound, and therefore not working.

Here’s the calendar code:

from www.wednesday.models import Event
import calendar
e = Event()
class EventCal(calendar.HTMLCalendar):

    def formatday(self, day, weekday):
        if day == 0:
            return '<td class="noday">&nbsp;</td>' # Day outside month
        if day == e.dd():
            return '<td class="%s">%d</p><a href=\"%s\" target=\"_blank\">%s</a></td>' % (self.cssclasses[weekday], day, e.link(), e.res())
        else:
            return '<td class="%s">%d</td>' % (self.cssclasses[weekday], day)

class rendCal:
    c = EventCal(calendar.SUNDAY)

Here’s my models.py:

from django.db import models

class Event(models.Model):
    Restaurant = models.CharField(max_length=200)
    LinkURL = models.CharField(max_length=200)
    created = models.DateTimeField(auto_now_add=True)
    DateDay = models.IntegerField(max_length=2)

    def dd(self):
        return '%i' % self.DateDay

    def link(self):
        return '%s' % self.LinkURL

    def res(self):
        return '%s' % self.Restaurant

And lastly, my views.py:

from django.shortcuts import render_to_response
import www.wednesday.models
from www.wednesday.cal import rendCal
import datetime as dt

def calendar(request):
    now = dt.datetime.now()
    cal = rendCal.c.formatmonth(now.year, now.month)
    return render_to_response('cal.html', {'calendar': cal})

Everything works except for the functions from Event that are called inside the EventCal class.

Obviously I’m quite new at this.

Okay, @Marcin asked for an error, this is what I’m seeing, also I corrected the capitalization.

TypeError at /calendar/
unbound method dd() must be called with Event instance as first argument (got nothing instead)
cal.py in formatday, line 9

The environment variables in EventCal from Event are showing up blank, I’m pretty sure that’s why I’d been getting the needs int not str error. When I change e.dd() to a static number, it returns everything but e.link() and e.res().

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:08:41+00:00Added an answer on May 23, 2026 at 8:08 pm

    dd() is a method of an instance of the class.

    You call it like this:

    e = Event()
    x = e.dd()
    

    You can’t apply dd to Event itself.

    I am not sure what exactly you are trying to do, so I am not sure how you need to modify your code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I need to clean up various Word 'smart' characters in user input, including but
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.