Backward query is not working with GEO Manager

2015-04-14 Thread aarti sawant
ute return self.cursor.execute(sql, params) File "/home/web/Search/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 128, in execute return self.cursor.execute(query, args) File "/home/web/Search/local/lib/python2.7/site-packages/MySQLdb/cursors.py&q

Re: Django builds wrong sql query.

2015-03-19 Thread Алексей Широков
Thanks for your reply, I will try... -- 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

Re: Django builds wrong sql query.

2015-03-19 Thread Tim Graham
Try ditching .extra() and using the expressions API in Django 1.8. We're trying to make everything that's possible with .extra() available through better APIs so try to avoid it as even if there is a bug, it's probably unlikely to be fixed. On Thursday, March 19, 2015 at 9:11:39 AM UTC-4,

Django builds wrong sql query.

2015-03-19 Thread Алексей Широков
*I have the following code:* package_queryset = Package.objects.extra( where=[(' "document_package"."id" IN (SELECT DISTINCT ON ("document_id") "id"' ' FROM "document_package"' ' WHERE "status" NOT IN

Re: Django Query to get max rating

2015-03-18 Thread Filipe Ximenes
>From what I could understand, you are trying to fetch all the top ratings for each question in a group, correct? The problem is that this query: top_rated_list = Ratings.objects.get(rating = max_rating) ​ is returning more than one rating instance. "get" queries are supposed to re

Django Query to get max rating

2015-03-18 Thread Yadnesh Patil
My model structure is like this: class Group(models.Model): u_id= models.ForeignKey(User) group_name = models.CharField(max_length=50,unique=True) def __str__(self): # __unicode__ on Python 2 return self.group_name + " " + self.org_nam

Re: Query optimization - From 3 queries to 2

2015-03-02 Thread Simon Charette
ovider_ServiceTypes( BaseModel ): > > # Model Attributes > service_type = models.ForeignKey( 'ServiceType', verbose_name = _( > 'service type' ) ) > provider = models.ForeignKey( 'Provider', verbose_name = _( 'provider' ) ) > is_top =

Query optimization - From 3 queries to 2

2015-03-01 Thread Humberto Moreira
_ServiceTypes( BaseModel ): # Model Attributes service_type = models.ForeignKey( 'ServiceType', verbose_name = _( 'service type' ) ) provider = models.ForeignKey( 'Provider', verbose_name = _( 'provider' ) ) is_top = models.BooleanField( _( "is top service" ), default = Fal

Re: Django Query Set

2015-02-11 Thread C. Kirby
I'm sure someone can help you, but you need to post some more information to get useful support. Please post the models that you are dealing with, as well as maybe an example of the result you are trying to get. On Wednesday, February 11, 2015 at 8:20:59 AM UTC-6, Ajay M wrote: > > I'm on a

Django Query Set

2015-02-11 Thread Ajay M
I'm on a Django Project, I'm stuck with this situation. I've 3 Models, records,users and towns. Records are posted by users who belongs to towns. User may be a mobile user or a web user. Primary key of users is a foreign key in records, primary key of towns is a foreign key in users. I need to

static files with query strings

2015-02-06 Thread Mark Mikofski
Do I need to make a custom storage or custom template to handle query strings in static file URLs or endpoints? Using the new static template in Django>=1.4 works fine for simple endpoints and URLs For example, the following works fine: {% load staticfiles %} However if the

sql query to annotation values e aggretate statements

2015-01-29 Thread Mauro Ziliani
Hi all. My name's Mauro and I start to work with Django 1.7.3 I work on my project which tracks my accounting. I need to translate a SQL query to annoteta values aggretate statements. The application is named accounting The models involved are: class Nominativo(models.Model): nome

Re: Map Django Model to Legacy multi-join query

2015-01-21 Thread Scot Hacker
On Tuesday, January 20, 2015 at 8:02:57 AM UTC-8, Fred wrote: > > I've got a complex 1000+ table vendor read-only MS SqlServer database and > only have SELECT privileges. I can connect with pymssql no problem. > > Of all these tables, I probably care about 50 or less. > > I cannot create views

Re: Map Django Model to Legacy multi-join query

2015-01-20 Thread James Schneider
Not sure what you mean. Are you looking to build the model definitions in your models.py files, or are you trying to take the results of a query against MSSQL and pass them to a constructor for a model that has already been defined? Either way, eventually you'll end up with a copy of the 'model

Map Django Model to Legacy multi-join query

2015-01-20 Thread Fred
erver" option. There are several administrative and performance hurdles to this. This DB is not clearly documented, so I have to explore and refine my SELECT statement for each query. I'm typically ending up with 5...10 joins per query. Most relationships are Foreign Keys although a fe

Foked Django Mezzanine with Query-less database SearchQuerySet integration [Gazelle]

2014-12-22 Thread Robert Steckroth
Hello community, I wanted to show interest in collaborating on an opensource Django application called Gazelle (a fork of Mezzanine). I built a SearchQuerySet with a drop in replacement to the filter() command which does not hit the database. So, far the results are promising and I am opening the

Re: Optimizing has_perm query time on PERMISSION AND GROUP PERMISSION

2014-12-19 Thread aRkadeFR
Hey mohd, How do you know the CPU burnt come from the method has_perm? Did you dump the query and play it again? It's most likely to be something else FMPOV. The has_perm is just a simple query in DB... aRkadeFR On 12/18/2014 05:27 PM, mohd irshad wrote: Hello , I am constantly facing face

Optimizing has_perm query time on PERMISSION AND GROUP PERMISSION

2014-12-18 Thread mohd irshad
Hello , I am constantly facing face max cpu usage problem because of few database (postgres) heavy query has_perm is one of them. how can I optimized such query. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from

Re: Query set append

2014-12-02 Thread check . django
Thanks guys . Appreciate the help !! On Monday, December 1, 2014 11:07:59 AM UTC-8, check@gmail.com wrote: > > Hello > > I am very new to python and Django . I have a basic question : > > 1. I have three database tables : Table A , Table B and Table C > 2. in my views.py i do : > >-

Re: Query set append

2014-12-02 Thread Florian Schweikert
On 2014-12-01 20:07, check.dja...@gmail.com wrote: * I load the temple : template = loader.get_template(>.html>) * i use context : context = RequestContext(request,{ 'tableC_QuerySet': tableC_QuerySet,}) * return HttpResponse(template.render(context)) you may also have

Re: Query set append

2014-12-02 Thread Daniel Roseman
hatever it had in the last iteration. If you want to get all the elements from each iteration, you'll need to put them into a list. For example: values = [] for x in tableB_QuerySet: values.extend(list(models.TableC.objects.filter(tableC_id = x.))) In addition, there is almost certainly

Re: Django's query result caching

2014-12-01 Thread termopro
(null=True) objects = models.GeoManager() And i do the following query: City.objects.filter(location__distance_lt=(**some_location**, D(km=30))).distance(**some_location**).order_by('distance')[:15] How do convert this query result to WKT ? On Monday, December 1, 2014 10:36:13 PM UTC+2

Re: Django's query result caching

2014-12-01 Thread George Silva
You can convert your spatial results to WKT and store them in redis. On Mon, Dec 1, 2014 at 2:45 PM, termopro <termo...@gmail.com> wrote: > I am creating a website using Django 1.7 and GeoDjango. I've hit the point > when i need to optimize website speed. > > One of the bo

Re: Query set append

2014-12-01 Thread Simon Charette
Try using a subquery for this: tableC_QuerySet = models.TableC.objects.filter( tableC_id__in=models.TableB.objects.filter(table_ID = ).values() ) Le lundi 1 décembre 2014 14:07:59 UTC-5, check@gmail.com a écrit : > > Hello > > I am very new to python and Django . I have a basic question

Query set append

2014-12-01 Thread check . django
Hello I am very new to python and Django . I have a basic question : 1. I have three database tables : Table A , Table B and Table C 2. in my views.py i do : - tableB_QuerySet = models.TableB.objects.filter(table_ID = ) - *This returns 4 rows from table B * - Then i iterate over

Django's query result caching

2014-12-01 Thread termopro
I am creating a website using Django 1.7 and GeoDjango. I've hit the point when i need to optimize website speed. One of the bottlenecks is query execution. There are some queries which run slowly even when optimized. So i'd like to cache query results and store them in Redis. The problem

Re: Constructing query

2014-12-01 Thread termopro
Thank you Collin ! It works :) On Sunday, November 30, 2014 9:09:46 PM UTC+2, Collin Anderson wrote: > > Hi, > > This might work: > > Tag.objects.filter(name__startswith='A').exclude(company=None).order_by( > 'name').all() > > Collin > > > On Friday, November 28, 2014 9:08:42 AM UTC-5, termopro

Re: Constructing query

2014-11-30 Thread Collin Anderson
Hi, This might work: Tag.objects.filter(name__startswith='A').exclude(company=None).order_by( 'name').all() Collin On Friday, November 28, 2014 9:08:42 AM UTC-5, termopro wrote: > > I have 2 models: > Companies and Tags. > > A company may have several tags associated with it, so Tag contains

Constructing query

2014-11-28 Thread termopro
I have 2 models: Companies and Tags. A company may have several tags associated with it, so Tag contains many-to-many relation to Company. If i'd like to get Tags starting with "A" i'd write: tags = Tag.objects.filter(name__startswith='A').order_by('name').all() But how do i get the list of

Re: Using Sum() for a models method inside a Query

2014-11-24 Thread monoBOT
in MyObject.objects.all()]) class MyObject(models.Model): a = models.IntegerField() b = models.Integerfield() objects = ObjectManager() 2014-11-24 11:53 GMT+00:00 Jorge Andrés Vergara Ebratt <javebr...@gmail.com> : > Thanks, the best bet is the raw query, because I actu

