Re: Migrating ManyToManyField to bigint?

2022-05-17 Thread Jeremy Lainé
I really needed an in-place migration as reloading tens of millions of entries was not practical. I ended up using the migrations I mentioned with one migration per M2M intermediate table to avoid locking multiple tables at once. Cheers, Jeremy On Monday, May 16, 2022 at 7:07:19 PM UTC+2 makza.

Re: Migrating ManyToManyField to bigint?

2022-05-16 Thread Makrand Zare
First you need to create table structure in the PostgreSQL, then after import the data into the respective tables. Makrand Zare +919930102832 makzare1...@gmail.com On Sun, May 15, 2022, 1:55 PM Mike Dewhirst wrote: > On 14/05/2022 11:44 pm, Jeremy Lainé wrote: > > Hi! > > I'm currently looking

Re: Migrating ManyToManyField to bigint?

2022-05-16 Thread Mike Dewhirst
users Subject: Re: Migrating ManyToManyField to bigint? Hi Mike,Thanks for the reply. For future reference, it was pointed out to me that I missed both an explicit note in the documentation [1] and an issue tracking a potential change in the future [2].Do you have any suggestions as to the

Re: Migrating ManyToManyField to bigint?

2022-05-16 Thread Jeremy Lainé
Answering myself, AFAICT I need to create migrations which look like the following for every m2m intermediate table. The following assumes a "Book" model which has a ManyToMany relationship to a "Tag" model: from django.db import migrations class Migration(migrations.Migration): dependenc

Re: Migrating ManyToManyField to bigint?

2022-05-15 Thread Jeremy Lainé
Hi Mike, Thanks for the reply. For future reference, it was pointed out to me that I missed both an explicit note in the documentation [1] and an issue tracking a potential change in the future [2]. Do you have any suggestions as to the actual SQL migration which needs to be applied for postgr

Re: Migrating ManyToManyField to bigint?

2022-05-15 Thread Mike Dewhirst
On 14/05/2022 11:44 pm, Jeremy Lainé wrote: Hi! I'm currently looking at how to migrate all my models from AutoField to BigAutoField. For all the explicitly defined models the process seems pretty straightforward: * change DEFAULT_AUTO_FIELD to BigAutoField * generate migrations * appl

Migrating ManyToManyField to bigint?

2022-05-14 Thread Jeremy Lainé
Hi! I'm currently looking at how to migrate all my models from AutoField to BigAutoField. For all the explicitly defined models the process seems pretty straightforward: - change DEFAULT_AUTO_FIELD to BigAutoField - generate migrations - apply migrations However, when I inspect the da

Re: View that displays my ManyToManyField('self'...) relations in a with levels

2021-08-19 Thread Marko
Yes, my example is not right. Both should be the same! nader...@gmail.com schrieb am Donnerstag, 19. August 2021 um 16:59:01 UTC+2: > I noticed that subassembly 6 has different components in use. Is that what > you want. > > On Wed, Aug 18, 2021, 10:57 AM M. GW wrote: > >> Hi, >> >> I am now tr

Re: View that displays my ManyToManyField('self'...) relations in a with levels

2021-08-19 Thread Marko
Hey, thank you. I tried your approach and is looks very promising but I am getting an error. Here is my view: *class AssemblyDetailView(LoginRequiredMixin, DetailView):* *model = Assembly* *template_name = "engineering/assembly/assembly_detail.html"* *assem = Assembly.objects.all()*

Re: View that displays my ManyToManyField('self'...) relations in a with levels

2021-08-19 Thread Nader Elsisi
I noticed that subassembly 6 has different components in use. Is that what you want. On Wed, Aug 18, 2021, 10:57 AM M. GW wrote: > Hi, > > I am now trying, for days, to get a tree like view from my assembly model > into my template. I think I have read everything what I have found on > StackOver

Re: View that displays my ManyToManyField('self'...) relations in a with levels

2021-08-19 Thread David Crandell
I would create two dictionaries, one for subassembly and one for component. then in your view, loop through the first group, pulling your data from a master dataset: assem = Assembly.objects.all() sa = assem.subassembly.all() comp = assem.component.all() send 'sa' and 'comp' to your template as

View that displays my ManyToManyField('self'...) relations in a with levels

