Exemple #1
0
    country = models.CharField(_("country"), max_length=3,
                               choices=COUNTRY_CHOICES)

    approved = models.BooleanField(_("approved"), default=False)
    editors = models.ManyToManyField(settings.AUTH_USER_MODEL, null=True,
                                     blank=True,
                                     related_name='companies')

    pub_date = models.DateTimeField(_("Published at"), auto_now_add=True)

    def get_absolute_url(self):
        return reverse('company-details', kwargs={'pk': self.pk})

    def __unicode__(self):
        return self.name

    class Meta(object):
        verbose_name = _("company")
        verbose_name_plural = _("companies")
        ordering = ('name',)


class CompanyContentProxy(contents.BaseProxy):
    model_class = Company
    label = _("My companies")

    def get_queryset(self):
        return guardian.shortcuts.get_objects_for_user(self.request.user, 'companies.change_company')

contents.register(CompanyContentProxy)
Exemple #2
0
    def __unicode__(self):
        return self.name

    class Meta(object):
        verbose_name = 'Session type'
        verbose_name_plural = 'Session types'


class SessionContentProxy(contents.BaseProxy):
    model_class = Session
    label = "Meine Sessions"

    def get_queryset(self):
        return Session.objects.filter(speaker=self.request.user)

contents.register(SessionContentProxy)


class RSVP(models.Model):
    """
    A RSVP object represents the status of attendence of a person at a meetup.
    The source of this information in the current implementation is Meetup.com
    and not linked to a local user account.

    The status can be either coming, not coming, maybe or unknown (represented
    by a null value).
    """
    status = models.CharField(_("Status"), choices=RSVP_STATUS_CHOICES,
        null=True, blank=True, max_length=20)
    remote_username = models.CharField(_("Username"), null=True, blank=True,
        max_length=100)