Re: Using Sum() for a models method inside a Query

2014-11-24 Thread Jorge Andrés Vergara Ebratt
Thanks, the best bet is the raw query, because I actually need the Sum of the method result for all the instances in the query... 2014-11-24 3:52 GMT-05:00 monoBOT <monobot.s...@gmail.com>: > You can create a model method (with no parameter) that can solve that, so > you can

Re: Using Sum() for a models method inside a Query

2014-11-24 Thread monoBOT
miOtherOpertion(self): return self.a * self.b 2014-11-24 4:21 GMT+00:00 Ethan Blackburn <ethan@ethan.coffee>: > related: https://groups.google.com/forum/#!topic/django-users/s9qgXC4TNrA > > Short answer: you can't. A raw query would be your best bet(i.e. "SELECT > SUM(a

Re: Using Sum() for a models method inside a Query

2014-11-23 Thread Ethan Blackburn
related: https://groups.google.com/forum/#!topic/django-users/s9qgXC4TNrA Short answer: you can't. A raw query would be your best bet(i.e. "SELECT SUM(a + b) AS sum FROM app_X") On Sunday, November 23, 2014 4:42:48 PM UTC-6, Jorge Andrés Vergara Ebratt wrote: > > Hello ev

Re: Using Sum() for a models method inside a Query

