(Newbie) Stuck with annotate() docs

2016-04-26 Thread Ankush Thakur
Folks, I'm having exceptional trouble understanding annotate(), aggregate(), and their various combinations. I'm currently stuck here: https://docs.djangoproject.com/en/1.9/topics/db/aggregation/#combining-multiple-aggregations The example here uses Book.objects.first().chapters.count(), but th

Re: (Newbie) Stuck with annotate() docs

2016-04-27 Thread Ankush Thakur
quot;Book.objects.first().chapters"? > > On Tuesday, April 26, 2016 at 12:50:31 PM UTC-4, Ankush Thakur wrote: >> >> Folks, I'm having exceptional trouble understanding annotate(), >> aggregate(), and their various combinations. I'm currently stuck here:

Re: (Newbie) Stuck with annotate() docs

2016-04-28 Thread Ankush Thakur
10:45:03 AM UTC-4, Ankush Thakur wrote: >> >> I'm not sure how Book.objects.first().chapters is different >> from Book.objects.first().chapters.count(), but the point is that >> "chapters" is not defined in the models at the top of that page! The >>

1.8 or 1.9?

2016-05-12 Thread Ankush Thakur
oing to be that significant, but later on when I recreate the project myself in 1.9, I wouldn't want to tear out my hair solving weird error messages. Any wise words? Regards, Ankush Thakur -- You received this message because you are subscribed to the Google Groups "Django users&qu

Re: 1.8 or 1.9?

2016-05-14 Thread Ankush Thakur
Thank you, Florian! :-) Indeed, stability and job market are what's on my mind. It's comforting to know what I can stick to LTS versions and be assured of (almost 100%) stability. Just another minor concern: What if, say, the other minor upgrade rolls out a really cool feature that takes out a

Re: 1.8 or 1.9?

2016-05-14 Thread Ankush Thakur
uld do the Django > tutorial of Django website before, step by step. > > On Thursday, May 12, 2016 at 8:55:15 AM UTC-7, Ankush Thakur wrote: > >> I want to take a Udemy course on Django because it shows how to make an >> e-commerce website. The only catch - it follows Dja

A question on save_m2m()

2016-05-14 Thread Ankush Thakur
= I can understand why Django doesn't save Many-to-Many data when commit is set to False, but why do we need to manually call save_m2m() after doing save() manually? Why doesn't Django update the associated Many-to-Many data automatically in this case? Regards, Ankush Thakur -- You

Django get_prep_value giving headache

2016-05-17 Thread Ankush Thakur
an idiot and didn't realize I was supposed to enter a value for the primary key. Now, however, when I run my tests, I get a long traceback which ends in: ValueError: invalid literal for int() with base 10: 'Programming' How can I undo this sin? Regards, Ankush Thakur -- You re

Re: A question on save_m2m()

2016-05-18 Thread Ankush Thakur
Ah! Stupid, stupid me. Thanks a lot for clarifying! :-) Best, Ankush On Wednesday, May 18, 2016 at 12:15:57 PM UTC+5:30, James Schneider wrote: > > > > On Sat, May 14, 2016 at 2:42 AM, Ankush Thakur > wrote: > >> So the following section from the docs

Django websites for study and improvement

2016-05-31 Thread Ankush Thakur
d. I can choose to study the django.contrib apps, but my focus is not on diving into Django's internals right now. Any recommendations? Regards, Ankush Thakur -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from

Why are models must for permissions?

2016-06-01 Thread Ankush Thakur
Why are all permissions linked to a model? I'm just learning the basics of permissions and wanted to set up a quick example where I wanted to have a single user who belongs to a group that has permission to access restricted content, let's say. So far I have created a group and added the user t

Re: Django websites for study and improvement

2016-06-08 Thread Ankush Thakur
I feel I don't know anything about how Django is used out in the wild. >> >> I can choose to study the django.contrib apps, but my focus is not on >> diving into Django's internals right now. >> >> Any recommendations? >> >> Regards, >> Ank

Re: Django websites for study and improvement

2016-06-08 Thread Ankush Thakur
o internals.. this might be > helpful > > http://ccbv.co.uk/ > > > > On Tuesday, 31 May 2016 23:26:39 UTC+5:30, Ankush Thakur wrote: >> >> Are there any large-ish (I mean, beyond blogs, polls, etc.) websites (web >> apps?) out there that are open source and can help

Adding Tinymce to Admin

2016-06-08 Thread Ankush Thakur
ce at the back of my head tells me that I won't need to alter Admin, but I'm not sure. Because I don't have any forms (I directly edit/create from the Admin), I don't think I can get away with only saying something like 'content = models.TextField(widget='tinymce')&#

Quick-render an object in generic CBV

2016-06-09 Thread Ankush Thakur
object the way we do with model forms? I mean, is there some way I can say something like 'object.as_table()'? I thought of using FormView as a substitute for this, but that requires data to be present in POST, and forcibly populating POST seems like a bad idea. Any thoughts? Regards, An

Re: Adding Tinymce to Admin

2016-06-09 Thread Ankush Thakur
in for each model > and field. > > Part 7 of the tutorial will show you how to alter the admin without > changing the file in the virtualenv. > The documentation on ModelAdmin have an example of what you are trying to > do :) > > +33614874342 > On 8 Jun 2016 6:56 p.m.,

Re: Adding Tinymce to Admin

2016-06-09 Thread Ankush Thakur
Nope. And you know why, coz I'm an idiot! :P Will try this and post here if I run into problems. Thanks a ton! ~~Ankush On Thursday, June 9, 2016 at 5:15:52 PM UTC+5:30, jorr...@gmail.com wrote: > > Have you looked at https://github.com/aljosa/django-tinymce ? > -- You received this message be

Confused about this aggregation example from the docs

