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

2013-09-24 Thread Arthur Silva
Here're my models class PingUser(AbstractUser): friends = models.ManyToManyField("self", through="Friendship", symmetrical=False) class Friendship(TimestampedModel, SerializeMixin): STATUS_CHOICES = ( ("pending", "Pending"), ("friend", "Friend

Re: How to share model/data cross django project

2013-09-24 Thread Dig
Hi, Please let me repeat my question shortly, I want to access the same database from 2 different django project/app. Can anyone help me? Thanks. Regards, Dig On Sep 20, 2013 9:13 PM, "Dig" wrote: > Hi, > > There are about 20 views in a django project (with a django app). > Recently, a new

Re: How to share model/data cross django project

2013-09-24 Thread Rafael E. Ferrero
What trouble cause to you settings the same database in two differents projects (mean configure the same database in two diferentes settings.py)?? im curious because i never need do that and think its usefull to know. Cheers, 2013/9/24 Dig > Hi, > > Please let me repeat my question shortly,

Re: How to share model/data cross django project

2013-09-24 Thread François Schiettecatte
Sure, just have the DATABASES entry in the settings.py files point to the same server/database, or to the same server and different databases. François On Sep 24, 2013, at 10:12 AM, Dig wrote: > Hi, > > Please let me repeat my question shortly, I want to access the same > database from 2 d

Re: How to share model/data cross django project

2013-09-24 Thread Dig
Hi, Thanks for your reply. I want to separate internal user and external user. External user can use a http connection to see a few pages. (http only) Internal user use a https connection to do some staff only operations. (https only) This site are deployed on AWS, and we want to leverage Securit

Re: How to share model/data cross django project

2013-09-24 Thread Rafael E. Ferrero
seems to me that you can setup the same database in the two settings.py of your two projects. 2013/9/24 Dig > Hi, > > Thanks for your reply. > I want to separate internal user and external user. > External user can use a http connection to see a few pages. (http only) > Internal user use a h

Re: How to share model/data cross django project

2013-09-24 Thread Frank Bieniek
Hi Dig, you want to have different permissions actions depending on the user, that accesses the data, but it is the the same data - correct? if so you are speaking about one app not two. One App, as it is the same data, but different views, related to the context you are accessing it. Do you

Re: How to share model/data cross django project

2013-09-24 Thread Dig
Hi, And how about models.py? Makes a copy? Thanks. Regards, Dig Regards, Dig Ge On Tue, Sep 24, 2013 at 11:51 PM, Rafael E. Ferrero < rafael.ferr...@gmail.com> wrote: > seems to me that you can setup the same database in the two settings.py of > your two projects. > > > > > 2013/9/24 Dig

Django Templates: Using the "with" statement and "block.super" together

2013-09-24 Thread Warren Smith
On occasion, I've used the following technique in my django templates: # parent.html {% block someblock %} …stuff… {% if cool_optional_feature_is_enabled %} …optional stuff... {% endif %} …stuff... {% endblock %} # child.html {% extends "parent.html" %} {% block someblock %} {% with

Re: Django Templates: Using the "with" statement and "block.super" together

2013-09-24 Thread Bill Freeman
This sounds safe to me. After all, we pass context variables in from views and expect them to be available within block.super code. Perhaps some folks aren't sufficiently clear as to when stuff in a template is evaluated. So, I'd do it if I needed it. On Tue, Sep 24, 2013 at 1:59 PM, Warren Sm

Re: Django Templates: Using the "with" statement and "block.super" together

2013-09-24 Thread Tomas Ehrlich
I use it too. Maybe it would be nice to document it somewhere. Cheers, Tom Dne Tue, 24 Sep 2013 10:59:27 -0700 (PDT) Warren Smith napsal(a): > On occasion, I've used the following technique in my django templates: > > # parent.html > > {% block someblock %} > …stuff… > {% if cool_opti

Aggregation and count - only counting certain related models? (i.e. adding a filter on the count)

2013-09-24 Thread Victor Hooi
Hi, I'm trying to use aggregation to count the number of "likes" on an item. The likes for an item are stored in a related model, called LikeStatus: class Item(models.Model): > ... > class ItemLikeStatus(models.Model): > LIKE_STATUS_CHOICES = ( > ('L', 'Liked'), > ('U', 'Unli

Restrict access to user-uploaded files to authorized users

2013-09-24 Thread J Y
I am buliding a tool that needs to have the ability to allow user to upload a file, and the file should only be accessible by the user who uploaded it. It seems that the MEDIA_ROOT directory must be placed in the public www directory for front end web servers Apache to serve the file, which cu

Re: Aggregation and count - only counting certain related models? (i.e. adding a filter on the count)

2013-09-24 Thread Simon Charette
Unfortunately the Django ORM's doesn't support conditionnal aggregates . Le mardi 24 septembre 2013 16:50:51 UTC-4, Victor Hooi a écrit : > > Hi, > > I'm trying to use aggregation to count the number of "likes" on an item. > > The likes for an item are

Re: Aggregation and count - only counting certain related models? (i.e. adding a filter on the count)

2013-09-24 Thread Simon Charette
Unfortunately the Django ORM's doesn't support conditionnal aggregates . Le mardi 24 septembre 2013 16:50:51 UTC-4, Victor Hooi a écrit : > > Hi, > > I'm trying to use aggregation to count the number of "likes" on an item. > > The likes for an item are

Re: Restrict access to user-uploaded files to authorized users

2013-09-24 Thread Simon Charette
I'm not aware of any solution except serving from Django if you can't install Apache plugins. If you're really stuck with serving large files from Django I'd recommend you streamthe content of the fi

Re: Django Templates: Using the "with" statement and "block.super" together

2013-09-24 Thread Vijay Katam
Seems legit to me. Some documentation could help get more usage. On Tuesday, September 24, 2013 12:59:27 PM UTC-5, Warren Smith wrote: > > On occasion, I've used the following technique in my django templates: > > # parent.html > > {% block someblock %} > …stuff… > {% if cool_optional_feature_i

Re: Restrict access to user-uploaded files to authorized users

2013-09-24 Thread m1chael
mod_xsendfile for apache has worked for me, don't know if it will work for you On Tue, Sep 24, 2013 at 5:08 PM, Simon Charette wrote: > I'm not aware of any solution except serving from Django if you can't > install Apache plugins. > > If you're really stuck with serving large files from Django I

Re: How to share model/data cross django project

2013-09-24 Thread Dig
Hi Frank, Thank you for your reply. I can implement this feature in app layer, but I won't do it to waste CPU. It can be done in IP firewall, so I prefer laverge it. Regards, Dig On Sep 25, 2013 12:21 AM, "Frank Bieniek" wrote: > Hi Dig, > you want to have different permissions actions depen

Re: Django Templates: Using the "with" statement and "block.super" together

2013-09-24 Thread Russell Keith-Magee
On Wed, Sep 25, 2013 at 1:59 AM, Warren Smith wrote: > On occasion, I've used the following technique in my django templates: > > # parent.html > > {% block someblock %} > …stuff… > {% if cool_optional_feature_is_enabled %} > …optional stuff... > {% endif %} > …stuff... > {% endblock %} >