2014-11-23 Thread Vijay Khemlani
e it's in, but how can I get the Sum, or Avg > of that method? I tried doing Sum('getC') but I get the error because getC > isn't callable in the query... > > Thanks in advance for the help > > -- > *Jorge Andres Vergara Ebratt* > *#SoftwareDeveloper (Or at least trying to be)

Using Sum() for a models method inside a Query

2014-11-23 Thread Jorge Andrés Vergara Ebratt
in, but how can I get the Sum, or Avg of that method? I tried doing Sum('getC') but I get the error because getC isn't callable in the query... Thanks in advance for the help -- *Jorge Andres Vergara Ebratt* *#SoftwareDeveloper (Or at least trying to be)* *@javebratt* *facebook.com/javebratt <h

Re: custom query app

2014-11-14 Thread John Schmitt
hat allows the user to pick and > > choose from the various fields to create their own query. > > > > Does any precedent for this exist? > > Hi John, > > What you're looking for is called "faceted search" or "faceted > navigation". Django Haysta

Re: custom query app

2014-11-13 Thread C. Kirby
s fields to create their own query. > > Does any precedent for this exist? > > If I may use a car analogy, a django project that stores info on cars > complete with many types of engines, car models, interiors, entertainment > systems, and trim features. Could I create an app wh

