Re: annotate count with some condition

2013-04-11 Thread anothergituser
Sorry for the fake links, i don't know why it happend. -- 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

annotate count with some condition

2013-04-11 Thread anothergituser
Hi, I ran in this today. Say i have these two models in my app called atest class Person(models.Model): name = models.CharField(max_length=255) age = models.IntegerField(null=True) class Car(models.Model): owner = models.ForeignKey('Person', related_name='cars') brand =

Re: annotate count with condition

2013-04-11 Thread anothergituser
Sorry for all the fake links i don't know why it happend -- 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

annotate count with condition

2013-04-11 Thread anothergituser
Hi, I ran in this today. Say i have these two models in my app called atest class Person(models.Model): name = models.CharField(max_length=255) age = models.IntegerField(null=True) class Car(models.Model): owner = models.ForeignKey('Person', related_name='cars') brand =

Re: Need Advice: Sending Emails

2013-04-11 Thread Sergiy Khohlov
this is expected behavior. SMTP server should blocks attempt to send email from nonauth client. In other case it is open relay. Many thanks, Serge +380 636150445 skype: skhohlov On Thu, Apr 11, 2013 at 9:37 PM, Venkatraman S wrote: > > Am sure many in this mailing

Re: Static Files on IIS install

2013-04-11 Thread Mark Lybrand
I will read those links as soon as I get a chance. As for the particulars: Errors: "NetworkError: 404 NOT FOUND - http://localhost:8001/static/admin/css/base.css; "NetworkError: 404 NOT FOUND - http://localhost:8001/static/admin/css/dashboard.css; OS: Windows 7 Web server: IIS 7 with FastCGI

Re: Static Files on IIS install

2013-04-11 Thread Mike Dewhirst
On 12/04/2013 12:56pm, Mark Lybrand wrote: I have managed to get a Django app installed on IIS7. It is not finding the static files for the admin section. Can someone give me some pointers on the steps I need to take to get static files to work in general,

Re: m2m symmetry confusion

2013-04-11 Thread Lachlan Musicman
On 12 April 2013 10:47, Matt Schinckel wrote: > > But a partner relationship is not at all related to a parent-child > relationship. Ah! But if you look at my original spec, I had the desire to track partners - I know it's not part of the parent-child relationship, but I did

Static Files on IIS install

2013-04-11 Thread Mark Lybrand
I have managed to get a Django app installed on IIS7. It is not finding the static files for the admin section. Can someone give me some pointers on the steps I need to take to get static files to work in general, as well as specifically how to make my Django app pull the appropriate static

Newbie CSRF protection questions

2013-04-11 Thread testbackupacct
Hi, I'm fairly new to web development and Django, and I'm trying to make sure my application is protected against CSRF attacks. I've read through https://docs.djangoproject.com/en/dev/ref/contrib/csrf/, but I'm not confident I'm understanding it fully. I'd be very grateful for some

Re: m2m symmetry confusion

2013-04-11 Thread Mike Dewhirst
Conceptually all there is in families is people objects and relationship objects. Therefore, you really only need two tables being person and relationship. This could be satisfied with relationship being the 'through' table for person having m2m('self'). You would probably need a clean()

Re: m2m symmetry confusion

2013-04-11 Thread Matt Schinckel
On Friday, April 12, 2013 9:52:10 AM UTC+9:30, Lachlan Musicman wrote: > > On 12 April 2013 08:43, Dennis Lee Bieber > wrote: > > On Thu, 11 Apr 2013 16:41:37 +1000, Lachlan Musicman > > > > > declaimed the following in gmane.comp.python.django.user:

Re: Newbie using reverse() function