2021-08-18 Thread M. GW
Hi, I am now trying, for days, to get a tree like view from my assembly model into my template. I think I have read everything what I have found on StackOverflow and other sites. Somehow I am not able to get it working. I am trying to not use any 3rd party extensions => I'm happy to be proven

manytomanyfield

2020-07-15 Thread Chander shekhar
i have a model share=model.manytomanyfield(User) In this share section i don't want the current login user should not come in this manytomanyfield list -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

Re: Symmetrical, Self-referencing ManyToManyField with Through Table

2020-06-25 Thread Jim Shepherd
Nice solution. Thanks! On Thursday, June 25, 2020 at 5:49:23 PM UTC-4, Dan Madere wrote: > > I don't know of a way to configure the admin do that, but one solution > would be to use signals to notice when one-way records are created, then > automatically create the record for reverse relationshi

Re: Symmetrical, Self-referencing ManyToManyField with Through Table

2020-06-25 Thread Dan Madere
is going on. > > Basically, for symmetric ManyToManyField, Django creates entries for both > directions automatically if the correct interface is used. From the test > models: > > class PersonSelfRefM2M(models.Model): > name = models.CharField(max_length=5) > sym_

Re: Symmetrical, Self-referencing ManyToManyField with Through Table

2020-06-25 Thread Jim Shepherd
After reviewing the tests, I think I now understand what is going on. Basically, for symmetric ManyToManyField, Django creates entries for both directions automatically if the correct interface is used. From the test models: class PersonSelfRefM2M(models.Model): name = models.CharField

Re: Symmetrical, Self-referencing ManyToManyField with Through Table

2020-06-25 Thread Jim Shepherd
capability in https://github.com/django/django/tree/master/tests/m2m_through which seems to indicate that it does work. I updated my version of Django to 3.1.b1 and copied the models and tests into my code. Neither the admin nor queries on the ManyToManyField return the full "symmetric

Re: Symmetrical, Self-referencing ManyToManyField with Through Table

2020-06-25 Thread Dan Madere
I tried out the example code, and can replicate this. What's interesting is that if I try removing the ContactConnection model, and the "through" attribute, this allows Django to create the intermediate table on its own, and then your get_connections() method works as expected! It seems like us

Re: Symmetrical, Self-referencing ManyToManyField with Through Table

2020-06-25 Thread Jim Shepherd
Mike, Thanks for your suggestions. Just a stab in the dark - have you tried giving from_contact a > related_name? > Yes, I have tried a few different combinations of providing a single related_name and various naming conventions when providing related_name on both ForeignKey fields without s

Re: Symmetrical, Self-referencing ManyToManyField with Through Table

2020-06-24 Thread Mike Dewhirst
On 25/06/2020 8:29 am, Jim Shepherd wrote: I am unable to get a symmetrical, self-referencing ManyToManyField with a through table to actually be symmetrical, at least through the Admin interface. I am using Django 3.0 so it looks like the capability is supported. Models: class Contact

Symmetrical, Self-referencing ManyToManyField with Through Table

2020-06-24 Thread Jim Shepherd
I am unable to get a symmetrical, self-referencing ManyToManyField with a through table to actually be symmetrical, at least through the Admin interface. I am using Django 3.0 so it looks like the capability is supported. Models: class Contact(models.Model): last_name = models.TextField

Django: ManyToManyField appears as empty on my template

2020-02-19 Thread Sergio Madueño
I'm having an issue displaying a ManyToManyField in a character profile template using Django. The template has to show an avatar, alongside some information about the character, including a list of guilds this character had joined. But, when I try to display that list, it appears as if

Re: Django Rest - ManyToManyField with SlugRelatedField Data Is Not Being Created

2020-01-22 Thread Motaz Hejaze
n this link > <https://stackoverflow.com/questions/59795851/django-rest-manytomanyfield-with-slugrelatedfield-data-is-not-being-created> > (Stack > Overflow). > > In resume, I can't create a new object on database using SlugRelatedField > by the method create() and I receive

Django Rest - ManyToManyField with SlugRelatedField Data Is Not Being Created

2020-01-22 Thread Érika Barros
Hello friends! I have a detailed question on this link <https://stackoverflow.com/questions/59795851/django-rest-manytomanyfield-with-slugrelatedfield-data-is-not-being-created> (Stack Overflow). In resume, I can't create a new object on database using SlugRelatedField by the me