Re: custom query app

2014-11-13 Thread Clifford Ilkay
On 11/13/2014 02:33 PM, John Schmitt wrote: > I have a big django project with multiple apps, models, and the models have > quite a few fields. > > A request came that asked for a page that allows the user to pick and choose > from the various fields to create their own quer

custom query app

2014-11-13 Thread John Schmitt
I have a big django project with multiple apps, models, and the models have quite a few fields. A request came that asked for a page that allows the user to pick and choose from the various fields to create their own query. Does any precedent for this exist? If I may use a car analogy

Re: Slow SQL query

2014-10-31 Thread Collin Anderson
Hi Erik, > Maybe Users doesn't belong in the Orders table? You could move the user to > a different table which stores the Order.id <-> user_id relation, which > would give a fast lookup on user_id and thus easy access to the Order.id > index. Interesting idea! I'll think about it.

Re: Django query in DetailView

2014-10-30 Thread Collin Anderson
Hello, I _think_ your code looks right to me, though the query / or_query code is confusing. Print statements could be helpful there to be sure it's actually filtering something. Does this code work? def searchcandidate(request): query_string = request.GET.get('q', '').strip

Re: "Raw query must include the primary key" when inheriting models

2014-10-30 Thread Collin Anderson
Hi Tobias, Based on your database query, it looks like you are not doing multiple table inheritance, but your models are set up for multiple table inheritance. https://docs.djangoproject.com/en/dev/topics/db/models/#model-inheritance Why not just have a status field on your Campaign model

Re: Slow SQL query

2014-10-29 Thread Erik Cederstrand
> Den 29/10/2014 kl. 18.15 skrev Collin Anderson <cmawebs...@gmail.com>: > > Right, in practice it should be less than 1000 returned rows. > > I've changed the code to run the query without the status != 4 clause, and > manually filtering that out using python, becau

Django query in DetailView

2014-10-29 Thread Ronaldo Bahia
*This question is also in http://stackoverflow.com/questions/26635406/django-query-in-detailview I have DetailVIew wich returns a list of related objects (m2m throught). It works just fine! But I need to search for objects'names and it is returning all objects instead of only the related ones

Re: Slow SQL query

2014-10-29 Thread Collin Anderson
Hi Erik, > Ok, you're not giving much of a chance to the query planner either. The > cardinality of status is 10, so status!=4 potentially means "give me 90% of > the rows". The cardinality of user_id is a mere 12, which potentially means > "give me 8% of the row

"Raw query must include the primary key" when inheriting models

2014-10-29 Thread Tobias Wolff
e(item)foritem inobj] File".../env/lib/python3.4/site-packages/rest_framework/serializers.py"in 570.self._data =[self.to_native(item)foritem inobj] File".../env/lib/python3.4/site-packages/django/db/models/query.py"in__iter__ 1553.raiseInvalidQuery('Raw query must include

Re: Slow SQL query

2014-10-27 Thread Erik Cederstrand
_order | 1 | order_order_55eb7e10 |2 | user_id > | A | 215 | NULL | NULL | YES | BTREE | > | | > +-++--+--+----+---+-+--++--+-

Re: Slow SQL query

2014-10-27 Thread Collin Anderson
Hi Erik, No luck... mysql> show indexes in order_order; +-++--+--++---+-+--++--++-+---+ | Table | Non_unique | Key_name | Seq_in_index

Re: Slow SQL query

2014-10-27 Thread Erik Cederstrand
> Den 27/10/2014 kl. 13.20 skrev Collin Anderson : > > mysql> explain SELECT COUNT(*) > -> FROM `order_order` > -> WHERE `order_order`.`status` != 4 > -> AND (`order_order`.`user_id` = 12345 OR `order_order`.`account_number` > -> = 123456); >

Re: Slow SQL query

2014-10-27 Thread Collin Anderson
mysql> explain SELECT COUNT(*) -> FROM `order_order` -> WHERE `order_order`.`status` != 4 -> AND (`order_order`.`user_id` = 12345 OR `order_order`. `account_number` -> = 123456);

Re: Slow SQL query

2014-10-24 Thread Larry Martell
On Fri, Oct 24, 2014 at 12:30 PM, Collin Anderson <cmawebs...@gmail.com> wrote: > Hi All, > > I've been trying to figure out the proper way to index my data or construct > my query so I can query orders in a reasonable amount of time. Is there a > better way to index/quer

Slow SQL query

2014-10-24 Thread Collin Anderson
Hi All, I've been trying to figure out the proper way to index my data or construct my query so I can query orders in a reasonable amount of time. Is there a better way to index/query my data? orders = Order.objects.exclude(status=Order.CART).filter(Q(user=user) | Q( account_number

Re: Django model complex query ( use table A.column1 as parameter to query result from table B)

2014-10-21 Thread Vijay Khemlani
t; Hi All, > > I have a question: how to use table A.column1 as parameter to query result > from table B? > > I have two tables : > > 1. UserStay > idcandidatePoiIdsselectedPoiId > 1101,102,103 100 > > > 2. POIs > id name

Django model complex query ( use table A.column1 as parameter to query result from table B)

2014-10-21 Thread zhang rock
Hi All, I have a question: how to use table A.column1 as parameter to query result from table B? I have two tables : 1. UserStay idcandidatePoiIdsselectedPoiId 1101,102,103 100 2. POIs id name address 100 starbuck 100 main st, 101 mcdonalds 101

Re: how to query max count

2014-10-20 Thread dk
> the_max = Choice.objects.filter(date=date) > print max(the_max) > > > > > > On Monday, October 13, 2014 6:14:28 PM UTC-5, dk wrote: > >> I need to learn how to use aggregation in django, I was thinking on >> filter by date, >> and then loop the query and make a d

Re: Django builds incorrect sql-query

2014-10-20 Thread Алексей Широков
Thank you very much Javier!!! I've thought about it. I will try. -- 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.

Re: Django builds incorrect sql-query

2014-10-20 Thread Javier Guerra Giraldez
On Mon, Oct 20, 2014 at 3:43 AM, Алексей Широков wrote: > Javier, I am unable combine 2 parameters in a single call filter(), because > It is built on different levels of code. > > Is there another solution??? you can build up a dictionary and expand as parameters on a

Re: Django builds incorrect sql-query

2014-10-20 Thread Алексей Широков
Javier, I am unable combine 2 parameters in a single call filter(), because It is built on different levels of code. Is there another solution??? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

Re: Django builds incorrect sql-query

2014-10-20 Thread Javier Guerra Giraldez
ng filter() and exclude() calls. Everything inside a single filter() call is applied simultaneously to filter out items matching all those requirements. Successive filter() calls further restrict the set of objects, but for multi-valued relations, they apply to any object linked to the primary

Django builds incorrect sql-query

2014-10-20 Thread Алексей Широков
Hi, I have 2 models: @python_2_unicode_compatible class Document(models.Model): uuid = models.CharField(max_length=32, editable=False, unique=True) contractor = models.ForeignKey(Contractor) stagcy = models.ForeignKey(StateAgency) type = models.CharField(max_length=25) year =

Re: how to query max count

2014-10-15 Thread dk
looks like it works like this the_max = Choice.objects.filter(date=date) print max(the_max) On Monday, October 13, 2014 6:14:28 PM UTC-5, dk wrote: > I need to learn how to use aggregation in django, I was thinking on > filter by date, > and then loop the query and make a d

Re: how to query max count

2014-10-13 Thread dk
I need to learn how to use aggregation in django, I was thinking on filter by date, and then loop the query and make a dictionary with the name, and += value and then use the python max function. On Monday, October 13, 2014 3:12:39 AM UTC-5, JirkaV wrote: > Hi there, > > you

Re: query join tables

2014-10-13 Thread Jani Tiainen
On Sun, 12 Oct 2014 22:01:51 -0700 (PDT) dk wrote: > I have this 2 models > > class Choice(models.Model): > restaurant = models.ForeignKey(Restaurant) > person = models.ForeignKey(Person) > date = models.DateField("time published") > time =

Re: query join tables

2014-10-13 Thread Anderson
HI there.. Looks like you already have the person ID , you don't need hit the database every time to call Person object. You can make faster only check for ID not Person object. instead this: person = Person.objects.get(name=person_name) choices_for_person_on_date =

Re: how to query max count

2014-10-13 Thread Jirka Vejrazka
;date published") > > > that way I can get the person and the restaurant. and will look like in > the attached pictures, now how can I query. > the max repeated restaurant id, for today date. > > I want to know today what restaurant won. =) (I am trying to >

Re: query join tables

2014-10-13 Thread dk
I will give a try, how does django know that have to join using double filter? or it just auto-magically knows behind the hood? or filtering by another model/class django get the idea, and joins the tables? Thanks Tom =) -- You received this message because you are subscribed to the Google

Re: query join tables

2014-10-12 Thread Tom Lockhart
On Oct 12, 2014, at 10:01 PM, dk wrote: > I have this 2 models > > class Choice(models.Model): > restaurant = models.ForeignKey(Restaurant) > person = models.ForeignKey(Person) > date = models.DateField("time published") > time = models.TimeField("date

query join tables

2014-10-12 Thread dk
I have this 2 models class Choice(models.Model): restaurant = models.ForeignKey(Restaurant) person = models.ForeignKey(Person) date = models.DateField("time published") time = models.TimeField("date published") class Person(models.Model): name =

how to query max count

2014-10-12 Thread dk
I can get the person and the restaurant. and will look like in the attached pictures, now how can I query. the max repeated restaurant id, for today date. I want to know today what restaurant won. =) (I am trying to even think on how to get this in a regular sql command) thanks guy

Re: Query s in django 1.7

2014-10-03 Thread dk
yes,that did the trick, odd that on .all does work fine, i wish the error was more descriptive. On Friday, October 3, 2014 7:52:40 AM UTC-5, Collin Anderson wrote: > > You need to call django.setup(). > > I can confirm, though, that using Model.objects.all() somehow sometimes > seems to work

Re: Query s in django 1.7

2014-10-03 Thread Collin Anderson
You need to call django.setup(). I can confirm, though, that using Model.objects.all() somehow sometimes seems to work without calling django.setup(). -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

Query s in django 1.7

2014-10-03 Thread dk
*i am trying to query base on the id of the table and i get a big error, when i do it using .all() i can get the objects* *>>> Restaurant.objects.all()* [, , , ] this works for looping and getting the information such for i in Restaurant.objects.all(): print i.id print

Re: Correctly passing parameters to raw query

2014-09-24 Thread James Brewer
Also, it is worth mentioning that the RawQuerySet object looks to have been refactored in the latest development release. I have not verified this issue on the development branch. On Wed, Sep 24, 2014 at 3:53 PM, James Brewer wrote: > This is going to depend on the version

Re: Correctly passing parameters to raw query

2014-09-24 Thread James Brewer
This is going to depend on the version of Django you're using. Accord to the docs for 1.7[1], this should work fine. After playing around in the shell for a bit, I found I was getting an error complaining about arguments not being converted during string formatting. It seems the problem occurs

