def get_url_for_ical_feed(self): # NOTE: we slice out the first char of the reverse() result because it's just a slash return utils.current_site_url() + reverse('calendar_feed', kwargs={'user_id': self.user.id})[1:]
def get_url_for_cal_item(self): assert self.slug return utils.current_site_url() + str(self.slug)
import vobject from django.utils.html import strip_tags from mysite.mainapp import utils import django.forms as forms CAL_ITEM_TOKEN_LENGTH = 10 FROM_ADDRESS = '"CalendarItem Robot" <*****@*****.**>' EDIT_CAL_ITEM_URL_BASE = utils.current_site_url() + 'edit/calendaritem/' class EmailAddress(models.Model): user = models.ForeignKey(User, related_name="%(app_label)s_%(class)s_related") email_address = models.CharField(max_length=1000) @classmethod def get_or_create_user_with_address(cls, email_address): email_address_objects = cls.objects.filter(email_address=email_address) if email_address_objects: return email_address_objects[0].user else: users = User.objects.filter(email=email_address, username=email_address) if users: return users[0] else: