many-to-many

Django ManyToMany Template Questions

Good Morning All, I've been a PHP programmer for quite some time, but I've felt the need to move more towards the Python direction and what's better than playing around with Django. While in the process, I'm come to a stopping point where I know there is an easy solution, but I'm just missing it - How do I display manytomany relationsh...

Relationships in Django Admin

I get really confused with many-to-many database relationships, so can some one please clarify how I would achieve this? I need a table of "Tags" (as in tag words) and a table for "Entries", such at many "Entries" could correspond to many Tag words. Right now I have my models like this: # models.py class Tags(models.Model): tag ...

Many-to-Many relationship in DataNucleus (JDO) doesn't persist

Hi, I don't manage to persist a many-to-many link with DataNucleus using JDO. I have two classes Book and Shop. This is the orm mapping file: <?xml version="1.0"?> <!DOCTYPE orm PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN" "http://java.sun.com/dtd/orm_2_0.dtd"&gt; <orm> <package name="com.my...

How to use Entity Framework to work with many-to-many relationships?

I have a SampleDB that contains 3 tables. Table Employees (EmployeeID, EmployeeName) Table Projects (ProjectID, ProjectName) Table ProjectResources (ProjectID, EmployeeID) The ProjectResources table is cross reference table that creates a many-to-many relationship between Employees and Projects. I would like to use LINQ to select all...

Ordering on a field in the 'through' Model of recursive ManyToMany relation in Django.

Assuming the following model: class Category(models.Model): related = models.ManyToManyField('self', symmetrical = False, through = 'CategoryRelation', null = True, blank = True) Assuming the following intermediate 'through' relation: class CategoryRelation(models.Model): source = models.ForeignKey('Category', null = False, b...

Many-to-Many implementation in linq-to-sql

Does anybody know an example of correct many-to-many implementation in Linq-to-Sql? Usually i use intermediate entity (e.g. CustomerProducts) in DataContext, and join it at every query. The idea is to hide intermediate entity from object level by adding custom properties to partial classes - use collections like IEnumerabe Customer.Prod...

How to do many-to-many relation between the same entity

I have an Employee entity class with (Id,Name,EmployeeType). EmployeeType entity (Id, Description) where Description can be either REGULAR/MANAGER. I am confused on how to map Employees who are of type REGULAR to their corresponding MANAGER type Employees. Should I just add an extra field to the Employee entity itself so that it now be...

Examples of "when is good idea implement many-to-many relationships"?

I ask this because need to understand/explain better with examples. clasical examples like: an Article can be published in multiple Publication objects, and a Publication has multiple Article objects. (source) I see is usefull for web2.0 for sharing features. ...

Django modelformset factories and many to many object relationships - how to pass it a particular value

Hey all, I have an issue where a particular modelform whose object is a many-to-many field pulls up the first entry there by default when passed to a modelformset_factory. An example follows: Say I have an Order object that has a many-to-many relationship with a Group. I have a form whose only editable field is a single input box with ...

Hibernate @ManyToMany delete relation problem

Hello. I have 2 entities: User and UsersList. @Entity @Table(name = "USERS") public class User { @Id @GeneratedValue @Column(name = "ID") private Long id; @ManyToMany(cascade = CascadeType.REMOVE, mappedBy = "users") private List<UsersList> usersLists = new ArrayList<UsersList>(); public List<UsersList> ge...

UML class model how to model many to many relationship

I have read several tutorials on what a UML model should contain and what not. As a developer I always think in terms of a relational data model where you could never have a many to many relationship between tables. Now with a UML class model, I've read that if they don't provide added value, you could just skip the linktables. However ...

Django: many-to-many relations, and through

I want to store which user invited another user to a group... but django is telling me this is ambigous and against the rules (which makes sense). groups.group: Intermediary model Group_to_Member has more than one foreign key to User, which is ambiguous and is not permitted. So how do I do this correctly? Maybe a generic rel...

Many to many lookups in Django

This is probably insultingly simple and worthy of a Nelson Muntz laugh, but I'm having a real braindead moment tryng to make many to many connections across various model relationships. I have the following models (simplified for your enjoyment!): class Document(models.Model): title = models.CharField(max_length=200) author = m...

Linq to Sql - Many to many - CRUD

Hi! I'm currently using Linq to sql as my OR-mapper. My problem is that i can't come up with a way to do crud-operations on a many-to-many context. The read part is no problem. I just create a partial class and expose a property that reads all entries using my relation table. What is the best way to add Create, Update and Delete funct...

How to alphabetically sort the values in a many-to-many django-admin box?

Hi, I have a simple model like this one: class Artist(models.Model): surname = models.CharField(max_length=200) name = models.CharField(max_length=200, blank=True) slug = models.SlugField(unique=True) photo = models.ImageField(upload_to='artists', blank=True) bio = models.TextField(blank=True) class Images(models.Model...

populate a many-to-many table with access

I have two tables (persons and projects) which are in a many-to-many table, thus linked together by a third table persons_projects In ms access I now created a form showing data from the projects table. What I want is to have a subform showing all persons- datasets which participate in this project. In this subform it should also be po...

LINQ many-to-many relationships: Solution?

LINQ so far has been remarkably elegant, but to perform basic m2m queries it offers no solution I can imediately see. What's worse is that while it works for any other table relationship, LINQ is not giving me an association in the class structure for my m2m table. So I can do things like artwork.artists.where(...) //or artist.Artwo...

Many to many relationship in java google ap engine

how would i go about creating a many-many relationship among data objects in google app engine (using jdo) The app engine page talks about 1-many and 1-1 but not many-many. Any code example will be highly appreciated ...

Determining ManyToMany vs OneToMany using ClassMetadata

...

LINQ to Entities and grouping with many-to-many association.

I have a Product and Category entity in many-to-many association. I am trying to display the category count for each product. So far, I have come up with this: Dim context = new Context() Dim products = context.Products() Dim productsByCategoryCount = From product In Products Group product By productId = product.productId Into produc...