Re: Correctly passing parameters to raw query

2014-09-24 Thread Collin Anderson
Interesting. I don't use raw queries, but I wonder if Django doesn't support lists as parameters to raw() -- 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

Correctly passing parameters to raw query

2014-09-24 Thread termopro
Hello, I am constructing raw query which looks like the following: "SELECT * FROM some_table WHERE id IN (1,3,5);" So inside my view i write: entities = Entity.objects.raw(""" SELECT * FROM some_table WHERE id IN (%s); """, [ids_list]) How should i corr

Re: Query parameters in the URL, with REST Framework

2014-09-09 Thread Elio Gerson Clímaco Herrera
Yes, Carlos I, have read documentation, but this don't show how put parameters in router.register like this. router.register(r'author/(?P\d+)/books', BooksList, base_name = 'Books') please, any help -- You received this message because you are subscribed to the Google Groups "Django users"

Re: Query parameters in the URL, with REST Framework

2014-09-09 Thread carlos
Hi, maybe you need read documentation about filtering http://www.django-rest-framework.org/api-guide/filtering Cheers On Mon, Sep 8, 2014 at 1:41 PM, Elio Gerson Clímaco Herrera < elioclim...@gmail.com> wrote: > Hi, everybody. > > I, stared using *REST Framework*

Query parameters in the URL, with REST Framework

2014-09-08 Thread Elio Gerson Clímaco Herrera
Hi, everybody. I, stared using *REST Framework* few days ago, but I, can't find how create a customized url with parameter, in Django this kind of url is written like this. url(r'^author/(?P\d+)/books/$', BooksList.as_view(), name = 'books'), for this

Re: Javascript loading while executing backend python query.

