hi i am a newbie in django i am creating an app with customuser and profile

i want get user profile information  in templates who is logged in.
try everypossible solution but didn't achieve anything

this is my profile models code below:

from django.db import models
from django.utils.translation import ugettext_lazy as _

from CustomUserAuth.models import CustomUser


class ProfileModel(models.Model):
        user = models.OneToOneField(CustomUser)
        avatar = models.ImageField(_('Profile Pic'),upload_to='images/')
        first_name = models.CharField(_('First Name'),max_length=100)
        last_name = models.CharField(_('Last Name'),max_length=100)
        company = models.CharField(_('Company'),max_length=100)
        title = models.CharField(_('Title'),max_length=100)

        def __str__(self):
                return '%s %s' % (self.first_name,self.last_name)

        def image_tag(self):
                return u'<img src="%s"/>' % (self.avatar.url)
        image_tag.short_description = 'Image'
        image_tag.allow_tags = True

CustomUser.profile = property(lambda u: 
ProfileModel.objects.get_or_create(user=u)[0])

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c4673b6c-f888-4fdb-8016-a6f2ece77568%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to