Hi,

I have a custom user who has work experience, and for each work experience 
there can be multiple recommendations for the work experience.

My models:
CustomUser

class WorkExperience(models.Model):

    user = models.ForeignKey(CustomUser, verbose_name=_('user profile'))

    company = models.CharField(_('company name'), max_length=150)

    location = models.CharField(_('job location'), max_length=150)

    position = models.CharField(_('position'), max_length=150)

    start_date = models.DateField(_('started position'))

    end_date = models.DateField(_('finished position'), null=True, blank=
True)

    description = models.TextField(_('details'), help_text=_('Write a short 
description about your role and experience when at this position.'))

    

    last_edited = models.DateTimeField(default=timezone.now)

    date_added = models.DateTimeField(default=timezone.now)

    

    def __unicode__(self):

        return "%s - %s" % (self.company, self.position)

    

class Recommendation(models.Model):

    user = models.ForeignKey(CustomUser, verbose_name=_('recommended user'))

    workexperience = models.ForeignKey(WorkExperience, verbose_name=_('work 
experience'))

    details = models.TextField(_('recommendation'))

    approved = models.BooleanField(default=False)

    is_spam = models.BooleanField(default=False)

    date_added = models.DateTimeField(default=timezone.now)

admin.py

class ExperienceInline(admin.StackedInline):

    model = WorkExperience

    fieldsets = (

        (None, {

            'fields': (

                'company', 

                'position',

                'location',

                ('start_date','end_date'),

                'description'

            )

        }),

    )

class RecommendationInline(admin.StackedInline):

    model = Recommendation

class CustomUserAdmin(UserAdmin):

    ...
    inlines = [ExperienceInline, RecommendationInline]


The problem is the recommendations inline lists work history from all users 
instead of showing only the work experience from the selected user. Is it 
possible to list only work experience  belong to the selected user?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/cff6Fm8t54YJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to