2014-08-05 Thread shmengie
> if ($('#loading').visible()) { //if #loading not visible show it, > prevent default, set timer to re-submit. > > it *might* actually work if you use this condition instead if($('#loading').is(':visible')) { -- You received this message because you are subscribed to the Google

Re: Javascript loading while executing backend python query.

2014-08-05 Thread shmengie
d waits for new page to be returned. Logically, what you've written makes sense, but the side effect of the current document becoming stale, defeats the logic. $(document).ready() django isn't sending the page until your query finishes executing, so you're probably left viewing the s

Re: Javascript loading while executing backend python query.

2014-08-05 Thread shmengie
On Monday, August 4, 2014 12:12:43 PM UTC-4, G Z wrote: > > > > $('#queryForm').on("submit", function () {$('#loading').show();}); > > > However it doesn't show the div tag when I click any of my buttons. > According to jquery docs; http://api.jquery.com/submit/

Re: Help needed in constructing __in query

2014-08-05 Thread Collin Anderson
AlertTable.objects.filter(pendingalertstable__in=inner_qs) Or I you could even do: AlertTable.objects.filter(pendingalertstable__id__gt=0) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Help needed in constructing __in query

2014-08-04 Thread Subodh Nijsure
'] def __unicode__(self): return str(self.id) Idea is PendingAlertsTable holds reference to alerts that have not been acknowledged. And AlertTable holds all the alerts. So I want to construct query such that I can get all entries from AlertTable that are Pending. So I constructed query

Re: Javascript loading while executing backend python query.

2014-08-04 Thread Collin Anderson
You are saying you have a div with id="loading" with the image in it that is not being shown? loading image here -- 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

Javascript loading while executing backend python query.

2014-08-04 Thread G Z
. I want to display a loading while the query is executing one of them takes upwards of a minute because it is looking through very large amounts of data. Right now I have $(document).ready(function(){ $('#loading').hide();});$('#queryForm').on("submit"

Advanced Query / Django Idiocy Question

2014-07-10 Thread G Z
Hello, I'm running a very complicated query against oracle to return some data. I'm running it manually because django can't natively do what I am doing from what I have read. I run the query but django doesn't get any values in return. I recently switched from my dev database to my production

Re: How to making a query which filtters objects having a Null field

2014-07-06 Thread Mario Gudelj
> Now I want to change make a query which filters all the objects having > Null in this field.. and changing their datetime to current datetime. The > latter part I can manage (using python code), but Is it possible to make > such queries such as modelName.objects.field(date = "")

How to making a query which filtters objects having a Null field

2014-07-06 Thread Utkarsh Dixit
I have a datetime field in my model. Initially when an object is created of this model the datetime field is set as NULL (I've defined Null=True and blank=True) Now I want to change make a query which filters all the objects having Null in this field.. and changing their datetime to current

Referencing Django List Objects From Query Question

2014-06-24 Thread G Z
How do I call django objects from a query for example licenses = Licenses.objects.all() how I get my licenses, then im trying to loop through licenses for every object from licenses that exist in a post save something to vc. if insert == 'yes': insert_data = request.POST.copy

Raw query

2014-06-16 Thread Ahmed Adam
I want to create series of tables using mysql raw query with multiple lines in django view. Please help. -- 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, sen

Re: How to execute query for multiple table using cursor in Django

2014-05-23 Thread Kelvin Wong
https://docs.djangoproject.com/en/1.6/topics/db/sql/ K On Thursday, May 22, 2014 11:31:26 PM UTC-7, swapnil srivastava wrote: > > Hi Experts, > > I just want to execute queries and subqueries in Django . > Can anybody please tell me how to use cursor for execute queries in Django > framework in

How to execute query for multiple table using cursor in Django

2014-05-23 Thread swapnil srivastava
Hi Experts, I just want to execute queries and subqueries in Django . Can anybody please tell me how to use cursor for execute queries in Django framework in views.py Thanks and Regards Swapnil -- You received this message because you are subscribed to the Google Groups "Django users"

Re: How to use DAL for this query

2014-05-18 Thread Nino Cocchiarella
aw SQL queries, so the > DAL is a little comfusing for me. But, apperantly, its the thing to do. > Anyway, come anyone point me in the right direction on how to translate > this raw query into the Django DAL -- > > SELECT * FROM rep_musicalwork, rep_composer WHERE > rep

How to use DAL for this query

2014-05-18 Thread Nino Cocchiarella
I'm working with Django... I am used to writing raw SQL queries, so the DAL is a little comfusing for me. But, apperantly, its the thing to do. Anyway, come anyone point me in the right direction on how to translate this raw query into the Django DAL -- SELECT * FROM rep_musicalwork

Re: query on models

2014-05-07 Thread Rafael E. Ferrero
I'll recommend you to read https://docs.djangoproject.com/en/dev/ref/models/querysets/ Cheers! -- Rafael E. Ferrero 2014-05-07 12:03 GMT-03:00 Anushree Jangid : > no no you are not missing anything. You got it right and I did that in > view and it worked. Actually I

Re: query on models

2014-05-07 Thread Anushree Jangid
no no you are not missing anything. You got it right and I did that in view and it worked. Actually I am new to Django. Thanks a lot. On Wed, May 7, 2014 at 8:28 PM, Rafael E. Ferrero wrote: > You are using Ques for related Subject and QuestionBank... just make a >

Re: query on models

2014-05-07 Thread Rafael E. Ferrero
You are using Ques for related Subject and QuestionBank... just make a method in Ques class who filter the Ques model with some subject parameter or do it in your view like: qs = Ques.objects.select_related().filter(subject='some_name') I'm missing something really big? or i miss understud

Re: query on models

2014-05-07 Thread Anushree Jangid
No I start with subject model. There I have created subjects like General knowledge, English etc. ​Then I create question banks Like for General knowledge I have created GK1, GK2 and GK3 . Then when I enter a ques in the Ques model there I specify that the question is related to which subject and

Re: query on models

2014-05-07 Thread Davide Scatto
Do you start from Ques model? What are your starting data? Il giorno mercoledì 7 maggio 2014 15:24:38 UTC+2, Anushree ha scritto: > > 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

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