Re: query on models

2014-05-07 Thread Rafael E. Ferrero
Just filtering Ques model (imho) -- Rafael E. Ferrero 2014-05-07 10:24 GMT-03:00 Anushree : > I have the following models. I want to retrieve list of question banks > related to a particular subject. Is it possible to do without modifying the > existing data

query on models

2014-05-07 Thread Anushree
I have the following models. I want to retrieve list of question banks related to a particular subject. Is it possible to do without modifying the existing data models?Thank you class Subject(models.Model): name = models.CharField(max_length = 255) desc = models.TextField(blank=True) def

Re: Django Query Data

2014-05-05 Thread C. Kirby
a value_list(). values_list usually returns a list of tuple, but if you are only asking for a single field you can give it the flat flag, which flattens the tuples into just the field value. ( https://docs.djangoproject.com/en/dev/ref/models/querysets/#values-list) Taken all together, your query

Django Query Data

2014-05-04 Thread Brendan Edwards
Hi, I have just started learning Django (been flip flopping between meteor and django, cant decide which to use..) and I am fairly new to web development in general. Basically, I have a query where I am using the code "teecolor = GolfCourseTees.objects.values('Tee_Color').filter(Course

SQL query to authenticate user from non-django app

2014-04-28 Thread Goran Mekic
Hi, I have a Django project with its DB. How can I use Django DB users to auth, for example, vsftpd? I mean, I couldn't find suitable SQL query to check the password. Thank you! signature.asc Description: Digital signature

Re: Casting a raw query set as a list for pagination

2014-04-26 Thread Matt Buck
I've created a paginator for RawQuerySets. https://github.com/seamusmb/django-paginator-rawqueryset On Tuesday, March 26, 2013 5:51:41 AM UTC-4, chambe...@gmail.com wrote: > > I'm trying to implement Django's built in pagination feature with a raw > query set. I've researched

Tastypie with Django and MongoDB. How to query subdocuments

2014-04-02 Thread Juan M. Mendez
Hello, I made this question with more details on stackoverflow: https://stackoverflow.com/questions/22792828/best-subdocument-structure-to-query-django-tastypie-with-mongodb-backend It could be summarized on this: I want to create an structure with Django and Tastypie that allows to have

Re: User Profiles "user.get_profile()" returns 'matching query does not exist.'

2014-03-28 Thread Brian Sanchez
t; > model._default_manager.get(user__id__exact=self.id) > > File "/usr/lib/python2.5/site-packages/django/db/models/manager.py", > > line 93, in get > > return self.get_query_set().get(*args, **kwargs) > > File "/usr/lib/python2.5/site-packages/

Re: How allow public query & download of info from my db

2014-03-21 Thread Rafael E. Ferrero
2014-03-21 12:19 GMT-03:00 C. Kirby <mist...@gmail.com>: > I've actually built a small app that generates a form allowing users to do > a Meta Query on models django-modelqueryform. > I am in the process of a full rewrite of it to make it a lot more > customizable, but the ini

Re: How allow public query & download of info from my db

2014-03-21 Thread C. Kirby
I've actually built a small app that generates a form allowing users to do a Meta Query on models django-modelqueryform. I am in the process of a full rewrite of it to make it a lot more customizable, but the initial version works with fields that have choices set or with fields

Re: How allow public query & download of info from my db

2014-03-21 Thread Venkatraman S
oad > load it from my db. > > So far I'm thinking that using a form is they way to go to accept this > information. But from there I'm a little confused. Does a custom model > need to be created automatically before that query can be requested and > displayed? Or can model be

How allow public query & download of info from my db

2014-03-20 Thread Nicholas Tapia
there I'm a little confused. Does a custom model need to be created automatically before that query can be requested and displayed? Or can model be skipped in this case? Thank you Django Community! -Nicholas -- You received this message because you are subscribed to the Google Groups

How to convert SQL Complex QUERY to django QUERY

2014-03-18 Thread Shoaib Ijaz
I am trying to convert sql query to django query but failed to do this, can anyone help me select id,name,round(value::numeric,2) as value, st_transform(geometry, 3857) as geometry from net_rest where state_id in (1,2) and name = 'height' union (select d.id

Re: RAW query to non default DB

2014-03-07 Thread Tom Evans
On Fri, Mar 7, 2014 at 3:31 PM, bikeridercz wrote: > Dear colleagues, > > I'm trying to do a direct select do database other than the default one. But > it fails with error. > > Note 1: "ASSETS.objects.using('vodb').filter(...)" works fine > Note 2: the select is little tricky and

RAW query to non default DB

2014-03-07 Thread bikeridercz
Dear colleagues, I'm trying to do a direct select do database other than the default one. But it fails with error. Note 1: "ASSETS.objects*.using('vodb')*.filter(...)" works fine Note 2: the select is little tricky and unfortunately cannot be replaced by a database view, because I have no

Django Site(s) looks ugly with ?None as query parameter.

2014-03-06 Thread Christian Schmitt
Hello, currently I have some Django sites one of them is http://www.schnooge-hansili.de/ if i open it with http://www.schnooge-hansili.de/?None It looks really ugly. Currently the first site is just a simple CBV view. Nothing really special. -- You received this message because you are

Re: Optimizing DB query involving annotate and aggregate

2014-02-11 Thread ST
: > > On Wed, 5 Feb 2014 10:11:29 -0800 (PST) ST > <sej...@googlemail.com> > > wrote: > > Hi, > > > > I'm trying to optimize the run-time of getting total credit and debt > > values out of our database. Ideally I'd like to formulate it as a > > Dj

Re: Optimizing DB query involving annotate and aggregate

2014-02-06 Thread Arnold Krille
On Wed, 5 Feb 2014 10:11:29 -0800 (PST) ST <sej...@googlemail.com> wrote: > Hi, > > I'm trying to optimize the run-time of getting total credit and debt > values out of our database. Ideally I'd like to formulate it as a > Django query. This is the raw SQL query I have, which

Re: Optimizing DB query involving annotate and aggregate

2014-02-06 Thread ST
On Wednesday, February 5, 2014 8:01:53 PM UTC, Anssi Kääriäinen wrote: > > Something like this might work: > > Transaction.objects.values_list('member_id').annotate(total=Sum('amount')).filter(total__gt=0).aggregate(Sum('total')) > This didn't work - it produced a "SELECT

Re: Optimizing DB query involving annotate and aggregate

2014-02-05 Thread Anssi Kääriäinen
Something like this might work: Transaction.objects.values_list('member_id').annotate(total=Sum('amount')).filter(total__gt=0).aggregate(Sum('total')) That is, don't start from Member, Django isn't smart enough to get rid of the non-necessary joins. Instead go directly for the query you

Optimizing DB query involving annotate and aggregate

2014-02-05 Thread ST
Hi, I'm trying to optimize the run-time of getting total credit and debt values out of our database. Ideally I'd like to formulate it as a Django query. This is the raw SQL query I have, which produces the right answer and is very fast (milliseconds): SELECT sum(tg.total) FROM ( SELECT

Re: Query friends of an user

2013-12-17 Thread C. Kirby
ND, Friendship.FAVORITE]) That will give you a QuerySet of >> all the friendships a user has. If you just want the list of friends then >> extend that query with a values_list like so: >> >> Friendship.objects.filter(user__pk = 32, status__in = [Friendship.FRIEND, >> Friendshi

Re: Query friends of an user

2013-12-17 Thread Arthur Silva
ser has. If you just want the list of friends then > extend that query with a values_list like so: > > Friendship.objects.filter(user__pk = 32, status__in = [Friendship.FRIEND, > Friendship.FAVORITE]) .values_list('friend', flat=True) > > > > On Tuesday, December 17, 20

Re: Query friends of an user

2013-12-17 Thread C. Kirby
Why not just Friendship.objects.filter(user__pk = 32, status__in = [Friendship.FRIEND, Friendship.FAVORITE]) That will give you a QuerySet of all the friendships a user has. If you just want the list of friends then extend that query with a values_list like so: Friendship.objects.filter

Query friends of an user

2013-12-17 Thread Arthur Silva
I want to query the friends of an User but I'm struggling to get the correct query. Models: class User(AbstractUser, TimestampedModel, SerializeMixin): city = models.CharField(max_length=60, blank=True) picture = models.URLField(blank=True) cover_picture = models.URLField(blank

Re: Adding Objects to Query Set

2013-12-17 Thread Vibhu Rishi
='members') > member = models.ForeignKey(User) > added_on = models.DateTimeField() > > The full query to get all Projects the User is either member or leader: > > Projects.objects.filter( > Q(owner=user) | Q(members__member=user) > ) > > Don't merge in python what you

Re: Adding Objects to Query Set

2013-12-17 Thread Vibhu Rishi
s. > > > On Monday, December 16, 2013 1:47:13 PM UTC, Vibhu Rishi wrote: >> >> Hi >> >> I am not able to figure this out. I want to add objects to a query set. >> >> I have 2 models : >> 1. Projects which is basically a list of projects. I have a field

Re: Adding Objects to Query Set

2013-12-17 Thread Arnold Krille
Hi, define related names in ProjectMember: class ProjectMember(models.Model): project = models.ForeignKey(Project, related_name='members') member = models.ForeignKey(User) added_on = models.DateTimeField() The full query to get all Projects the User is either member or leader

Re: Adding Objects to Query Set

2013-12-16 Thread antialiasis
gt; Hi > > I am not able to figure this out. I want to add objects to a query set. > > I have 2 models : > 1. Projects which is basically a list of projects. I have a field which > defines the owner of the project. e.g. : > > class Project(models.Model): > ... >

Re: Adding Objects to Query Set

2013-12-16 Thread Vibhu Rishi
Rishi <vibhu.ri...@gmail.com>wrote: > >> Hi >> >> I am not able to figure this out. I want to add objects to a query set. >> >> I have 2 models : >> 1. Projects which is basically a list of projects. I have a field which >> defines the owner of the pro

Re: Adding Objects to Query Set

2013-12-16 Thread Vibhu Rishi
in the 2nd table. e.g. following is the full list of projects. + denotes that I am owner. * denotes where I am a member. Project1 Project2 ( + ) Project 3 Project4 ( * ) When I do a projects = Project.objects.filter(owner=request.user) I get a query set like : [] Now, when I do member_projects

Re: Adding Objects to Query Set

2013-12-16 Thread Andrew Farrell
.ri...@gmail.com> wrote: > Hi > > I am not able to figure this out. I want to add objects to a query set. > > I have 2 models : > 1. Projects which is basically a list of projects. I have a field which > defines the owner of the project. e.g. : > > class Project(mod

Re: Adding Objects to Query Set

2013-12-16 Thread Sebastian Morkisch
Hi I am working on the same thing. Same here, one project model, one extended User model. Well, when I printed the request, I got the Usename, which is not an id, but you'd like to compare ids. Is that correct? So perhaps you're closer to a solution, if you have a method like this: def

Adding Objects to Query Set

2013-12-16 Thread Vibhu Rishi
Hi I am not able to figure this out. I want to add objects to a query set. I have 2 models : 1. Projects which is basically a list of projects. I have a field which defines the owner of the project. e.g. : class Project(models.Model): ... owner = models.ForeignKey(User) 2

Re: How to query multiple described objects exist in a many to many field

2013-12-05 Thread Aamu Padi
you need to specify that you want to join twice to that table. You > do this by specifying the conditions for each join in a separate > "filter()" call, and so to find threads that have a row with user1 in > the through table, and also have user2 in the through table: > >

Re: How to query multiple described objects exist in a many to many field

2013-12-04 Thread Tom Evans
lter(user=user1).filter(user=user2) You started by asking how to find threads which had user1 and user2, but no other users. This is more complex, you need to count the number of users in the thread without filtering the users first! This means two queries, or a sub query: threads_with_both = Thread.obje

How to query multiple described objects exist in a many to many field

2013-12-04 Thread Aamu Padi
How do I check whether there is a thread containing only the sender (user 1) and the recipient (user 2), and no other users. models.py class Thread(models.Model): user = models.ManyToManyField(User) is_hidden = models.ManyToManyField(User, related_name='hidden_thread',

Re: Problem with raw query and using in

2013-11-19 Thread huw_at1
mid,realm__in=realms) > data2 = AuctionData.objects.raw('SELECT * FROM auctiondata_auctiondata > WHERE itemid_id=%s AND realm_id in %s ',[itemid,realms]) > > The first query works as expected, but the 2nd one fails, because the > query ends up as: > > SELECT * FROM auctiondata_auction

Re: Problem with raw query and using in

2013-11-17 Thread Thorsten Sanders
Thanks, I tried that, it makes the query right, but when I access the result in a for loop it gives now: 'Cursor' object has no attribute '_last_executed' Think for now I just stay with using 2 variables, that works fine for the moment. Am 17.11.2013 00:38, schrieb Dennis Lee Bieber

Re: Problem with raw query and using in

2013-11-16 Thread Javier Guerra Giraldez
On Sat, Nov 16, 2013 at 7:40 AM, Thorsten Sanders wrote: > realms=[1] > data = AuctionData.objects.filter(itemid__exact=itemid,realm__in=realms) > data2 = AuctionData.objects.raw('SELECT * FROM auctiondata_auctiondata WHERE > itemid_id=%s AND realm_id in %s

Problem with raw query and using in

2013-11-16 Thread Thorsten Sanders
* FROM auctiondata_auctiondata WHERE itemid_id=%s AND realm_id in %s ',[itemid,realms]) The first query works as expected, but the 2nd one fails, because the query ends up as: SELECT * FROM auctiondata_auctiondata WHERE itemid_id='43552' AND realm_id in ('1',) The last comma shouldnt

Re: Is this what you would expect from this Q query?

2013-11-15 Thread Phoebe Bright
(alias, targets[0].column, None), >> 'isnull', False), AND) < this is adding the spurious clause >> >> This is django version 1.6 and happens using both the original Q version >> and using your suggested .exclude version. >> Having found it I'm still

Re: Is this what you would expect from this Q query?

2013-11-14 Thread akaariai
n > and using your suggested .exclude version. > Having found it I'm still not sure what it means or how to avoid it being > triggered! > > Any suggestions? > I believe the query is actually correct. The idea is that .exclude(condition) produces complement of .filter(condit

Re: Is this what you would expect from this Q query?

2013-11-14 Thread tim
Please provide your models so I can reproduce it myself. It's quite difficult (at least for me) to help otherwise. On Thursday, November 14, 2013 7:17:43 AM UTC-5, Phoebe Bright wrote: > > After a long time trying to create a simple version that would replicate > the error, and failing, I've

Re: Is this what you would expect from this Q query?

2013-11-14 Thread Phoebe Bright
After a long time trying to create a simple version that would replicate the error, and failing, I've tracked it through the original code. Line 1140 in django/db/models/sql/query.py in function build_filter if current_negated and (lookup_type != 'isnull' or value is False):

Re: Is this what you would expect from this Q query?

2013-11-13 Thread tim
(user__in= rather than .filter(~Q if that works for your query. Tim On Monday, November 11, 2013 6:36:12 AM UTC-5, Phoebe Bright wrote: > > I have this line in my code where the functions return an ID and what I > wanted was to select all records that did not belong to one of th

Is this what you would expect from this Q query?

2013-11-11 Thread Phoebe Bright
I have this line in my code where the functions return an ID and what I wanted was to select all records that did not belong to one of these users. Carbon.objects.filter(~Q(user__in = [limbo_user(), system_user(), retire_user()])) What I expected to get was *SELECT* •••

Re: Complex query reduction

2013-11-08 Thread Javier Guerra Giraldez
On Fri, Nov 8, 2013 at 1:44 AM, Robin St.Clair <robin...@live.co.uk> wrote: > The last time I checked the use of IN, all the records from the database in > the query were brought back to the workstation, rather than being processed > on the backend and only the results returned to

Re: Complex query reduction

2013-11-08 Thread François Schiettecatte
:44:09 AM UTC+2, Robin St.Clair wrote: > Anssi > > The last time I checked the use of IN, all the records from the database in > the query were brought back to the workstation, rather than being processed > on the backend and only the results returned to the workstation. >

Re: Complex query reduction

2013-11-07 Thread akaariai
On Friday, November 8, 2013 8:44:09 AM UTC+2, Robin St.Clair wrote: > > Anssi > > The last time I checked the use of IN, all the records from the database > in the query were brought back to the workstation, rather than being > processed on the backend and only th

Re: Complex query reduction

2013-11-07 Thread Robin St . Clair
Anssi The last time I checked the use of IN, all the records from the database in the query were brought back to the workstation, rather than being processed on the backend and only the results returned to the workstation. Have there been changes that carry out the entire query

Re: Complex query reduction

2013-11-07 Thread akaariai
On Sunday, November 3, 2013 1:48:07 PM UTC+2, Robin St.Clair wrote: > > *IN* > >- if using Django avoid the IN operation at all costs > > > If there are potentially more than 15 items in the list, rework the IN as > a JOIN against whatever the source of the keys is > I don't necessarily

Re: Complex query reduction

2013-11-04 Thread Apostolos Bessas
On Sat, Nov 2, 2013 at 4:50 PM, Daniele Procida wrote: > > But, the real killer is the combination of ordering (in the queryset or on > the model, it doesn't matter) with the distinct() - as soon as one is removed > from the equation, the execution time drops to around 250ms.

RE: Complex query reduction

2013-11-03 Thread Robin St . Clair
end coders didn't consider the DBMS to be importantDate: Sun, 3 Nov 2013 02:37:09 -0800 From: akaar...@gmail.com To: django-users@googlegroups.com Subject: Re: Complex query reduction You should rewrite the query into a form that doesn't require distinct. In general, when you see a query that has

Re: Complex query reduction

2013-11-03 Thread akaariai
You should rewrite the query into a form that doesn't require distinct. In general, when you see a query that has joins and DISTINCT, that should be an alarm bell that something isn't written correctly in the query. Unfortunately Django's ORM generates such queries, and that isn't easy to fix

Re: Complex query reduction

2013-11-02 Thread Daniele Procida
).values_list('id', flat=True) # and the set() here is about 230ms faster than putting a distinct() on # the first query researchers = set(Researcher.objects.filter( person__entities__in=entities ).values_list('person', flat=True))

Re: Complex query reduction

2013-11-01 Thread Javier Guerra Giraldez
he total number of records shouldn't matter. more important is the number of selected records at some points in the query. i'd guess the number of chosen entities (those that _are_ descendant of the first one), and the number of chosen researches (those that _are_ members of those entities) should be the m

Complex query reduction

2013-11-01 Thread Daniele Procida
I have been exploring a rather complex query: # get all the MPTT descendants of entity entities = entity.get_descendants() # get all the Researchers in these Entities researchers = Researcher.objects.filter(person__member_of__entity__in=entities) # get all the BibliographicRecords

Dynamic query with Foreign Key

2013-10-30 Thread Domagoj Kovač
uot;%s__name__contains" % field.name: search_term }) if q: if query: query = query | q else: query = q rows_list = rows_list.filter(query) I would like to create a function that i can use

Re: Django ORM generating the wrong query for recent friends of an user

2013-10-16 Thread Arthur Silva
nique_together = [('user', 'friend')] > > > > The code I'm using to get the most recent friends of user 4 > > > id = 4 > friendships = Friendship.objects.exclude(status="pending").filter( > ~Q(user__friendships__status="pending&

Re: Django query from database

2013-10-11 Thread Leonardo Giordani
Ok, I think I got the point. So, correct me if I didn't get it right, you have to get users which have first_name, last_name, or other fields equal to the words in your list B. This can be accomplished by looking at each field for each keyword. I would also compile a dictionary keeping reference

Re: Django query from database

2013-10-11 Thread Kamal Kaur
On Fri, Oct 11, 2013 at 6:43 PM, Leonardo Giordani wrote: > Sorry, I forgot the User part of your question. > > Let me understand the exact relationship between codes, words and users: do > those words or codes come from a form? Or are saved in the DB for each user?

Re: Django query from database

2013-10-11 Thread Leonardo Giordani
1 Kamal Kaur <kamal.kaur...@gmail.com> > On Fri, Oct 11, 2013 at 4:06 PM, Leonardo Giordani > <giordani.leona...@gmail.com> wrote: > > I think that you have to perform a query for each Code, extracting the > list > > of Word matching that Code and then merging all the lists

Re: Django query from database

2013-10-11 Thread Kamal Kaur
On Fri, Oct 11, 2013 at 4:06 PM, Leonardo Giordani <giordani.leona...@gmail.com> wrote: > I think that you have to perform a query for each Code, extracting the list > of Word matching that Code and then merging all the lists. Exactly! > Since I don't know your models, I'll give y

Re: Django query from database

2013-10-11 Thread Leonardo Giordani
I think that you have to perform a query for each Code, extracting the list of Word matching that Code and then merging all the lists. Since I don't know your models, I'll give you some general code, let me know if you understand how to implement it exactly on your models. Assuming

Django query from database

2013-10-11 Thread Kamal Kaur
Hello there, Hope you are doing well :) I have a problem regarding querying a list from two tables, the procedure goes like: Considering two tables from mysql database: 1. UserProfile table, with complete client details: First name, Last name, Address, email id, Contact number etc. 2.

Re: Query parameters for receiving post

2013-10-09 Thread Denis Chernoshchekov
Your right... I can't testing now. 2013/10/9 Hélio Miranda <helio...@gmail.com> > gives error: > 'BaseList' object has no attribute 'values' > > The query has to be the same as I stated it works: > * > Player.objects.filter(country__in=Country.object

Re: Query parameters for receiving post

2013-10-09 Thread Hélio Miranda
gives error: 'BaseList' object has no attribute 'values' The query has to be the same as I stated it works: * Player.objects.filter(country__in=Country.objects.filter(nationality__in=Nationality.objects.filter(name='Espanhola'))) * -- You received this message because you are subscribed

Re: Query parameters for receiving post

2013-10-09 Thread Denis Chernoshchekov
try this solution http://plnkr.co/edit/cyM6AmZcyFVUU6soFKhB 2013/10/9 Denis Chernoshchekov > ok, i understand, i minute. > > > 2013/10/9 Denis Chernoshchekov > >> *fld_name = 'nationality_in' *must be with double '_'* **fld_name = >>

Re: Query parameters for receiving post

2013-10-09 Thread Denis Chernoshchekov
ok, i understand, i minute. 2013/10/9 Denis Chernoshchekov > *fld_name = 'nationality_in' *must be with double '_'* **fld_name = > 'nationality__in'* > > > 2013/10/9 Denis Chernoshchekov > >> Sorry, i don't understand you... You can

Re: Query parameters for receiving post

2013-10-09 Thread Denis Chernoshchekov
*fld_name = 'nationality_in' *must be with double '_'* **fld_name = 'nationality__in'* 2013/10/9 Denis Chernoshchekov > Sorry, i don't understand you... You can control all your values for all > fields, you can generate dict which you like. > > > 2013/10/9 Hélio

Re: Query parameters for receiving post

2013-10-09 Thread Denis Chernoshchekov
Sorry, i don't understand you... You can control all your values for all fields, you can generate dict which you like. 2013/10/9 Hélio Miranda > I put that work, I wanted to know was how to put in the code, because you > can not do the same to position > > -- > You received

Re: Query parameters for receiving post

2013-10-09 Thread Hélio Miranda
was trying something like this: *if fld_name == 'nationality':* *fld_name = 'nationality_in'* *value = Player.objects.filter(country__in=Country.objects.filter(nationality__in=Nationality.objects.filter(name=value))) * But it does not work -- You

Re: Query parameters for receiving post

2013-10-09 Thread Hélio Miranda
I put that work, I wanted to know was how to put in the code, because you can not do the same to position -- 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

Re: Query parameters for receiving post

2013-10-09 Thread Denis Chernoshchekov
Try this - *Player.objects.filter(country__in=** Nationality.objects.filter(name='Espanhola').distinct('country').values('country')) * 2013/10/9 Hélio Miranda > yes, that was it ... > Just one more thing, if I would like to create the nationality of the > player, so that

Re: Query parameters for receiving post

2013-10-09 Thread Hélio Miranda
yes, that was it ... Just one more thing, if I would like to create the nationality of the player, so that the filter is: * Player.objects.filter(country__in=Country.objects.filter(nationality__in=Nationality.objects.filter(name='Espanhola'))) * * * where only the step nationality, as I do, not

Re: Query parameters for receiving post

2013-10-09 Thread Denis Chernoshchekov
See, maybe like this? http://plnkr.co/edit/cyM6AmZcyFVUU6soFKhB 2013/10/9 Hélio Miranda > I have code like this: > http://plnkr.co/edit/L1ByIyFyaEdgwrfVU7Jr > > Just do not know how to put this part in the code ... > Where do I put this part? > > -- > You received this

Re: Query parameters for receiving post

2013-10-09 Thread Hélio Miranda
I have code like this: http://plnkr.co/edit/L1ByIyFyaEdgwrfVU7Jr Just do not know how to put this part in the code ... Where do I put this part? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Re: Query parameters for receiving post

2013-10-09 Thread Denis Chernoshchekov
For position you may have dict like - **{' position__in ': Position.objects. filter(name=positionpost) } 9 жовт. 2013 11:45, користувач "Hélio Miranda" написав: > hi, thanks that helped a lot. > But I have a problem which is, for example when I do a filter by position, > is

Re: Query parameters for receiving post

2013-10-09 Thread Hélio Miranda
hi, thanks that helped a lot. But I have a problem which is, for example when I do a filter by position, is not direct as other fields like name or surname. For the position I have to type this: * Player.objects.filter(position__in=Position.objects.filter(name=positionpost)) * How can I

Re: Query parameters for receiving post

2013-10-09 Thread Denis Chernoshchekov
You can pass filter params like a dict - Player.objects.filter(**your_dict), so you need only prepare your dict from POST. 8 жовт. 2013 17:42, користувач "Hélio Miranda" написав: > Hi > Here I am having a problem which is as follows: > I 'm getting parameters via post to make

Re: Query parameters for receiving post

2013-10-09 Thread Hélio Miranda
I was testing you sent me, but it is giving me error ... is giving this error: *expected string or buffer* -- 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

Re: Query parameters for receiving post

2013-10-08 Thread Ramiro Morales
On Tue, Oct 8, 2013 at 11:42 AM, Hélio Miranda wrote: > > Hi > Here I am having a problem which is as follows: > I 'm getting parameters via post to make querys depending on paramtros I are > passed ... doing gender filters. > So I'm doing well > def filter(request): > if

Re: How to Query account/profile information for multiple account and allowing user edit or update acount

2013-10-08 Thread Okorie Emmanuel
. I have created the model as shown in last post but how to query individual details in their respective profile is the problem. Any way out. thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this grou

Query parameters for receiving post

2013-10-08 Thread Hélio Miranda
Hi Here I am having a problem which is as follows: I 'm getting parameters via post to make querys depending on paramtros I are passed ... doing gender filters. So I'm doing well *def filter(request):* *if request.method == 'POST':* *namepost = request.POST.get('name')* *

Re: Query field with reference

2013-10-08 Thread Hélio Miranda
I managed to solve the problem, I did so: *result = [a.get_json() for a in Player.objects.filter(position__in=Position.objects.filter(name=positionpost))] * Thanks for the trouble -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe

Re: Query field with reference

2013-10-08 Thread Hélio Miranda
Gives error says: DD is not a valid ObjectId For the DD not objectId of reference -- 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

Re: Query field with reference

2013-10-08 Thread Leonardo Giordani
of The Digital Cat <http://lgiordani.github.com> My profile on About.me <http://about.me/leonardo.giordani> - My GitHub page<https://github.com/lgiordani>- My Coderwall profile <https://coderwall.com/lgiordani> 2013/10/8 Hélio Miranda <helio...@gmail.com> > Hi > I w

Query field with reference

2013-10-08 Thread Hélio Miranda
Hi I was trying to make a query in a field that has refencia to another collection, like this: *result = [a.get_json() for a in Player.objects.filter(position__name='DD')] * But it is returning me empty, and I have a player with the position DD I'm using mongodb as a database. In my Document

Re: How to Query account/profile information for multiple account and allowing user edit or update acount

2013-09-30 Thread Daniel Roseman
On Monday, 30 September 2013 19:33:31 UTC+1, Okorie Emmanuel wrote: > I have two problems > > 1. How can i populate the account >information of each user, this >what i have done but only info on >user models populates, the info on extended >field does not show on my template >

Re: How to Query account/profile information for multiple account and allowing user edit or update acount

2013-09-30 Thread Frank Bieniek
Please try, django-userena, or django-registration, both deal with userdetails. Thx Frank Am 30.09.13 20:33, schrieb Okorie Emmanuel: I have two problems 1. How can i populate the account information of each user, this what i have done but only info on user models populates, the

How to Query account/profile information for multiple account and allowing user edit or update acount

2013-09-30 Thread Okorie Emmanuel
I have two problems 1. How can i populate the account information of each user, this what i have done but only info on user models populates, the info on extended field does not show on my template # models.py class Student(Models.model): user = foreignkey(user)

Re: Basic query regarding admin CSS

2013-09-28 Thread Jason S
Hi, This is fixed, I think it was as I was missing one of the entries below: 37 MIDDLEWARE_CLASSES = ( 38 # This loads the index definitions, so it has to come first 39 'autoload.middleware.AutoloadMiddleware', 40 41 'django.middleware.common.CommonMiddleware', 42

Basic query regarding admin CSS

2013-09-28 Thread Jason S
Hi, I'm new to development and have just gone from some python and django tuts, on my way to developing my first app. I've created a model and can view it under the /admin page, however the page does not use any of the pretty CSS you see in the tutorials because it can't find the files:

Django query Advanced

2013-09-26 Thread Hélio Miranda
I am trying a query like this: result = json.dumps([a.get_json() for a in Player.objects.filter((Q(name=namepost) | Q(surname="Coimbra")))]) return HttpResponse (result, content_type = 'application / json') But it gives me the following error: Not a query object: (AND: ('surname',

Django ORM generating the wrong query for recent friends of an user

2013-09-24 Thread Arthur Silva
ship.objects.exclude(status="pending").filter( ~Q(user__friendships__status="pending"), user__friendships__friend_id=id).order_by("-created_at") I also tried several combinations like grouping all filtering inside one filter() but

Re: Complex query

2013-09-09 Thread Drew Ferguson
ies if implemented naively. If I write the required > query in raw SQL, it should be faster, but probably not very fast > anyway. Also I don't know how to cache properly since topics should be > ordered by most recent posts (that is, if someone posts to topic on > third page, this top

Re: Complex query

2013-09-09 Thread Yegor Roganov
Thanks for you replies. But I wonder how real production web sites deal with this problem. The problem is that I want to display about 30 topics per page which would result in 30+1 queries if implemented naively. If I write the required query in raw SQL, it should be faster, but probably

Re: Complex query

2013-09-09 Thread akaariai
? > This is something that would be nice to support with prefetch_related(). This is exactly the type of query where ORM abstraction would be very welcome. Writing this in SQL isn't easy, and the most efficient way to write the query varies a lot depending on the used database backend. Unfort

Re: Complex query

2013-09-08 Thread Jani Tiainen
Problem is that you have to be able to express it in SQL. And thus ther is not much you can do in SQL to get what you actually wanted. Considering amount of the data fetched - it's relatively low query count and unless you're hitting very busy site you wont notice much of difference doing

<    5   6   7   8   9   10   11   12   13   14   >