Django Admin - Filter ManyToManyField with through model

2019-07-26 Thread drec4s
How can I filter a queryset inside the Admin page of an object that has a ManyToManyField relation with a manually defined through model? Given models.py class Foo(models.Model): foo_field1 = models.CharField(max_length=50) class Main(models.Model): main_field1 = models.CharField

Re: Display ManyToManyField value or a select_related query in an html object list

2019-06-24 Thread Ricardo Daniel Quiroga
Hi, model.many_to_many_atribute.all() model.many_to_many_atribute.find(name="carl") El lun., 24 jun. 2019 a las 19:18, Charlotte Wood (< charlotte.w...@epiccharterschools.org>) escribió: > HELP! > > Do ManyToManyFields just not print? > > I see them in my form selection. > > Everything works fi

Display ManyToManyField value or a select_related query in an html object list

2019-06-24 Thread Charlotte Wood
HELP! Do ManyToManyFields just not print? I see them in my form selection. Everything works fine, but when I try to put the linked item on a list form, i get: project.model.none for the value. I cannot figure out how to make all the values print. HELP! PLEASE!! -- You received this messa

Re: ManyToManyField how to get the fields in a ListView?

2019-04-19 Thread bob
I feel something like this is what I need select obj,name,png from items_monolithic, items_facepng where object==obj; But I do not know how to do that in Django. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group

ManyToManyField how to get the fields in a ListView?

2019-04-19 Thread bob
I do not understand how to get my queryset from the ManyToManyField in my ListView *Models* class Monolithic(models.Model): obj = models.CharField( max_length=128, blank=False, null=False, unique= True) face2 = models.ManyToManyField(FacePng) class FacePng(models.Model): obj

Re: ManyToManyField explanation

2019-04-08 Thread Vinicius Assef
I think these ones really good: https://docs.djangoproject.com/en/2.2/topics/db/examples/many_to_many/ On Mon, 8 Apr 2019 at 14:08, Khushal Kumar wrote: > > > Hi, > > > > Can anyone please give me an example which will demonstrate how > manytomanyfield works in Django.

ManyToManyField explanation

2019-04-08 Thread Khushal Kumar
Hi, Can anyone please give me an example which will demonstrate how manytomanyfield works in Django. Thanks Sent from Mail for Windows 10 -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

Re: How is MySQL syntax for a table changed if I had a ManyToManyField?

2018-07-14 Thread Gerald Brown
ably couldn't so I created my tables in MySQL. Now I'm trying to add a ManyToManyField between 2 models but am not sure how the MySQL syntax is supposed to look like. This is my current code: from django.db import models class Publication(models.Model): title = mo

Re: How is MySQL syntax for a table changed if I had a ManyToManyField?

2018-07-14 Thread mottaz hejaze
work but > miserably couldn't so I created my tables in MySQL. Now I'm trying to add a > ManyToManyField between 2 models but am not sure how the MySQL syntax is > supposed to look like. > > This is my current code: > > from django.db import models > >

How is MySQL syntax for a table changed if I had a ManyToManyField?

2018-07-13 Thread lissandrathegray
I tried for hours to get django's migrate/makemigrations function work but miserably couldn't so I created my tables in MySQL. Now I'm trying to add a ManyToManyField between 2 models but am not sure how the MySQL syntax is supposed to look like. This is my current code: from d

Re: Display the __str__ or __unicode__ of an objet on deletion of one of its ManyToManyField

2018-05-10 Thread eduardo
2 10:03 GMT-03:00 Jean-Baptiste Pressac > >: >> >>> Hello, >>> On Django 1.8 + Python 2.7.11, I have declared in Django admin.py an >>> oeuvre class with a ManyToManyField (types) to an TypeOeuvre class. >>> >>> >>> clas

Re: Display the __str__ or __unicode__ of an objet on deletion of one of its ManyToManyField

2016-12-02 Thread Jean-Baptiste Pressac
gt; Hello, >> On Django 1.8 + Python 2.7.11, I have declared in Django admin.py an >> oeuvre class with a ManyToManyField (types) to an TypeOeuvre class. >> >> >> class Oeuvre(models.Model): >> titre = models.CharField(max_length=510) >> types =

Re: Display the __str__ or __unicode__ of an objet on deletion of one of its ManyToManyField