2016-06-25 Thread Ankush Thakur
books = models.ManyToManyField(Book) registered_users = models.PositiveIntegerField() My question is: How come something like "Publisher.objects.annotate(num_books=Count('book'))" work? The name "book" is not defined as a reverse relationship (I think it sh

Serving static files

2016-06-27 Thread Ankush Thakur
to a halt, even though the same framework can happily serve thousands of requests per hour? Regards, Ankush Thakur -- 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 e

Re: Serving static files

2016-06-28 Thread Ankush Thakur
ver > serving static file directly would be an order of magnitude faster. > > https://unix4lyfe.org/time/hn.html is a nice article on how server > react to heavy load when serving static file. > > 2016-06-27 18:26 GMT+02:00 Ankush Thakur >: > > I keep hearing in the docs an

Re: Serving static files

2016-06-28 Thread Ankush Thakur
Hmmm. One argument I read supporting separate servers is that it would save the main server a few socket connections. But this appears to be too little of a gain. The approach of using a CDN, I think, is much more sensible. Thanks once again, Tim! Regards, Ankush Thakur On Wed, Jun 29, 2016 at

Question about model attributes

2016-07-03 Thread Ankush Thakur
ething real-world, I thought of tossing the question here. Regards, Ankush Thakur -- 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..

Re: Confused about this aggregation example from the docs

2016-07-07 Thread Ankush Thakur
; class Book(models.Model): > publisher = models.ForeignKey(Publisher, on_delete=models.CASCADE) > > > https://docs.djangoproject.com/en/stable/ref/models/fields/#django.db.models.ForeignKey.related_name > > On Saturday, June 25, 2016 at 10:11:44 AM UTC-4, Ankush Thakur wrote: >&g

Unable to set up celery in supervisord

2016-07-21 Thread Ankush Thakur
​I'm trying to set up celery as a supervisord job (for my Django project) and getting an error. Most likely it's because of wrong import paths (or some other environment setting), but I have no idea what. Please help! Here's my directory structure ('>' means down one level): /home/ankush/jremind

Re: Unable to set up celery in supervisord

2016-07-22 Thread Ankush Thakur
Well, setting up the line this way gives me the following error: Starting supervisor: Error: Format string 'PYTHONPATH=/home/ankush/jremind/jremind,JREMIND_SECRET_KEY="SDFDSF@$%#$%$#TWFDFGFG%^$%ewrw$#%TFRETERTERT$^",JREMIND_DATABASE="jremind",JREMIND_USERNAME="root",JREMIND_PASSWORD="root"' for

Re: Unable to set up celery in supervisord

2016-07-22 Thread Ankush Thakur
Wooohooo! That did it. Many thanks! :-) :-) :-) Umm, but, say, isn't kind of clunky, that I have to copy all the variables over to the supervisor config? Isn't there a neater way to do it? Regards, Ankush Thakur On Fri, Jul 22, 2016 at 10:21 PM, George Silva wrote: > The secret

Re: Unable to set up celery in supervisord

2016-07-22 Thread Ankush Thakur
/celery/blob/3.1/extra/supervisord/celeryd.conf, there's no mention of environment variables. Regards, Ankush Thakur On Fri, Jul 22, 2016 at 10:34 PM, George Silva wrote: > Check the docs. There's plenty of information regarding this. > > It's probably a bad formatted ch

Re: Unable to set up celery in supervisord

2016-07-22 Thread Ankush Thakur
Yes, I guess that's good enough. Thanks for helping out! :-) Regards, Ankush Thakur On Fri, Jul 22, 2016 at 10:54 PM, George Silva wrote: > I'm familiar with the two ways I've explained to you. I'm not sure if > there are others. > > Actually, it's a sing

Flattening model relationships (in APIs)

2017-02-21 Thread Ankush Thakur
t;code": "DEL", "state": { "id": 1, "name": "Delhi", "code": "DEL", "country": { "id": 1, "name": "India",

Re: Flattening model relationships (in APIs)

2017-02-23 Thread Ankush Thakur
Also, I don't have any need of providing several types of addresses as of now. For now I'm just sticking with outputting everything when the address is requested. ~~ Ankush On Thursday, February 23, 2017 at 9:13:01 PM UTC+5:30, Ankush Thakur wrote: > > Hey Mike, > > Th

Re: Flattening model relationships (in APIs)

2017-02-23 Thread Ankush Thakur
ink it is always best to normalize as much as possible in the > beginning and de-normalize only if performance becomes an issue. > > Also ... > > > https://hackernoon.com/10-things-i-learned-making-the-fastest-site-in-the-world-18a0e1cdf4a7#.3l8n34dvk > > > Mike &g

Re: Flattening model relationships (in APIs)

2017-02-27 Thread Ankush Thakur
ion? That's where I have no answers. Would it be possible for you to point me towards some article that does that? Thanks in advance! Regards, Ankush On Monday, February 27, 2017 at 3:41:49 AM UTC+5:30, marcin@gmail.com wrote: > > > > On Tuesday, February 21, 2017 at

Re: Flattening model relationships (in APIs)

2017-02-27 Thread Ankush Thakur
Hmmm. That's not an answer I wanted to hear, really, but I like it. I'm myself finding DRF too restrictive once you are past the effort-saving magic. Thank you. I might give it up as it's still early days in the project. Regards, Ankush Thakur On Mon, Feb 27, 2017 at 7:43 PM, wr

Re: Flattening model relationships (in APIs)

2017-02-27 Thread Ankush Thakur
I guess this is the library in question: https://github.com/marcinn/restosaur (took some effort to find it!). Thanks, if I decide to stick with the API-first approach, I'll use it. Either way, I've bookmarked it for future use. :-) Regards, Ankush Thakur On Mon, Feb 27, 2017 at 7:53