The model's code is below.
First thing I need is to retrieve all the places that are labelled
e.g. "tea".
So I just create a view a type:
places = Place.objects.all()
places = Place.objects.filter(primary_tags__name__contains="tea")
But then additionally I need all the places that are open now,
Hello!
I'm trying to figure out if it is possible to disable the creation of
a reverse relation field when defining relations between models.
Something like this example:
class Route(models.Model):
start = models.ForeignKey (Location,
related_name='starting_points
Hello!
I have model A in which there is field ForeignKey(B). I also have
model C which inherits from model A. None of these models is abstract.
Having B object, can I find all C objects pointing to it? When I use
something like this: Bobject.C_set.all() there appears an error:
'AttributeError: B o
I'm finding that I have quite a few many-to-one relations that don't
really need the reverse relation to be expressed in the object model.
For example,
class Route(models.Model):
start = models.ForeignKey (Location)
destination = models.ForeignKey (Location)
The default re
I have a model with a recursive foreign key to 'self'. This is intended to
model a parent child
relation among instances. The forward relation, on a field called
'childof', works as expected.
The reverse relation, using the related_name 'parent', comes up as a
Rel
Try:
myB = B.objects.get(pk=1)
myCs = C.objects.filter(a__b=myB)
Regards
Scott
> I have model A in which there is field ForeignKey(B). I also have
> model C which inherits from model A. None of these models is abstract.
> Having B object, can I find all C objects pointing to it? When I use
> som
I haven't think about it this way. It works (using "a_ptr__b").
Thank you for help Scott!
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send em
>
> Is there a way to express that I don't need the reverse relation?
No. Even if you don't need them, Django will want to dynamically endow
your Location objects with them. And, as you know, it can't do it if
two reverse relatio
27;childof', works as expected.
> The reverse relation, using the related_name 'parent', comes up as a
> RelatedManager,
> again as expected. However, parent.count(), parent.all(), etc., always
> give me the "Manager is
> not accessible on instances" error. Ma
n
>> the model, would that work?
>> Presumably the related name on the childof field would still fail like it
>> does now,
>> but I would instead have the explicit parent field to work with. I still
>> would not have the
>> automatic reverse relation
ldof', works as expected.
The reverse relation, using the related_name 'parent', comes up as a
RelatedManager,
again as expected. However, parent.count(), parent.all(), etc., always
give me the "Manager is
not accessible on instances" error. Many of these parent instances
n 27 Jul 2022 12:18, "Malik Rumi" wrote:
>>
>>> I have a model with a recursive foreign key to 'self'. This is intended
>>> to model a parent child
>>> relation among instances. The forward relation, on a field called
>>> 'childo
we also tried without _set etc.
--
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 d
I don't think this has anything to do with multi-db. I'm not sure what that
query is trying to accomplish. Can you simply use:
ProfielenUserprofile.objects.values('profielnaam')
You can't use values() across a reverse ForeignKey ("foo_set") as this
might return multiple values.
On Saturday,
>
> nieuweklanten = ProfielenUserprofile.objects.all()[:1]
>> for nieuwe in nieuweklanten:
>> print(nieuwe.user.profielenprofielen.profielnaam)
>>
>>
>> this for example works fine
>>
>
but doing the same thing but then like this with works fine on i do a
similar test on the default db but i
same for
nieuweklanten =
ProfielenUserprofile.objects.values('user__profielenprofielen__profielnaam')[:1]
for nieuwe in nieuweklanten:
print(nieuwe['user__profielenprofielen__profielnaam'])
--
You received this message because you are subscribed to the Google Groups
"Django users" group
this worked fine in django 1.6.1 but fails in 1.8.5
--
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 g
It would be helpful if you could create a minimal example project (without
unnecessary fields and methods) with a test that passes on Django 1.6 but
fails on Django 1.8.
On Saturday, October 24, 2015 at 9:13:42 AM UTC-4, probleem support wrote:
>
> this worked fine in django 1.6.1 but fails in
working on that
--
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 django-users@goog
test project proving my point
https://github.com/gerdkoetje/dualdbtest
--
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.
As noted on the ticket, it looks like you're missing an app in
INSTALLED_APPS.
On Tuesday, October 27, 2015 at 10:55:51 AM UTC-4, probleem support wrote:
>
> test project proving my point
> https://github.com/gerdkoetje/dualdbtest
>
--
You received this message because you are subscribed to the
Tim in my real project that database is a remote database, that shouldn't
be in installed apps shouldn't it.
but to prove my point it did it with 2 local databases in the test project.
in my real project i can't do reverse lookups on the remote database models.
--
You received this message beca
In order to use models and their relations you have to include them in
INSTALLED_APPS regardless of which database they are stored in. This is
noted in the 1.7 release notes:
https://docs.djangoproject.com/en/1.8/releases/1.7/#app-registry-consistency
Maybe you don't want your local project to
Thanks a lot tim, this has resolved the issue.
Lesson learned to jump from 1.6 to 1.8 go release by release.
then i would probably seen it.
Appreciated ur help do!
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group a
My question is very similar to one by Seth Gordon in 2011. But it's been 4
years since then, so I'll try again.
I have models A and B, and B has a O2O field pointing to A. When I do
`a.b.delete()`, then I'm surprised to find that `a.b` is still a valid
object. How can I modify `a` so that it retur
I believe that delete() only deletes the reference to the object in the
database, but does not affect the calling object in memory.
I think the reason for this is so that you can perform a delete operation,
and if successful, gather information about the deleted object to display
a confirmation m
the 'include/exclude list
box' that shows all the Records, so the user can choose the ones that
the Track may belong to.
What do I need to do to show this 'reverse' relation in the Track form
page?
--~--~-~--~~~---~--~~
You received this message
Hi,
I am experiencing an issue on annotate function only on my production
site only when executing the code on a normal navigation (the shell
command on production has no problem).
This is the pseudo code :
# models
class Competition(model):
title = char
published = bool
date = date
27;tracks',) in the ModelAdmin of the Record.
>
> However, the Track admin page DOES NOT show the 'reverse' of the many-
> to-many relation. I mean, I want to display the 'include/exclude list
> box' that shows all the Records, so the user can choose the ones tha
Thank you so very much!! It worked exactly like I wanted. I had been through
the django tickets, but since this ticket has no keywords, I wasn't able to
find it... It's sad to see that this is being going on for nearly 3 years!!!
In my case, I had my tables 'syncdb'ed already, so it was not an iss
30 matches
Mail list logo