2016-12-02 Thread Carlos Andre
n.py an > oeuvre class with a ManyToManyField (types) to an TypeOeuvre class. > > > class Oeuvre(models.Model): > titre = models.CharField(max_length=510) > types = models.ManyToManyField('TypeOeuvre', >blank=True, >

Display the __str__ or __unicode__ of an objet on deletion of one of its ManyToManyField

2016-12-02 Thread Jean-Baptiste Pressac
Hello, On Django 1.8 + Python 2.7.11, I have declared in Django admin.py an oeuvre class with a ManyToManyField (types) to an TypeOeuvre class. class Oeuvre(models.Model): titre = models.CharField(max_length=510) types = models.ManyToManyField('TypeO

Re: Bug ? | Django 1.9.11 | ManyToManyField with help_text

2016-11-11 Thread Artem Bernatskyy
Thanks On Friday, November 11, 2016 at 4:05:32 PM UTC+2, Artem Bernatskyy wrote: > > If i add ManyToManyField through intermediary table with "help text" and > run makemigrations > there will be created 'dummy migration' which doesn't have any sense > and

Re: Bug ? | Django 1.9.11 | ManyToManyField with help_text

2016-11-11 Thread Tim Graham
There's a known bug that help_text=_("") triggers infinite migrations, perhaps you could add your use case to the ticket. https://code.djangoproject.com/ticket/24964 On Friday, November 11, 2016 at 9:05:32 AM UTC-5, Artem Bernatskyy wrote: > > If i add ManyToManyField throu

Bug ? | Django 1.9.11 | ManyToManyField with help_text

2016-11-11 Thread Artem Bernatskyy
If i add ManyToManyField through intermediary table with "help text" and run makemigrations there will be created 'dummy migration' which doesn't have any sense and when i call lt repeatingly for example './manage,py makemigrations && ./manage,p

Re: Repetitve/Infinite migrations generated on ManyToManyField

2016-10-27 Thread Olivier Dalang
Hi, I noticed this behavior when changing the case of a app/model/field name. See if the name has the same case in the initial creation migration and in the model. Cheers, Olivier On 27 Sep 2016 03:39, "Marvin Mednick" wrote: > I've the the following models related to a many-to-many relations

Re: Repetitve/Infinite migrations generated on ManyToManyField

2016-09-26 Thread Mike Dewhirst
On 27/09/2016 6:58 AM, Marvin Mednick wrote: I've the the following models related to a many-to-many relationship.  (Django 1.9.4 and sqlite) Each time I run makemigrations, it generates an AlterField migration, which migrate successfully executes (no errors), but running makemigrations

Repetitve/Infinite migrations generated on ManyToManyField

2016-09-26 Thread Marvin Mednick
I've the the following models related to a many-to-many relationship. (Django 1.9.4 and sqlite) Each time I run makemigrations, it generates an AlterField migration, which migrate successfully executes (no errors), but running makemigrations again will generate the identical migration. Ever

Re: ManyToManyField('self') not using related_name

2016-07-19 Thread Farhan Khan
The solution was that I needed to set symmetrical=False, per the documentation here: https://docs.djangoproject.com/en/1.9/ref/models/fields/#django.db.models.ManyToManyField.symmetrical On Tuesday, July 19, 2016 at 2:52:16 PM UTC-4, Farhan Khan wrote: > > I am using a ManyToManyField

ManyToManyField('self') not using related_name

2016-07-19 Thread Farhan Khan
I am using a ManyToManyField whose target is a 'self' reference, but it does not create a related_name "reverse" field. Here is my model: class SecurityGroup(models.Model): name = models.CharField(max_length=100) description = models.TextField() subgroups = mo

How do I order a model, based on multiple values of a ManyToManyField?

2016-06-07 Thread Sem Verbraak
Basically, I need to order, based on multiple values from a ManyToManyField. So what I want to achieve is having the objects with the most questioned values on top, continuing with objects that have less of the questioned values. Continuing with objects that don't have any of these v

Re: How to implement a ManyToManyField with a View

2016-05-28 Thread Akhil Lawrence
Hi Bruce, You need to call `contact.relationship.all` instead of `contact.relationship_set.all` We use `_set.all` when we want to retrieve the related items from the master/parent object (Relationship in your case). So if you want to retrieve all contacts under a relationship you can use `.re

Re: How to implement a ManyToManyField with a View

2016-05-28 Thread Daniel Roseman
On Thursday, 26 May 2016 18:43:00 UTC+1, Bruce Whealton wrote: > > Hello all, > I started a similar thread but couldn't find it. > I was creating a Personal Information Management Project, with Project > name mypim. My first app was a contacts app. > This has two Class based Models in the mo

Re: How to implement a ManyToManyField with a View

2016-05-27 Thread Bruce Whealton
I have that in the contacts/views.py However, I don't know if it needs the context dictionary to have something which would connect a contact to many categories. Thanks, Bruce -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from

Re: How to implement a ManyToManyField with a View

2016-05-26 Thread Simon Charette
Hi Bruce, I think you want to call get_object_or_404 with the Contact model in your contact_detail() view. Cheers, Simon Le jeudi 26 mai 2016 13:43:00 UTC-4, Bruce Whealton a écrit : > > Hello all, > I started a similar thread but couldn't find it. > I was creating a Personal Information Ma

How to implement a ManyToManyField with a View

2016-05-26 Thread Bruce Whealton
Hello all, I started a similar thread but couldn't find it. I was creating a Personal Information Management Project, with Project name mypim. My first app was a contacts app. This has two Class based Models in the models.py in the contacts directory. My first view works fine, where I disp

Re: Need example of how to use a select2 widget for a manytomanyfield in django.

2015-11-10 Thread Mark London
I just discovered django-select2-forms. It does exactly what I want, very simple to implement. On Tuesday, November 10, 2015 at 5:08:46 PM UTC-5, Mark London wrote: > > I want to use a select2 widget to a manytomanyfield in django. There are > several django-select2 modules

Need example of how to use a select2 widget for a manytomanyfield in django.

2015-11-10 Thread Mark London
I want to use a select2 widget to a manytomanyfield in django. There are several django-select2 modules, but the documentation on all of them is confusing. Can someone point me to a simple example of how to use a select2 widget for a manytomanyfield? Thanks. - Mark -- You received this

Define an order for ManyToManyField by through model field

2015-11-02 Thread Dmitry Voronin
Question on Stackoverflow: http://stackoverflow.com/questions/33486705/define-an-order-for-manytomanyfield-by-through-model-field-with-django class ProductRelation(models.Model): product_a = models.ForeignKey('Product', related_name='c+')

Re: preserve data when migrating ForeignKey to ManyToManyField

2015-07-15 Thread Erik Cederstrand
> Den 14/07/2015 kl. 23.32 skrev A Lee : > > I'd like to change a ForeignKey field into a ManyToManyField, preserving > existing data by creating entries in the many-to-many through table. Running > makemigrations after changing the model class creates a migratio

preserve data when migrating ForeignKey to ManyToManyField

2015-07-14 Thread A Lee
I'd like to change a ForeignKey field into a ManyToManyField, preserving existing data by creating entries in the many-to-many through table. Running makemigrations after changing the model class creates a migration that executes a RemoveField on the existing ForeignKey field and th

ManyToManyField using specific database

2015-06-23 Thread João Dias de Carvalho Neto
Hi all, I have an application with Django with database routers. Basically I got the request path, split it to get subdomain name and set the database by this way. I do not use default database, so I do not migrate it. This route action It's working very well but I am still facing trouble when

Re: Django handle new ManyToManyField items with get_or_create()

2015-04-15 Thread Pavel Kuchin
) model_instance.tags.add(t) return HttpResponseRedirect("/") Best regards, Pavel Help me, django-users, you're my only hope :D > > Hi all, my name is Filippo, I'm from Italy and I'm totally stuck on this > problem... > > I have a model with a ManyToManyF

Django handle new ManyToManyField items with get_or_create()

2015-04-14 Thread Doc
Help me, django-users, you're my only hope :D Hi all, my name is Filippo, I'm from Italy and I'm totally stuck on this problem... I have a model with a ManyToManyField and in my view I want to be able to add new options to the generated selectbox. How can I handle those

Re: Django ProgrammingError: no relation exists when using ManyToManyfield

2015-04-13 Thread Pavel Kuchin
red it might be useful to see some of the >>> comments users on that site have suggested. If this is not acceptable let me >>> know and i'll post everything here. >>> Thanks! >>> >>> >>> http://stackoverflow.com/questions/29190190/django-programmin

Re: Django ProgrammingError: no relation exists when using ManyToManyfield

2015-04-13 Thread Chase Cooley
stackoverflow.com and so I figured it might be useful to see some of the >> comments users on that site have suggested. If this is not acceptable let >> me know and i'll post everything here. >> Thanks! >> >> >> http://stackoverflow.com/questions/291

Re: Django ProgrammingError: no relation exists when using ManyToManyfield

2015-04-12 Thread Pavel Kuchin
relation-exists-when-using-manytomanyfield?noredirect=1#comment46603898_29190190 > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@

Django ProgrammingError: no relation exists when using ManyToManyfield

2015-04-11 Thread Chase Cooley
tions/29190190/django-programmingerror-no-relation-exists-when-using-manytomanyfield?noredirect=1#comment46603898_29190190 -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, se

Re: Django ManyToManyField Not Displaying in Template

2014-12-19 Thread Collin Anderson
through each PartModel and then iterate > through the PartModels associated (through a self-referential > ManyToManyField) with the PartModel in question. I am doing everything I'm > supposed to be doing according to my reading of the "entry_set syntax" > section of t

Django ManyToManyField Not Displaying in Template

2014-12-17 Thread Rodney Lewis
Hey All: I need my template to iterate through each PartModel and then iterate through the PartModels associated (through a self-referential ManyToManyField) with the PartModel in question. I am doing everything I'm supposed to be doing according to my reading of the "entry_

Re: ManyToManyField with rating using 'through' on each ManyToMany relation in Django

2014-12-06 Thread Collin Anderson
t;> RATING = [(y, y) for y in range(1, 7)] >>> >>> interest = models.CharField(max_length=40) >>> interest_rating = models.SmallIntegerField(choices=WEIGHT) >>> >>> >>> class CustomUserprofileInterests(models.Model): >>> >&g

Re: ManyToManyField with rating using 'through' on each ManyToMany relation in Django

2014-12-05 Thread inoyon artlover KLANGRAUSCH
Interests, through='CustomInterests', >> through_fields=('custominterest', 'interest'), >> null=True, blank=True) >> >> >> class CustomInterests(models.Model): >> >> WEIGHT = [(y, y) for y in r

Re: ManyToManyField with rating using 'through' on each ManyToMany relation in Django

2014-12-05 Thread Collin Anderson
t = models.ForeignKey(Interests) > custominterest = models.ForeignKey(CustomUserprofileInterests) > rating = models.SmallIntegerField(choices=WEIGHT) > > > I want to accomplish a rating on each relation in the 'interests = > ManyToManyField' in my Custom

ManyToManyField with rating using 'through' on each ManyToMany relation in Django

2014-12-04 Thread inoyon artlover KLANGRAUSCH
ield(choices=WEIGHT) I want to accomplish a rating on each relation in the 'interests = ManyToManyField' in my CustomUserprofile. The Interests-Model HAS to have an OWN, self relating rating in each 'interest' entry, NOT related to the CustomUserprofile. Startet lot of inve

Re: How to filter results that are not part of a ManyToManyField?

2014-10-03 Thread Collin Anderson
This may look totally crazy, but does this do what you want? People.objects.filter(people=None) It may make more sense to do this: class Person(models.Model): children = models.ManyToManyField('self', blank=True, related_name= 'parents') Person.objects.filter(parents=None) -- You received t

How to filter results that are not part of a ManyToManyField?

2014-10-03 Thread Neto
Hello, I have it model: class People(models.Model): > children = models.ManyToManyField('self', blank=True, null=True) I want to filter the first of each family tree. *Knowing that children can have children How I do it? People.objects.filter() -- You received this message because

Django custom RelatedManager with ManyToManyField for multi-record inheritance

2014-09-03 Thread Dr. Sultan Alotaibi
I have the following object structure: class Car(models.Model): name = models.CharField(max_length=16) class Person(models.Model): name = models.CharField(max_length=32) cars = models.ManyToManyField(Car, through='Relationship') parent = models.ForeignKey('self', null=True, blank=

Re: ManyToManyField causes invalid form when limit_choices_to argument set

2014-04-30 Thread rgreene
Solved! It turned out the problem only occurred trying to uncheck the last checkbox. I needed to set blank=True on the ManyToManyField. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiv

ManyToManyField causes invalid form when limit_choices_to argument set

2014-04-30 Thread rgreene
Good day, This is a somewhat contrived example, but I'm having the same problem in a real project. Assuming continents have many countries, and countries can belong to many continents, I have a continent_country "junction" table in the database and am using ManyToManyF

Re: ManyToManyField and Multi Table Inheritance

2014-04-01 Thread Camilo Torres
I tested this with SQLite3 and it worked, using your models: >>> a.users = User.objects.all() >>> a.save() >>> a.delete() >>> a = AccountTypeA(name='') >>> a.save() >>> a.users = User.objects.all() After that: sqlite> select * from testapp_accounttype_users; 1|1|1 Which is what I should expe

ManyToManyField and Multi Table Inheritance

2014-04-01 Thread Izidor Matušov
Hi, I've run into interesting issue and I'm not sure if I do something wrong or this is Django issue. I'm using Multi Table Inheritance: from django.db import models from django import forms class AccountType(models.Model): users = models.ManyToManyField('auth.User', related_name='accounts

ManytoManyField refuses to show up when I syncdb

2014-03-29 Thread willy Hakizimana
when I syncdb and use south schemamigration, I still can't get the ManyToManyField to show up. what am I doing wrong. Any parameters I can pass to make it work? Thank you guys class Products(models.Model): #product_id = models.AutoField(primary_key=True) hs_number = models.Char

Re: ManytoManyField (through) not showing up !

2014-03-28 Thread C. Kirby
Did you add this field after you had already run syncdb? If so, you won't see it running syncdb again, that command only adds new models, it does not pick up modifications to models. You have a couple of options. 1) If you are in development, you can just drop your existing database and use sy

ManytoManyField (through) not showing up !

2014-03-28 Thread willy Hakizimana
I am trying to do a ManytoManyField through a middle Table. After I run syncdb, I do not see the column in pdadmin. What am I doing wrong? Here is my code class Countries(models.Model): country_name = models.CharField(max_length=200) country_id = models.CharField(primary_key=True

Re: Controlling admin ManyToManyField widget with keyboard

2014-02-27 Thread Ram Rachum
t;>> On Wednesday, February 26, 2014 11:28:05 AM UTC-6, cool-RR wrote: >>>>> >>>>>> Sorry, space doesn't do the toggle. (Windows 7 Chrome.) >>>>>> >>>>>> >>>>>> On Wed, Feb 26, 2014 at 6:43 PM, C. Kirby wrote: >

Re: Controlling admin ManyToManyField widget with keyboard

2014-02-26 Thread C. Kirby
2014 11:28:05 AM UTC-6, cool-RR wrote: >>>> >>>>> Sorry, space doesn't do the toggle. (Windows 7 Chrome.) >>>>> >>>>> >>>>> On Wed, Feb 26, 2014 at 6:43 PM, C. Kirby wrote: >>>>> >>>>>

Re: Controlling admin ManyToManyField widget with keyboard

2014-02-26 Thread Ram Rachum
Sorry, space doesn't do the toggle. (Windows 7 Chrome.) >>>> >>>> >>>> On Wed, Feb 26, 2014 at 6:43 PM, C. Kirby wrote: >>>> >>>>> While holding Ctrl (Command on a Mac), click the spacebar on the >>>>> relations you w

Re: Controlling admin ManyToManyField widget with keyboard

2014-02-26 Thread C. Kirby
ommand) keeps you in >>>> multi-select mode >>>> >>>> On Wednesday, February 26, 2014 6:12:09 AM UTC-6, cool-RR wrote: >>>>> >>>>> Hi, >>>>> >>>>> How do I control the admin ManyToManyField widget with th

Re: Controlling admin ManyToManyField widget with keyboard

2014-02-26 Thread Ram Rachum
ode >>> >>> On Wednesday, February 26, 2014 6:12:09 AM UTC-6, cool-RR wrote: >>>> >>>> Hi, >>>> >>>> How do I control the admin ManyToManyField widget with the keyboard? >>>> >>>> >>>> Thanks,

Re: Controlling admin ManyToManyField widget with keyboard

2014-02-26 Thread C. Kirby
multi-select mode >> >> On Wednesday, February 26, 2014 6:12:09 AM UTC-6, cool-RR wrote: >>> >>> Hi, >>> >>> How do I control the admin ManyToManyField widget with the keyboard? >>> >>> >>> Thanks, >>> Ram. >>&

Re: Controlling admin ManyToManyField widget with keyboard

2014-02-26 Thread Ram Rachum
multi-select mode > > On Wednesday, February 26, 2014 6:12:09 AM UTC-6, cool-RR wrote: >> >> Hi, >> >> How do I control the admin ManyToManyField widget with the keyboard? >> >> >> Thanks, >> Ram. >> > -- > You received this message beca

Re: Controlling admin ManyToManyField widget with keyboard

2014-02-26 Thread C. Kirby
ol the admin ManyToManyField widget with the keyboard? > > > Thanks, > Ram. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr

Controlling admin ManyToManyField widget with keyboard

2014-02-26 Thread cool-RR
Hi, How do I control the admin ManyToManyField widget with the keyboard? Thanks, Ram. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-user

Other side of a ManyToManyField through self field

2013-11-26 Thread Jean-Baptiste Pressac
Hello, I have a Person model with a ManyToManyField with itself through a Relation model to declare relations like Paul is Julie's uncle : class Relations(models.Model): id_person= models.ForeignKey('Person', related_name='relation_id_person') id_relation =

Create and save records through ManyToManyField selection.

2013-09-08 Thread Germán
You need to register the admin classes defined in admin.py. If you don't know how, go over the official tutorial in Django's online docs. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails f

Create and save records through ManyToManyField selection.

2013-09-07 Thread Trung Nguyen
I am new comer I struggle to save a record using admin page . What extra ethod should I add to save ContestScore record. Thanks. class School(models.Model): school_name = models.CharField(max_length=30) school_city = models.CharField(max_length=30) coach_name = models.CharField(max_le

Re: ManyToManyField select only results that match

2013-08-21 Thread Tom Lockhart
models, but I am still uncertain. So you have a set of possible field values, and want to be able to group those into different sets for a form, right? class FieldValues(models.Model): name = CharField() pass class FieldGroups(models.Model): group_name = CharField() values = ManyT

Re: ManyToManyField select only results that match

2013-08-21 Thread Gerd Koetje
He Thomas, ur right i didnt explain myself very well. What im trying todo is this. I have a mode that holds all my form field values in difrant group , name: Keuzes Now i want to populate multiple form fields with these values based on wich groep i want them to be. I onloy seem to get this t

Re: ManyToManyField select only results that match

2013-08-21 Thread Tom Lockhart
my guessing ;) Assuming that those ManyToManyField lines are in a model, here is the problem. The related_name argument helps you to access the values in that model from Keuzes, using syntax like "keuzes_kleurogen__mykleurogenfield". But the model definitions will result in only one inter

Re: ManyToManyField select only results that match

2013-08-21 Thread Gerd Koetje
anyone willing to help out? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to djang

Re: ManyToManyField select only results that match

2013-08-20 Thread Gerd Koetje
mm that seems to not work when i do it on multiple field kleurogen = models.ManyToManyField(Keuzes, blank=True, null=True) kleurhaar = models.ManyToManyField(Keuzes, blank=True, null=True) django.core.management.base.CommandError: One or more models did not validate: profielen.profielen: Acces

Re: ManyToManyField select only results that match

2013-08-20 Thread Gerd Koetje
i think i got it, i was foing it at the wrong spot. i added this to my forms.py kleurogen = forms.ModelMultipleChoiceField(queryset=Keuzes.objects.filter(groep_id= 'kleurogen')) works like a charm -- You received this message because you are subscribed to the Google Groups "Django users" gr

ManyToManyField select only results that match

2013-08-20 Thread Gerd Koetje
oesnt work kleurogen = models.ManyToManyField(Keuzes.objects.filter(groep_id= "kleurogen"), blank=True, null=True) AssertionError: ManyToManyField([, ]) is invalid. First parameter to ManyToManyField must be either a model, a model name, or the string 'self' How can i do t

Re: Error with Passing a class name as a parameter in a ManyToManyField

2013-07-14 Thread Mike Dewhirst
On 15/07/2013 1:02am, Charounson Saintilus wrote: This is my first time using the Django Web Framework and I'm new to the python language, so please bear with me. I've created a model (i.e. a class) called Course which defines several variables: class Course(models.Model): name = models

  1   2   3   4   5   6   7   >