2013-04-11 Thread Joey Espinosa
Since you're a "reverse" newbie, I'll also mention that you can pass url variables when you call it. Given this url: url(r'^books/(?P\d+)/details/', 'detail_view', name='books_detail_view') You would call reverse like this (assume that you already have the desired book in a variable called

Re: make_template_fragment_key is in what version?

2013-04-11 Thread Scott Anderson
Derp, my fault, thanks. I don't know how I missed that. Odd that that was the page that showed up first in the search results too. Regards, -scott On Apr 11, 2013, at 8:24 PM, James Bennett wrote: > Notice that your URL marks the version of Django as 'dev' -- that means it's > the

Re: make_template_fragment_key is in what version?

2013-04-11 Thread James Bennett
Notice that your URL marks the version of Django as 'dev' -- that means it's the documentation for the next, and as-yet-unreleased, version of Django, which will be 1.6. For the documentation for 1.5, change 'dev' in the URL to '1.5' (which is also what will happen when you click the

Re: m2m symmetry confusion

2013-04-11 Thread Lachlan Musicman
On 12 April 2013 08:43, Dennis Lee Bieber wrote: > On Thu, 11 Apr 2013 16:41:37 +1000, Lachlan Musicman > declaimed the following in gmane.comp.python.django.user: > >> # Relations >> parents = models.ManyToManyField("self", related_name='p', >>

make_template_fragment_key is in what version?

2013-04-11 Thread Scott Anderson
Hello all, The public current version cache docs reference make_template_cache_key: https://docs.djangoproject.com/en/dev/topics/cache/ django.core.cache.utils.make_template_fragment_key(fragment_name, vary_on=None) If you want to obtain the cache key used for a cached fragment, you can use

Re: easy-thumbnails

2013-04-11 Thread anothergituser
Did you try entity.photo.url ? Assuming that entity is a model and photo is a fileobject like field. On Friday, April 5, 2013 8:20:11 PM UTC+2, knowledge_seeker wrote: > > I am trying to learn to use easy-thumbnails, which is necessary for > Userena. Now, in the easy-thumbnails 'ReadMe' file it

Re: Newbie using reverse() function

2013-04-11 Thread Nick D
Joe, Thanks for looking into it. The app isn't actually doing anything yet. Eventually I'll have the submit do some work and redirect to a more useful page. Thanks again for your help. On Thursday, April 11, 2013 4:44:18 PM UTC-7, JoeLinux wrote: > Keep in mind that your "p" variable won't

Re: Newbie using reverse() function

2013-04-11 Thread Joey Espinosa
Keep in mind that your "p" variable won't be available to your index view on a redirect, so I'm just working on the assumption that you just posted a small code snippet and you're actually doing something with it beforehand. -- Joey Espinosa Python Developer http://about.me/joelinux On Apr 11,

Re: Newbie using reverse() function

2013-04-11 Thread Nick D
I got it, thanks Joe! url(r'^$', 'index', name='gis_wo_index'), return HttpResponseRedirect(reverse('gis_wo_index')) On Thursday, April 11, 2013 4:31:26 PM UTC-7, Nick D wrote: > I'm trying to use the reverse() function to get back to my index, but I'm > not sure if my view are

Re: Newbie using reverse() function

2013-04-11 Thread Nick D
Here's my urlconf for the index: url(r'^$', 'index'), So how should I call it in the reverse function? If I try the reverse function without the args I get the following error: Reverse for 'gis_wo_app.views.index' with arguments '()' and keyword arguments '{}' not found. On Thursday, April 11,

Re: Newbie using reverse() function

2013-04-11 Thread Nikolas Stevenson-Molnar
Hi Nick, The request object is always sent to a view, so from the perspective of "reverse", index has no args. Try removing the args= part of the reverse call and see if it works. _Nik On 4/11/2013 4:31 PM, Nick D wrote: > I'm trying to use the reverse() function to get back to my index, but >

Re: Newbie using reverse() function

2013-04-11 Thread Joey Espinosa
If you have your index page as a named url in your urls.py: url(r'^$', 'index', name='app_index') Then you can call HttpResponseRedirect as follows: return HttpResponseRedirect(reverse('app_index')) No need to directly specify the request object... it will definitely be available to your index

Newbie using reverse() function

2013-04-11 Thread Nick D
I'm trying to use the reverse() function to get back to my index, but I'm not sure if my view are compatible. My index funtion takes a request ( def index(request)). I can't seem to call the reverse function with the request object in the args, but if I call the reverse function without any

Re: Django 1.5 not disconnecting from database after a request

2013-04-11 Thread Lewis Sobotkiewicz
Fixed now. See https://groups.google.com/forum/?fromgroups=#!topic/django-users/FxTD5M0x-G8 for the resolution, if anyone runs into the same thing. On Wednesday, April 10, 2013 5:04:58 PM UTC-7, Lewis Sobotkiewicz wrote: > > Seems to be caused by Django not sending the "request_finished"

Re: request_finished signal not being called with Django 1.5.1 with uwsgi

2013-04-11 Thread Lewis Sobotkiewicz
So figured it out. Apparently Ubuntu 12.04 packages uwsgi 1.0.3 in their apt repository, which doesn't support calling close() on the WSGI application object returned by Django. I had installed that uWsgi version, then installed a more up-to-date version with pip. ie. pip install uwsgi==1.4.4

Re: Status of Django with Python 3.x

2013-04-11 Thread Russell Keith-Magee
On Thu, Apr 11, 2013 at 9:36 PM, Mark Lybrand wrote: > I understand that there is only experimental support for Python 3.x in > Django 1.5. Is there any feeling for how far out a stable version of > Django using Python 3.x might be? I understand that any answer is likely >

Re: WSGIPythonPath and

2013-04-11 Thread Nikolas Stevenson-Molnar
Another direction might be to run a separate WSGI HTTP server (like gunicorn) and proxy to it from Apache. Saves the hassle of messing around with mod_wsgi. _Nik On 4/11/2013 3:20 PM, Joey Espinosa wrote: > > I had basically the same issue as you. > > With only one Django app deployed, it's easy

Re: WSGIPythonPath and

2013-04-11 Thread Joey Espinosa
I had basically the same issue as you. With only one Django app deployed, it's easy to just stick your WSGIPythonPath directive in /etc/apache2/apache.conf. But with multiple different virtualenvs, you need to do something like this:

Re: sql union all to def()

2013-04-11 Thread Rafael E. Ferrero
Tommy, an store procedure its a piece of sql code that its executed by the data base server (take a look here http://www.postgresql.org/docs/8.0/static/plpgsql.html), so you execute that procedure from django with a raw sql statement. Im not familiar with postgresql but in firebird you can do:

Re: WSGIPythonPath and

2013-04-11 Thread Roberto López López
Hi Joey, All of them are in different virtualenvs. On 04/11/2013 11:02 PM, Joey Espinosa wrote: > > I meant Python libs/binary. > > -- > Joey "JoeLinux" Espinosa > Python Developer > http://about.me/joelinux > > On Apr 11, 2013 5:00 PM, "Joey Espinosa"

Re: WSGIPythonPath and

2013-04-11 Thread Joey Espinosa
I meant Python libs/binary. -- Joey "JoeLinux" Espinosa Python Developer http://about.me/joelinux On Apr 11, 2013 5:00 PM, "Joey Espinosa" wrote: > Do all your sites share the same Python, or are they in different > virtualenvs? > > -- > Joey "JoeLinux" Espinosa >

Re: WSGIPythonPath and

2013-04-11 Thread Joey Espinosa
Do all your sites share the same Python, or are they in different virtualenvs? -- Joey "JoeLinux" Espinosa Python Developer http://about.me/joelinux On Apr 11, 2013 3:39 PM, "Roberto López López" wrote: > > Hi everyone, > > We are trying to deploy a django application on

WSGIPythonPath and

2013-04-11 Thread Roberto López López
Hi everyone, We are trying to deploy a django application on our apache server (mod_wsgi) following https://docs.djangoproject.com/en/1.4/howto/deployment/wsgi/modwsgi/ We have different virtualhosts defined as well in httpd.conf. We are now stuck, apache is throwing the following error:

Re: Circular import problem

2013-04-11 Thread Nikolas Stevenson-Molnar
Circular import itself isn't a problem--Python will deal with that. Problems arise according to the order in which classes, etc. are loaded from each module and where the required classes are used. As the previous poster mentioned, you can get around this by moving one of the import statements

Need Advice: Sending Emails

2013-04-11 Thread Venkatraman S
Am sure many in this mailing list are running websites that send emails to customers from their django applications. And also emails from the operating system(like logwatch etc). I was wondering how you do you achieve both? For example, when i use a gmail id, i see that i am able to send an

Re: Circular import problem

2013-04-11 Thread andres . osinski
You should always consider that circular imports may indicate problems with how you structured your applications and/or models, however, if you're left with no choice, you can have an import statement inside a function, which generally solves most of these issues. Enviado desde mi BlackBerry de

Re: sql union all to def()

2013-04-11 Thread Tommy
Hi Rafael, Thank you for the reply. Not too sure if I undersatnd all of it, though. My learning curve is more down than up. You mentioned a possibly better process "using the store procedure". Do you know of any examples of what you have in mind, perhaps? I have not found a function in

Circular import problem

2013-04-11 Thread bubufff
Hi all, I have a util file, which will do some stuffs and then, update a model (so i have to import the models in this file). Also, in my models file, I trigger a post_save signal to call the util file file (so I have to import this file in the models file). Obviously, I will get a circle

Re: django-campaign - how to filter by group?

2013-04-11 Thread frocco
Thank you... On Thursday, April 11, 2013 8:50:06 AM UTC-4, arne^ wrote: > > Hi frocco, > > this filter condition works for me: > > { > "groups__name": "A", > "is_active": true > } > > "A" is the name of the Group. This filter selects all actives users that > are also member of the "A" group

Re: Status of Django with Python 3.x

2013-04-11 Thread Avraham Serour
I believe pillow supports python 3, you can use it as a drop in replacement of PIL On Thu, Apr 11, 2013 at 6:21 PM, Timothy Makobu wrote: > From the release notes > https://docs.djangoproject.com/en/dev/releases/1.5/"Django > 1.6, will support Python 3 without

Re: ManyToMany relationship and raw sql queries

2013-04-11 Thread Tom Evans
On Thu, Apr 11, 2013 at 3:42 PM, Matthieu Bouron wrote: > Hello, > > Is there a way to handle many-to-many relationship with raw sql queries ? > I have the following model: > > from django.db import models > > class Tag(models.Model): > name =

ManyToMany relationship and raw sql queries

2013-04-11 Thread Matthieu Bouron
Hello, Is there a way to handle many-to-many relationship with raw sql queries ? I have the following model: from django.db import models class Tag(models.Model): name = models.CharField(max_length=512, unique=True) class Bookmark(models.Model): link = models.CharField(max_length=512)

Re: Status of Django with Python 3.x

2013-04-11 Thread Timothy Makobu
>From the release notes https://docs.djangoproject.com/en/dev/releases/1.5/ "Django 1.6, will support Python 3 without reservations." And from the release-process https://docs.djangoproject.com/en/1.2/internals/release-process/ "Minor release (1.1, 1.2, etc.) will happen roughly every nine

Re: Status of Django with Python 3.x

2013-04-11 Thread Thomas Weholt
I develop my current project with python 2.7 and 3.3 and so far my problem is not with django being 3.x compatible but critical/popular third-party packages like PIL, django-debug-toolbar etc not being python 3 ready. I hope those and several other packages will be ported to python 3, since Python

Re: Serving files in production

2013-04-11 Thread Drew Ferguson
Thanks guys, everything is much clearer now And there is even a HOW-TO page https://docs.djangoproject.com/en/1.5/howto/static-files/deployment/ that I also missed as well Cool beans this Django malarky :) On Thu, 11 Apr 2013 14:08:29 +0100 Tom Evans wrote: > On

Status of Django with Python 3.x

2013-04-11 Thread Mark Lybrand
I understand that there is only experimental support for Python 3.x in Django 1.5. Is there any feeling for how far out a stable version of Django using Python 3.x might be? I understand that any answer is likely to be conjecture and guessing and that is okay. I am just trying to gauge if I am

Re: Custom Commands?

2013-04-11 Thread Mark Lybrand
Thanks. I appreciate the glimpse into how another developer organizes their application. This will help me decide what I think might work for my needs. On Thu, Apr 11, 2013 at 5:44 AM, Tom Evans wrote: > On Thu, Apr 11, 2013 at 1:22 PM, Mark Lybrand

Re: Serving files in production

2013-04-11 Thread Tom Evans
On Thu, Apr 11, 2013 at 1:50 PM, Drew Ferguson wrote: > On Thu, 11 Apr 2013 14:54:50 +0300 > Avraham Serour wrote: > >> you can create a subdomain (static.yourdomain.com) and serve static using >> that, configure the second webserver to serve this

Re: Serving files in production

2013-04-11 Thread Drew Ferguson
On Thu, 11 Apr 2013 14:54:50 +0300 Avraham Serour wrote: > you can create a subdomain (static.yourdomain.com) and serve static using > that, configure the second webserver to serve this subdomain OK, but then all static references must be prefixed with the domain in

Re: django-campaign - how to filter by group?

2013-04-11 Thread arne^
Hi frocco, this filter condition works for me: { "groups__name": "A", "is_active": true } "A" is the name of the Group. This filter selects all actives users that are also member of the "A" group as recipients. -Arne Am Sonntag, 7. April 2013 14:49:23 UTC+2 schrieb frocco: > > Hello, > >

Re: Custom Commands?

2013-04-11 Thread Tom Evans
On Thu, Apr 11, 2013 at 1:22 PM, Mark Lybrand wrote: > Sorry about that, here is the tuple in question: > > INSTALLED_APPS = ( > 'django.contrib.auth', > 'django.contrib.contenttypes', > 'django.contrib.sessions', > 'django.contrib.sites', >

Re: Custom Commands?

2013-04-11 Thread Mark Lybrand
Sorry about that, here is the tuple in question: INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', # Uncomment the next line to enable the

Re: Custom Commands?

2013-04-11 Thread Tom Evans
On Thu, Apr 11, 2013 at 12:41 PM, Mark Lybrand wrote: > So, you have a management/commands structure in each app of your project and > not in the main "app" (or whatever that thing is called). Here is the > structure of my whole project thus far (I had just shown the part

form in admin to allow upload file from local machine OR upload file from local filesystem OR upload file from url - as result one filed in model that contains file path

2013-04-11 Thread Andriyko
Hello, I need a way(form in admin) to allow user to select how he will upload a file: -- from local(his) machine -- from filesystem(where django is running) -- from external url Does not matter what way user selects, I want to read that file and write to custom location(path). The model itself

Re: Serving files in production

2013-04-11 Thread Avraham Serour
you can create a subdomain (static.yourdomain.com) and serve static using that, configure the second webserver to serve this subdomain On Thu, Apr 11, 2013 at 2:01 PM, Drew Ferguson wrote: > Hi > > The docs recommend serving static data from a second web server rather

Serving files in production

2013-04-11 Thread Drew Ferguson
Hi The docs recommend serving static data from a second web server rather than the one serving via WSGI How do folks implement this? I can't figure how to serve data for the same domain using 2 web servers. Am I missing something? -- Drew signature.asc Description: PGP signature

Loading a page (with external authentication) changes the session_key

2013-04-11 Thread Samuel Bancal
Hi Django users, We're trying to migrate a project from Django 1.4 to Django 1.5.1 ... The web service has to be accessible both as authenticated and anonymous user. And we use external authentication with an Apache module (which sets "REMOTE_USER" env var in accordance with

Re: Custom Commands?

2013-04-11 Thread Mark Lybrand
To answer my own question: Yes, that works. Follow up question: does each app need its own set of commands? It would seem funny to put all the commands for a project into one of the apps. Or is that the idea? That commands are meant to be app-specific? On Thu, Apr 11, 2013 at 4:41 AM, Mark

Re: Custom Commands?

2013-04-11 Thread Mark Lybrand
So, you have a management/commands structure in each app of your project and not in the main "app" (or whatever that thing is called). Here is the structure of my whole project thus far (I had just shown the part that I thought was important). As you can see I already had an app and the app is

Re: Text Field stifles creating HTML

2013-04-11 Thread rmschne
Further debugging ... printed the HTML that is produced by the call to render and the HTML is created correctly. Thus, I have concluded the problem has nothing to do with Django. Closed. -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: m2m symmetry confusion

2013-04-11 Thread Lachlan Musicman
Sanjay! On 11 April 2013 18:00, Sanjay Bhangar wrote: > Lachlan, > > Not sure if I grokked your problem exactly, but just from personal > experience when I found my brain turned to jelly with a similar-sounding > issue before, I believe I found the answer in the

Re: m2m symmetry confusion

2013-04-11 Thread Lachlan Musicman
Mike, thanks for your reply. On 11 April 2013 17:55, Mike Dewhirst wrote: > On 11/04/2013 4:41pm, Lachlan Musicman wrote: >> >> At the moment I have tables on the database: >> >> account_account >> account_account_parents >> account_account_children >>

Re: m2m symmetry confusion

2013-04-11 Thread Sanjay Bhangar
Lachlan, Not sure if I grokked your problem exactly, but just from personal experience when I found my brain turned to jelly with a similar-sounding issue before, I believe I found the answer in the "symmetrical=False" option .. I do believe setting symmetrical=False for your 'parents' and

Re: m2m symmetry confusion

2013-04-11 Thread Mike Dewhirst
On 11/04/2013 4:41pm, Lachlan Musicman wrote: At the moment I have tables on the database: account_account account_account_parents account_account_children account_account_partners account_account_siblings Not wishing to throw a spanner in the works, but I have always had a design in the

Requiring at least 1 formset in view

2013-04-11 Thread Nora Olsen
Hi, I have a view that has a form and multiple formsets: The formsets and their templates are not dependent on each other and can be used separately in other views. However, at least 1 form must be filled up. The form can be from any formsets. How can I validate this? Should I be doing it

Text Field stifles creating HTML

2013-04-11 Thread rmschne
Django 1.5.1. I have a data model with a Django TextField: notes=models.TextField(db_column='notes',blank=True) and in thy MySQL the 'notes' field is "TEXT". When I output the 'notes' field in a Django Template in a for loop, the template just stops. It does not go through the entire list of

Re: m2m symmetry confusion

2013-04-11 Thread Lachlan Musicman
I tried reading the code in django/db/models/fields/related.py but quickly realised it was beyond me groking in a half hour. BUT, for some reason I felt compelled to test through the admin interface and it is working. ie, I can create and remove siblings and partners from each other, error free

Re: Custom Commands?

2013-04-11 Thread Andrey Kostakov
For first step you need create application, "manage.py startapp myapp". 'management' folder should be located in your application folder. And don't forget add application in INSTALLED_APPS in your settings.py (INSTALLED_APPS = ('myapp', )) On Thu, Apr 11, 2013 at 4:52 AM, Mark Lybrand

Re: should we develop apps based on urls?

2013-04-11 Thread mulianto
Hi In django you can change the public URL with out change the function call in the view.py The URL.py is flexible and can be just inside each app you create for reusable . Mulianto Sent from my iPhone On 11 Apr 2013, at 13:11, surya wrote: > I have an unstructured

Re: m2m symmetry confusion

2013-04-11 Thread Lachlan Musicman
On 11 April 2013 16:19, Lachlan Musicman wrote: > Hi, > > I'm trying to implement a simple family tree type structure. I'm > expanding on this example code base: > > https://github.com/mieows/familytree-django/blob/master/models.py > > (please ignore any errors in that

m2m symmetry confusion

2013-04-11 Thread Lachlan Musicman
Hi, I'm trying to implement a simple family tree type structure. I'm expanding on this example code base: https://github.com/mieows/familytree-django/blob/master/models.py (please ignore any errors in that models.py, I've addressed many of them) Ok, simply I have: class Account(models.Model)