Ejemplo n.º 1
0
        if idios.settings.MULTIPLE_PROFILES:
            # @@@ using PK here is kind of ugly. the alternative is to
            # generate a unique slug for each profile, which is tricky
            kwargs = {
                "profile_slug": self.profile_slug,
                "pk": self.pk
            }
        else:
            if idios.settings.USE_USERNAME:
                kwargs = {"username": self.user.username}
            else:
                kwargs = {"pk": self.pk}
        return reverse("profile_detail", kwargs=kwargs)
    
    @classmethod
    def get_form(cls):
        return get_profile_form(cls)
    
    def _default_profile_slug(cls):
        return cls._meta.module_name
    
    profile_slug = ClassProperty(classmethod(_default_profile_slug))



def additional_info_kickstart(sender, **kwargs):
    request = kwargs.get("request")
    request.session["idios_additional_info_kickstart"] = True
if user_logged_in: # protect against Pinax not being available
    user_logged_in.connect(additional_info_kickstart)
Ejemplo n.º 2
0
            kwargs = {
                "profile_slug": self.profile_slug,
                "profile_pk": self.pk
            }
        else:
            kwargs = {"username": self.user.username}
        return reverse("profile_detail", kwargs=kwargs)
    
    @classmethod
    def get_form(cls):
        return get_profile_form(cls)
    
    def _default_profile_slug(cls):
        return cls._meta.module_name
    
    profile_slug = ClassProperty(classmethod(_default_profile_slug))


def create_profile(sender, instance=None, **kwargs):
    if instance is None:
        return
    profile, created = get_profile_model().objects.get_or_create(user=instance)
post_save.connect(create_profile, sender=User)


def additional_info_kickstart(sender, **kwargs):
    request = kwargs.get("request")
    request.session["idios_additional_info_kickstart"] = True
if user_logged_in: # protect against Pinax not being available
    user_logged_in.connect(additional_info_kickstart)