Question: I'm trying to use the Django REST framework to generate json I'll be able to use later on my website. The thing is, I have Users, who have one-to-many projects, and these projects have one-to-many tasks.

The thing is, I'd like to display a list of my users, then when I access the details of an user, I can see his projects. Then, when I check the details of a project, I can see the tasks of this project. Now, my models are defined like this :

```
class SimpleUser(AbstractBaseUser):
    username = models.TextField(max_length=40, unique=True)
    firstname = models.TextField(max_length=40)
    lastname = models.TextField(max_length=40)

class Project(models.Model):
    user = models.ForeignKey(SimpleUser, null=True)
    name = models.TextField(max_length=255)

class Task(models.Model):
    project = models.ForeignKey(Project, related_name='task_project')
    title = models.TextField(max_length=255)

```

And when I'm trying to display for example the Projects linked to an User, I have an error no matter what I try (I'm pretty sure this is because what I do is wrong), and the error is "SimpleUser has no attribute Project". Which is logical. But I really don't know how to do this, can someone help me ?

Answer: 
You could try this:

```
your = from p in (toSelect)
select new
{
  last = p.Last,
  current = p.CurrentPlayer,
  seats = p.Seated.Select(s => s.UID != null
    ? new
      {
          UID = s.UID,
          buyin = s.BuyIn
      }
    : null;
}

```
Replace your expression that you're assigning to `seats` with: 

```
seats = p.Seated.Select(s => s != null ? new { UID = s.UID, buyin = s.BuyIn } : null)

```

> 
> Hope this is clear enough.
> 
> 
> 

I'll be honest. It's not clear enough. Is `s.UID` a nullable type and that's what we need to compare to `null`?