Search Results

Search found 83 results on 4 pages for 'm2m'.

Page 1/4 | 1 2 3 4  | Next Page >

  • django m2m how can i get m2m table elements in a view

    - by dana
    i have a model using m2m feature: class Classroom(models.Model): user = models.ForeignKey(User, related_name = 'classroom_creator') classname = models.CharField(max_length=140, unique = True) date = models.DateTimeField(auto_now=True) open_class = models.BooleanField(default=True) members = models.ManyToManyField(User,related_name="list of invited members", through = 'Membership') and i want to take all members of one class in a view and display them using the template system. In the view, i'm trying to take all the members from a classroom like that: def inside_classroom(request,classname): try: theclass = Classroom.objects.get(classname = classname) members = Members.objects.all() etc but it doesn't work,(though the db_table is named Classroom_Members) i guess i have to use another query for getting all the members from the classroom classname. also, i want to verify if the request.user is a member using (if request.user in members) how can i het those members? Thanks in advance!

    Read the article

  • The Many-to-Many Revolution 2.0 #ssas #mdx #dax #m2m

    - by Marco Russo (SQLBI)
    In September 2006 I had announced in this blog the release of the first version of The Many-to-Many Revolution, a whitepaper that describes how to leverage the many-to-many dimension relationships feature that had being available since Analysis Services 2005. The paper contains many generic patterns that can be applied in many common data analysis’ scenarios. More than 5 years later and more then 20.000 unique people that downloaded the 1.0 paper, I am proud to announce that we released The Many-to-Many...(read more)

    Read the article

  • django display m2m elements in a template

    - by dana
    if a have a declaration like theclass = Classroom.objects.get(classname = classname) members = theclass.members.all() and i want to display all the members(of a class) in a template, how should i do it?? if i write: {{theclass.members.all}} the output is an empty list(though the class has some members) How should the elements of a m2m table be displayed in a template? thanks!

    Read the article

  • django-admin: creating,saving and relating a m2m model

    - by pastylegs
    I have two models: class Production(models.Model): gallery = models.ManyToManyField(Gallery) class Gallery(models.Model): name = models.CharField() I have the m2m relationship in my productions admin, but I want that functionality that when I create a new Production, a default gallery is created and the relationship is registered between the two. So far I can create the default gallery by overwriting the productions save: def save(self, force_insert=False, force_update=False): if not ( Gallery.objects.filter(name__exact="foo").exists() ): g = Gallery(name="foo") g.save() self.gallery.add(g) This creates and saves the model instance (if it doesn't already exist), but I don't know how to register the relationship between the two?

    Read the article

  • Django m2m adding field in the secondary table

    - by dana
    I have a model in wich i'm using m2m Django ORM feature, in order to create an aditional table to hold my 'classrom members'. My problem is: the membership to a classroom must be accepted by the invited one, so i need a boolean field :1=accepted, 0=refused/unseen yet. How can i include this boolean variable in the aditionally generated classroom_membership (and NOT in the primary created Classroom table)? class Classroom(models.Model): user = models.ForeignKey(User, related_name = 'classroom_creator') classname = models.CharField(max_length=140, unique = True) date = models.DateTimeField(auto_now=True) open_class = models.BooleanField(default=True) #domain = models.EnumField() members = models.ManyToManyField(User,related_name="list of invited members") Thanks in advance!!

    Read the article

  • Django m2m form appearing fields

    - by dana
    I have a classroom application,and a follow relation. Users can follow each other and can create classrooms.When a user creates a classroom, he can invite only the people that are following him. The Classroom model is a m2m to User table. i have in models. py: class Classroom(models.Model): creator = models.ForeignKey(User) classname = models.CharField(max_length=140, unique = True) date = models.DateTimeField(auto_now=True) open_class = models.BooleanField(default=True) members = models.ManyToManyField(User,related_name="list of invited members") and in models.py of the follow application: class Relations(models.Model): initiated_by = models.ForeignKey(User, editable=False) date_initiated = models.DateTimeField(auto_now=True, editable = False) follow = models.ForeignKey(User, editable = False, related_name = "follow") date_follow = models.DateTimeField(auto_now=True, editable = False) and in views.py of the classroom app: def save_classroom(request, username): if request.method == 'POST': u = User.objects.get(username=username) form = ClassroomForm(request.POST, request.FILES) if form.is_valid(): new_obj = form.save(commit=False) new_obj.creator = request.user r = Relations.objects.filter(initiated_by = request.user) # new_obj.members = new_obj.save() return HttpResponseRedirect('.') else: form = ClassroomForm() return render_to_response('classroom/classroom_form.html', { 'form': form, }, context_instance=RequestContext(request)) i'm using a ModelForm for the classroom form, and the default view, taking in consideration my many to many relation with User table, in the field Members, is a list of all Users in my database. But i only want in that list the users that are in a follow relationship with the logged in user - the one who creates the classroom. How can i do that? Thanks!

    Read the article

  • M2M Solutions: The Move to Value Creation and the Internet of Things

    - by Javier Puerta
    There's a new Oracle-sponsored report available around big data, specifically machine to machine data (there will probably be more growth in m2m data than human-generated stuff like social media). Forbes published an article, Big Data Set to Explode as 40 Billion New Devices Connect to Internet, which references the report. Login to Download the M2M Solutions Report Good reading!

    Read the article

  • The Future of M2M in a Connected World

    - by Kristin Rose
    Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} There is no denying that the technological landscape as we know it is drastically changing all thanks to three little words – Machine to Machine. The M2M platform has taken over as one of the industry’s main buzz words and there is no question as to why! Just 5 months ago we had a guest post on “Machine to Machine – The Internet of Things – It’s about the Data.” Now companies are extending the use of M2M data to increase opportunity and intelligence across the Enterprise. Just this week, Oracle announced the results of its “Designing an M2M Platform for the Connected World” research, examining the evolving drivers behind ‘Machine to Machine’ (M2M) projects and how those changes are impacting solution requirements. Be sure to read this exciting report here! To Infinity and Beyond, The OPN Communications Team Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

    Read the article

  • Django User M2M relationship

    - by Antonio
    When trying to syncdb with the following models: class Contact(models.Model): user_from = models.ForeignKey(User,related_name='from_user') user_to = models.ForeignKey(User, related_name='to_user') class Meta: unique_together = (('user_from', 'user_to'),) User.add_to_class('following', models.ManyToManyField('self', through=Contact, related_name='followers', symmetrical=False)) I get the following error: Error: One or more models did not validate: auth.user: Accessor for m2m field 'following' clashes with related m2m field 'User.followers'. Add a related_name argument to the definition for 'following'. auth.user: Reverse query name for m2m field 'following' clashes with related m2m field 'User.followers'. Add a related_name argument to the definition for 'following'. auth.user: The model User has two manually-defined m2m relations through the model Contact, which is not permitted. Please consider using an extra field on your intermediary model instead. auth.user: Accessor for m2m field 'following' clashes with related m2m field 'User.followers'. Add a related_name argument to the definition for 'following'. auth.user: Reverse query name for m2m field 'following' clashes with related m2m field 'User.followers'. Add a related_name argument to the definition for 'following'.

    Read the article

  • Webinar, June 27: Application Intelligence and Connected Devices

    - by terrencebarr
    Oracle and Beecham have recently conducted a market survey on use of Connected Devices for M2M & Internet of Things (IoT) applications and new trends. On June 27, 9 am ET the first session in this webinar series addresses intelligence in connected devices. Join Peter Utzschneider from Oracle and Robin Duke-Woolley of Beecham Research as they discuss the findings from this survey and the implications for the M2M & IoT connected devices market: What are the key business drivers of your connected devices program? To what extent do you expect the intelligence required for M2M & IoT applications to change? Would these changes occur at the network edge, at the data center, or both? What are the impacts of these changes on ISV’s and device manufacturers? What are the opportunities for other M2M & IoT players? To attend, please register for free or click on the image. Cheers, – Terrence Filed under: Embedded Tagged: Connected, devices, iot, Java Embedded, Java ME Embedded, M2M, webinar

    Read the article

  • IDC and Becham Research: New analyst reports and webcast

    - by terrencebarr
    Embedded Java is getting a lot of attention in the analyst community these days. Check out these new analyst reports and a webcast by IDC as well as Beecham Research. IDC published a White Paper titled “Ghost in the Machine: Java for Embedded Development”, and an accompanying webcast recording. Highlights of the White Paper: The embedded systems industry is projected to continue to expand rapidly, reaching $2.1 trillion in 2015 The market for intelligent systems, where Java’s rich set of services are most needed, is projected to grow to 78% of all embedded systems in 2015  Java is widely used in embedded systems and is expected to continue to gain traction in areas where devices present an application platform for developers The free IDC webcast and White Paper can be accessed here. Beecham Research published a report titled “Designing an M2M Platform for the Connected World”. Highlights of the report: The total revenue for M2M Services is projected to double, from almost $15 billion in 2012 to over $30 billion in 2016 The primary driver for M2M solutions is now enabling new services Important trends that are developing are: Enterprise integration – more data and using the data more strategically, new markets in the Internet of Things (IoT), processing large amounts of data in real time (complex event processing) Using the same software development environment for all parts of an M2M solution is a major advantage if the software can be optimized for each part of the solution The free Beecham Research report can be accessed here. Cheers, – Terrence Filed under: Mobile & Embedded Tagged: iot, Java Embedded, M2M, research, webcast

    Read the article

  • IDC and Becham Research: New analyst reports and webcast

    - by terrencebarr
    Embedded Java is getting a lot of attention in the analyst community these days. Check out these new analyst reports and a webcast by IDC as well as Beecham Research. IDC published a White Paper titled “Ghost in the Machine: Java for Embedded Development”, and an accompanying webcast recording. Highlights of the White Paper: The embedded systems industry is projected to continue to expand rapidly, reaching $2.1 trillion in 2015 The market for intelligent systems, where Java’s rich set of services are most needed, is projected to grow to 78% of all embedded systems in 2015  Java is widely used in embedded systems and is expected to continue to gain traction in areas where devices present an application platform for developers The free IDC webcast and White Paper can be accessed here. Beecham Research published a report titled “Designing an M2M Platform for the Connected World”. Highlights of the report: The total revenue for M2M Services is projected to double, from almost $15 billion in 2012 to over $30 billion in 2016 The primary driver for M2M solutions is now enabling new services Important trends that are developing are: Enterprise integration – more data and using the data more strategically, new markets in the Internet of Things (IoT), processing large amounts of data in real time (complex event processing) Using the same software development environment for all parts of an M2M solution is a major advantage if the software can be optimized for each part of the solution The free Beecham Research report can be accessed here. Cheers, – Terrence Filed under: Mobile & Embedded Tagged: iot, Java Embedded, M2M, research, webcast

    Read the article

  • 2 Birds, 1 Stone: Enabling M2M and Mobility in Healthcare

    - by Eric Jensen
    Jim Connors has created a video showcase of a comprehensive healthcare solution, connecting a mobile application directly to an embedded patient monitoring system. In the demo, Jim illustrates how you can easily build solutions on top of the Java embedded platform, using Oracle products like Berkeley DB and Database Mobile Server. Jim is running Apache Tomcat on an embedded device, using Berkeley DB as the data store. BDB is transparently linked to an Oracle Database backend using  Database Mobile Server. Information protection is important in healthcare, so it is worth pointing out that these products offer strong data encryption, for storage as well as transit. In his video, Jim does a great job of demystifying M2M. What's compelling about this demo is that uses a solution architecture that enterprise developers are already comfortable and familiar with: a Java apps server with a database backend. The additional pieces used to embed this solution are Oracle Berkeley DB and Database Mobile Server. It functions transparently, from the perspective of Java apps developers. This means that organizations who understand Java apps (basically everyone) can use this technology to develop embedded M2M products. The potential uses for this technology in healthcare alone are immense; any device that measures and records some aspect of the patient could be linked, securely and directly, to the medical records database. Breathing, circulation, other vitals, sensory perception, blood tests, x-rats or CAT scans. The list goes on and on. In this demo case, it's a testament to the power of the Java embedded platform that they are able to easily interface the device, called a Pulse Oximeter, with the web application. If Jim had stopped there, it would've been a cool demo. But he didn't; he actually saved the most awesome part for the end! At 9:52 Jim drops a bombshell: He's also created an Android app, something a doctor would use to view patient health data from his mobile device. The mobile app is seamlessly integrated into the rest of the system, using the device agent from Oracle's Database Mobile Server. In doing so, Jim has really showcased the full power of this solution: the ability to build M2M solutions that integrate seamlessly with mobile applications. In closing, I want to point out that this is not a hypothetical demo using beta or even v1.0 products. Everything in Jim's demo is available today. What's more, every product shown is mature, and already in production at many customer sites, albeit not in the innovative combination Jim has come up with. If your customers are in the market for these type of solutions (and they almost certainly are) I encourage you to download the components and try it out yourself! All the Oracle products showcased in this video are available for evaluation download via Oracle Technology Network.

    Read the article

  • Accessing updated M2M fields in overriden save() in django's admin

    - by Jonathan
    I'd like to use the user updated values of a ManyToManyField in a model's overriden save() method when I save an instance in admin. It turns out that by design, django does not update the M2M field before calling save(), but only after the save() is complete as part of the form save... How can I access the new values of this field in the override save() ?

    Read the article

  • post_save signal on m2m field

    - by Dmitry Shevchenko
    I have a pretty generic Article model, with m2m relation to Tag model. I want to keep count of each tag usage, i think the best way would be to denormalise count field on Tag model and update it each time Article being saved. How can i accomplish this, or maybe there's a better way?

    Read the article

  • Optimize Many-to-Many with SUMMARIZE and Other Techniques

    - by Marco Russo (SQLBI)
    We are still in the early days of DAX and even if I have been using it since 2 years ago, there is still a lot to learn on that. One of the topics that historically interests me (and many of the readers here, probably) is the many-to-many relationships between dimensions in a dimensional data model. When I and Alberto wrote the The Many to Many Revolution 2.0 we discovered the SUMMARIZE based pattern very late in the whitepaper writing. It is very important for performance optimization and it should be always used. In the last month, Gerhard Brueckl also presented an approach based on cross table filtering behavior that simplify the syntax involved, even if it’s harder to explain how it works internally. I published a short article titled Optimize Many-to-Many Calculation in DAX with SUMMARIZE and Cross Table Filtering on SQLBI website just to provide a quick reference to the three patterns available. A further study is still required to compare performance between SUMMARIZE and Cross Table Filtering patterns. Up to now, I haven’t observed big differences between them, even if their execution plans might be not identical and this suggest me that depending on other conditions you might favor one over the other.

    Read the article

  • Optimize Many-to-Many with SUMMARIZE and Other Techniques

    - by Marco Russo (SQLBI)
    We are still in the early days of DAX and even if I have been using it since 2 years ago, there is still a lot to learn on that. One of the topics that historically interests me (and many of the readers here, probably) is the many-to-many relationships between dimensions in a dimensional data model. When I and Alberto wrote the The Many to Many Revolution 2.0 we discovered the SUMMARIZE based pattern very late in the whitepaper writing. It is very important for performance optimization and it should be always used. In the last month, Gerhard Brueckl also presented an approach based on cross table filtering behavior that simplify the syntax involved, even if it’s harder to explain how it works internally. I published a short article titled Optimize Many-to-Many Calculation in DAX with SUMMARIZE and Cross Table Filtering on SQLBI website just to provide a quick reference to the three patterns available. A further study is still required to compare performance between SUMMARIZE and Cross Table Filtering patterns. Up to now, I haven’t observed big differences between them, even if their execution plans might be not identical and this suggest me that depending on other conditions you might favor one over the other.

    Read the article

  • The updated Survey pattern for Power Pivot and Tabular #powerpivot #tabular #ssas #dax

    - by Marco Russo (SQLBI)
    One of the first models I created for the many-to-many revolution white paper was the Survey one. At the time, it was in Analysis Services Multidimensional, and then we implemented it in Analysis Services Tabular and in Power Pivot, using the DAX language. I recently reviewed the data model and published it in the Survey article on DAX Patterns site. The Survey pattern is the foundation for others, such as the Basket Analysis, and it is widely used in many different business scenario. I was particularly happy to know it has been using to perform data analysis for cancer research! In this article I did some maintenance on the DAX formulas, checking that the proper error handling is part of the formulas, and highlighting some differences in slicers behavior between Excel 2010 and Excel 2013, which could be particularly important for the Survey scenario. As usual, we provide sample workbooks for both Excel 2010 and Excel 2013, and we use DAX Formatter to make the DAX code easier to read. Any feedback will be appreciated!

    Read the article

  • Edit the opposite side of a many to many relationship with django generic form

    - by Ed
    I have two models: class Actor(models.Model): name = models.CharField(max_length=30, unique = True) event = models.ManyToManyField(Event, blank=True, null=True) class Event(models.Model): name = models.CharField(max_length=30, unique = True) long_description = models.TextField(blank=True, null=True) In a previous question: http://stackoverflow.com/questions/2503243/django-form-linking-2-models-by-many-to-many-field, I created an EventForm with a save function: class EventForm(forms.ModelForm): class Meta: model = Event def save(self, commit=True): instance = forms.ModelForm.save(self) instance.actors_set.clear() for actor in self.cleaned_data['actors']: instance.actors_set.add(actors) return instance This allowed me to add m2m links from the other side of the defined m2m connection. Now I want to edit the entry. I've been using a generic function: def generic_edit(request, modelname, object_id): modelname = modelname.lower() form_class = form_dict[modelname] return update_object(request, form_class = form_class, object_id = object_id, template_name = 'createdit.html' ) but this pulls in all the info except the many-to-many selections saved to this object. I think I need to do something similar to this: http://stackoverflow.com/questions/1700202/editing-both-sides-of-m2m-in-admin-page, but I haven't figured it out. How do I use the generic update_object to edit the other side of many-to-many link?

    Read the article

  • Django Forms save_m2m

    - by John
    Hi I have a model which has 2 many to many fields in it. one is a standard m2m field which does not use any through tables whereas the other is a bit more complecated and has a through table. I am using the Django forms.modelform to display and save the forms. The code I have to save the form is if form.is_valid(): f = form.save(commit=False) f.modified_by = request.user f.save() form.save_m2m() When i try to save the form I get the following error: Cannot set values on a ManyToManyField which specifies an intermediary model. I know this is happening when I do the form.save_m2m() because of the through table. What I'd liek to do is tell Django to ignore the m2m field with the through table but still save the m2m field without the through table. I can then go on to manually save the data for the through table field. Thanks

    Read the article

  • Django left join m2m field.

    - by duder
    Here's my Model: class User(models.Model): pass class Item(models.Model): pass class ItemVote(models.Model): user = models.ForeignKey(User) item = models.ForeignKey(Item) vote = models.BooleanField() I want to retrieve a list of Items, and I want to know if the current user has voted for each Item. How do I alter my query object so that it will generate sql similar to: SELECT ... FROM items LEFT OUTER JOIN item_votes ON (item_votes.user_id = ? AND item_votes.item_id = items.id)

    Read the article

  • Django: remove all m2m relations

    - by pistacchio
    Hi, if I have two simple models: class Tag(models.Model): name = models.CharField(max_length=100) class Post(models.Model): title = models.CharField(max_length=100) tags = models.ManyToManyField(Tag, blank=True) given a Post object with a number of Tags added to it, I know hot to remove any of them, but how to do a mass remove (remove all)? Thanks

    Read the article

  • Django Show M2M field in both model forms

    - by John
    Hi I am using the forms.ModelForm to create my form. I want to be able to show the manytomany field in both model forms, how do I do this? If the manytomany relationship is defined in the model it is fine and just appears but if it is not in the model (but is still linked via the other model) it does not appear. Hope this makes sense. How can I make it show up? Thanks

    Read the article

  • Kohana 3, problem with m2m data adding

    - by Marek
    Hello I posted this on official forum but with no result. I am getting :Undefined index: enrollment error when trying to save data. My pivot model: class Model_Enrollment extends ORM { protected $_belongs_to = array('page' => array(), 'menugroup' => array()); } Model_Page protected $_has_many = array('templates' => array(), 'menugroups' => array('through' => 'enrollment')); Model_Menugroup protected $_has_many = array('menuitems' => array(), 'pages' => array('through' => 'enrollment')); //Overriden save() method in Model_Menugroup: public function save() { if (empty($this->created)) { $this->created = time(); } parent::save(); $this->reload(); if (! $this->is_global) { if (! empty($this->groupOwnerPagesId) { $page = ORM::factory('page'); foreach($this->groupOwnerPagesId as $id) { $this->add('enrollment', $page->find($id)); } } } } I did: I corrected table names in pivot model by changing them to singular I even now using the same name for pivot table / model = enrollment. The same as in tutorial. Just in case So the pivot table has name 'enrollment' and has 2 columns: page_id , menugroup_id I tried to add pk in pivot table, but it changed nothing I tried to add/remove db relation between pages/menugroups and pivot table (InnoDB) but with no luck I tried save all data in controller, but with the same bad result:( I am still getting the same error: Undefined index: enrollment in ORM line: $columns = array($this-_has_many[$alias]['foreign_key'], $this-_has_many[$alias]['far_key']); Could somebody tell me, what can be else wrong? I have no other ideas:( Kind regards

    Read the article

  • django updating m2m field

    - by Marconi
    I have a model service and a ModelForm named Service which I use to add and update the service model. The model looks like this: class Service(models.Model): categories = models.ManyToManyField(Category) The categories field is displayed as a tag with that allows multiple selection. It works well when I'm adding a new record but when I'm updating it, only one service is showing up on the request.POST['categories'] even if I selected multiple categories. I tried dumping the request object and I can see that the categories is showing something like: u'categories': [u'3', u'4', u'2'] I tried calling the request._get_post() and it did return only 1 category, hence the request.POST['categories'] returns only 1. Anybody who knows what's happening and how to fix it?

    Read the article

1 2 3 4  | Next Page >