user992523
user992523

Reputation:

Drupal: Managing a "has many" relationship with the views module

I'm working on a Drupal site for a friend and I'm having some trouble creating a view that displays content based what is really a "has many" relationship. I'm much more of a rails programmer and don't have too much experience with Drupal so I'd rather not reinvent the wheel if its not necessary here.

Basically there are a two roles that are assigned to users upon logging in that represent their profile type on the site. For the sake of brevity I'll just call them "students" and "professors." As you would expect one professor can have many students, and students can only have one professor. I'm working on creating a view for a "professor" which would show that "professor" all of his/her students. Now, the "students" profile type maintains an auto-complete field which holds a user reference to their "professor" but there is no field in the "professor" profile to do this because there can be an arbitrary number of "students" for each professor.

Is there an easy way to go about creating this view with the module's interface? Or does this require some more in-depth work with a back-links table? I might be going about this in the wrong way from the top down too, so any tips, no matter how "umm, well first you did this wrong" would help.

Thanks! Any help would be greatly appreciated.

Upvotes: 1

Views: 1035

Answers (1)

user1006370
user1006370

Reputation: 60

This may help you: http://drupal.org/node/1103484

And this module may help you: http://drupal.org/project/relation

Upvotes: 1

Related Questions