Re: query concerning three tables

2011-08-25 Thread john
On Aug 24, 6:29 pm, Tom Evans wrote: > On Wed, Aug 24, 2011 at 2:12 PM, john wrote: > > i had three tables, > > trademarks, publication, and entry > > trademarks has a foreign key to publication, and publication has a > > foreign key to entry, and entry has a field called published_date, > > wh

Re: search with a optional value

2011-08-25 Thread john
thank you nan, i thought i could avoid the if-else structure..with some lookups or something On Aug 17, 12:52 am, Nan wrote: > Filters can be applied in multiple statements, and querysets are > evaluated lazily, so the following would work and would only run a > single query, when you finally out

Re: query concerning three tables

2011-08-25 Thread john
this gives me 0 as tobjs.count() which shouldn be the case On Aug 25, 12:04 pm, john wrote: > On Aug 24, 6:29 pm, Tom Evans wrote: > > > > > On Wed, Aug 24, 2011 at 2:12 PM, john wrote: > > > i had three tables, > > > trademarks, publication, and entry > > > trademarks has a foreign key to publ

Delegating a async job from a django view

2011-08-25 Thread Amit Sethi
What is the best solution for delegating a long time taking job from a django view. Basically i wish to query a few web api , analyze and then create a report . The report is not to be created in a sync manner and can be sent at a later time . But it will have a web interface to decide a few factor

Re: Delegating a async job from a django view

2011-08-25 Thread Thorsten Sanders
https://github.com/ask/django-celery Take a look at that, it should be able to do what you want, though never used it myself yet. On 25.08.2011 09:24, Amit Sethi wrote: What is the best solution for delegating a long time taking job from a django view. Basically i wish to query a few web api

Re: search with a optional value

2011-08-25 Thread Jani Tiainen
On 08/16/2011 03:20 PM, john wrote: hi, i have a form with few fields as optional,i.e can be left blank, i want to search my db for values i receive from this form, how should i go on about writing my filters when some of values can be " ". any reference is kindly appreciated I had to do that

Re: urlencode in template gives unexpected result (for me :-)

2011-08-25 Thread Tom Evans
On Thu, Aug 25, 2011 at 7:23 AM, Michel30 wrote: > Thanks Tom that clarifies a lot, learning every day. > > My filesystem is ext4, encoding is irrelevant here right? > So, I guess the best thing to do is to convert my database into utf-8 > using a method as described here: > http://www.bothernomor

Re: query concerning three tables

2011-08-25 Thread Tom Evans
On Thu, Aug 25, 2011 at 8:04 AM, john wrote: > > > ** tobjs = > Trademark.objects.filter(created_by__id__exact=76).filter(publication__entry__pub_date__range=('start_date','end_date')) > Is this literal? Are you actually passing proper dates to filter, or the strings 'start_date' and 'end_date'?

Media files not served automatically anymore in 1.3?

2011-08-25 Thread Reinout van Rees
Hi, I'm switching sites over to 1.3 at the moment and I only just discovered that my media files (the media_url ones, not the new static_url ones) aren't served anymore by the development server ("runserver"). The static files (static_url) *are* served automatically in DEBUG mode, which is a

AssertEquals __unicode__

2011-08-25 Thread Torsten
Hi How do I do that right ? I have a class like: class Invoice ... def __unicode__(self): return unicode(str(self.created_at.year)+'/'+str(self.id)) and an test here: def test_invoice_number(self): invoice = Invoice.objects.create(created_at="2011-07-28", customer_id=1, payabl

Re: AssertEquals __unicode__

2011-08-25 Thread Thomas Orozco
Well, call unicode(MyObject) and assert equals u'myRepr' Le 25 août 2011 12:34, "Torsten" a écrit : > Hi > > How do I do that right ? > > I have a class like: > > class Invoice > ... > def __unicode__(self): > return unicode(str(self.created_at.year)+'/'+str(self.id)) > > and an test here: > > > d

Re: AssertEquals __unicode__

2011-08-25 Thread Alasdair Nicol
On 25/08/11 11:34, Torsten wrote: Hi How do I do that right ? I have a class like: class Invoice ... def __unicode__(self): return unicode(str(self.created_at.year)+'/'+str(self.id)) and an test here: def test_invoice_number(self): invoice = Invoice.objects.create(created_

Re: AssertEquals __unicode__

2011-08-25 Thread Torsten
Thanks for the hint: self.assertEqual(u"2011/1", unicode(invoice)) works On 25 Aug., 12:41, Alasdair Nicol wrote: > On 25/08/11 11:34, Torsten wrote: > > > > > > > > > Hi > > > How do I do that right ? > > > I have a class like: > > > class Invoice > > ... > > def __unicode__(self): > >      

Re: Creating an alternative change_list view for a specific app/model, not extending or overriding

2011-08-25 Thread Thomas Weholt
That might work, but I was hoping the change_list was a generic class based view I could subclass and use in my own urls.py for my app, but looking into the source (site-packages\django-1.3-py2.7.egg\django\contrib\admin\views\main.py) of the admin it's not clear at all about how to approach it. A

Re: Media files not served automatically anymore in 1.3?

2011-08-25 Thread Landy Chapman
Hope this helps: from https://docs.djangoproject.com/en/dev/releases/1.3-beta-1/ The staticfiles app ships with the ability to automatically serve static files during development (if the DEBUG setting is True) when using the runserver management command. Based on feedback from the community thi

Re: Media files not served automatically anymore in 1.3?

2011-08-25 Thread Reinout van Rees
On 25-08-11 13:10, Landy Chapman wrote: Hope this helps: from https://docs.djangoproject.com/en/dev/releases/1.3-beta-1/ The staticfiles app ships with the ability to automatically serve static files during development (if the DEBUG setting is True) when using the runserver management command.

Re: Django Development environment

2011-08-25 Thread chandrakant kumar
On 8/24/11, cihan okyay wrote: > 2011/8/23 Stephen Jackson > >> I am new to the world of Django. I would like to hear from other django >> developers describe their dev environment (tools, os, editors, etc.). Slackware, Emacs, MySQL, south, Firebug -- Chandrakant Kumar irc - k03chandra @ #fre

Problem View ManyToMany

2011-08-25 Thread NeoOrion
Hi, I have a problem to show ManyToMany Relationship in my Template. I have two models: class Categoria(models.Model): nombre = models.CharField(max_length=200) descripcion = models.TextField('Categoria del Articulo') def __unicode__(self): return self.nombre class Articulo(m

Re: Problem View ManyToMany

2011-08-25 Thread NeoOrion
I solved my stupid problem. In detail.html only change articulo.categoria_set.all for articulo.categoria.all On 25 ago, 13:16, NeoOrion wrote: > Hi, > > I have a problem to show ManyToMany Relationship in my Template. > > I have two models: > class Categoria(models.Model): >     nombre = models.

Re: Django Development environment

2011-08-25 Thread Marcos Moyano
Dev. Arch Linux, python2.7, django-1.3, virtualenv, postgresql (if possible), south, django-extensions, Emacs Dep. Ubuntu Server, fabric, Nginx, supervisord, uwsgi Rgds, Marcos On Mon, Aug 22, 2011 at 7:07 PM, Stephen Jackson < jackson.stephe...@gmail.com> wrote: > I am new to the world of Djan

[Query] http redirect to non-fragmented url coming from fragmented url

2011-08-25 Thread Subhranath Chunder
I was wondering whether this current behavior with respect to http redirects on fragmented urls is actually a desired behavior, or some bug. Let's suppose the user issues a GET request to the URI '/action#home'. Now, the handler which is associated with this, processes the request and lets suppose

Re: Media files not served automatically anymore in 1.3?

2011-08-25 Thread Uros Trebec
Somehow (I don't remember setting this up) I use https://github.com/divio/django-appmedia with urlpatterns = patterns('', (r'^' + settings.MEDIA_URL.lstrip('/'), include('appmedia.urls')), ) + urlpatterns in urls.py Good luck, Uros On Aug 25, 1:21 pm, Reinout van Rees wrote: > On 25-08-1

Re: Media files not served automatically anymore in 1.3?

2011-08-25 Thread Reinout van Rees
On 25-08-11 12:08, Reinout van Rees wrote: Two questions: - "Breaking" automatic media_url serving seems worthy of a real note in the 1.3 changelog. That note isn't there. Is this bad? Or am I missing something? Yes, I am missing something... It turns out that django-staticfiles 0.2.0 include

Re: Delegating a async job from a django view

2011-08-25 Thread Andre Terra
Celery is really all you need. IIRC, you'll have to install celery, django-celery, setup a broker backend (which handles the task dispatching), and a result backend (i.e. where you'll get results from your tasks). This means you'll have to run a celery server and quite possibly a separate server

Re: [Query] http redirect to non-fragmented url coming from fragmented url

2011-08-25 Thread Tom Evans
On Thu, Aug 25, 2011 at 12:48 PM, Subhranath Chunder wrote: > I was wondering whether this current behavior with respect to http redirects > on fragmented urls is actually a desired behavior, or some bug. > Let's suppose the user issues a GET request to the URI '/action#home'. Stop. Browsers do n

Problem at activating the admin site (Django tutorial part 2)

2011-08-25 Thread pasztilla
Hi there, I'm just trying to accomodate myself with Django - and so I tried to go through the Django Tutorial from the Django official site. There went everything ok with part 1, but at the very beginning of the part 2 I've met a problem(https://docs.djangoproject.com/en/1.3/intro/ tutorial02). In

Update the parent model when a related (inline) model changed?

2011-08-25 Thread Carsten Fuchs
Dear Django list, what is the best way to automatically update a parent model when one of it's related models (i.e. the "inline" models in the admin interface) changed? Overall, we use a main model ("Employee") and several related models, one of which is a cache with monthly sums. The main E

Re: Update the parent model when a related (inline) model changed?

2011-08-25 Thread Shawn Milochik
Use django-celery and call the update in the save() or with a post_save signal. That will work under all circumstances, admin or not, and occur asynchronously. If you're not already using RabbitMQ or django-celery it's super easy. -- You received this message because you are subscribed to th

Re: Django Development environment

2011-08-25 Thread Thomas Guettler
Am 23.08.2011 00:07, schrieb Stephen Jackson: > I am new to the world of Django. I would like to hear from other django > developers describe their dev environment (tools, os, editors, etc.). OS: SuSE or Ubuntu Linux Editor: emacs Shell: bash DB: PostgreSQL APPs: south, reversion Django Version: h

Re: Problem at activating the admin site (Django tutorial part 2)

2011-08-25 Thread raj
In ur urls.py, Did u import admin, make it discoverable, and also uncomment the / admin/ url? Also, make sure that you syncdb by running python manage.py syncdb. Lemme know if that helps :) On Aug 25, 9:29 am, pasztilla wrote: > Hi there, > I'm just trying to accomodate myself with Django - and so

Re: Problem at activating the admin site (Django tutorial part 2)

2011-08-25 Thread Babatunde Akinyanmi
Please say exactly what you did. It will be easier to help that way On 8/25/11, raj wrote: > In ur urls.py, > Did u import admin, make it discoverable, and also uncomment the / > admin/ url? > Also, make sure that you syncdb by running python manage.py syncdb. > Lemme know if that helps :) > On A

Re: Problem at activating the admin site (Django tutorial part 2)

2011-08-25 Thread Babatunde Akinyanmi
The error you stated normally happens when there are problems with the django_site table created when you start a project. On 8/25/11, Babatunde Akinyanmi wrote: > Please say exactly what you did. It will be easier to help that way > > On 8/25/11, raj wrote: >> In ur urls.py, >> Did u import adm

find_template Django 1.3

2011-08-25 Thread demalexx
Hello, In Django 1.3 templates work a little different, in particular, `find_template` returns compiled Template object, not template source. There is a ticket here https://code.djangoproject.com/ticket/15102 but last entry is 4 months old and I can't tell from discussion whether in future Django

Re: Update the parent model when a related (inline) model changed?

2011-08-25 Thread Carsten Fuchs
Dear Shawn, Am 25.08.2011 16:22, schrieb Shawn Milochik: Use django-celery and call the update in the save() or with a post_save signal. That will work under all circumstances, admin or not, and occur asynchronously. Many thanks for your quick reply, but is there a way to achieve this with p

Re: Update the parent model when a related (inline) model changed?

2011-08-25 Thread Shawn Milochik
Sure. Just write your code and call it from the save() or post_save signal. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django

Re: [Query] http redirect to non-fragmented url coming from fragmented url

2011-08-25 Thread Subhranath Chunder
Yes, I do understand that fragment identifiers are not sent to the server. But, I was not talking about that. Infact, I was talking about the fragments send in the response as http 302 response specifically. Maybe, I'll put a little code snippet below to explain the case better: :) urls.py =

using django as an inbetween site?

2011-08-25 Thread bob the builder
i have a website as a backend: i want to have a django site on another server to connect to the backend website for login in and doing other stuff. how would i go about this? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group

Re: [Query] http redirect to non-fragmented url coming from fragmented url

2011-08-25 Thread Tom Evans
On Thu, Aug 25, 2011 at 4:04 PM, Subhranath Chunder wrote: > Yes, I do understand that fragment identifiers are not sent to the server. > But, I was not talking about that. > Infact, I was talking about the fragments send in the response as http 302 > response specifically. > Maybe, I'll put a lit

Re: Setting default form value in template

2011-08-25 Thread raj
Let me be a bit more clear. Lets take, for example, the linkedin javascript api. Now, when you log into your linkedin account through my website, the website can access certain parts of your profile using javascript. Now, when the user first logs in, I want to be able store some information about t

Re: Setting default form value in template

2011-08-25 Thread raj
Actually, I think I'm figuring it out. Just a quick question though. Is it possible to pass javascript values through the form attrs attribute? For example: class forms(forms.Form): name = forms.TextInput(attrs={'size': 10, 'value': ''',}) On Aug 25, 12:13 pm, raj wrote: > Let me be a bit m

Re: Problem at activating the admin site (Django tutorial part 2)

2011-08-25 Thread Pászkán Attila
Yes, all these actions (*) I have done already, but they didn't help... :-( (*): in .../mysite/*urls.py* I have uncommented: *from django.contrib import admin admin.autodiscover() * and further among *urlpatterns* I've uncommented: *url(r'^admin/', include(admi

Re: Problem at activating the admin site (Django tutorial part 2)

2011-08-25 Thread Pászkán Attila
Can you give more details? 2011/8/25 Babatunde Akinyanmi > The error you stated normally happens when there are problems with the > django_site table created when you start a project. > > On 8/25/11, Babatunde Akinyanmi wrote: > > Please say exactly what you did. It will be easier to help tha

Re: [Query] http redirect to non-fragmented url coming from fragmented url

2011-08-25 Thread Subhranath Chunder
I got the idea of what was happening looking at the behavior pattern itself. But, what I was not sure whether these behaviors were defined or just working like that. Which might lead to some other inconsistencies. As, in my case the fragment was coming from some other third-party source. Facebook

Re: using django as an inbetween site?

2011-08-25 Thread Cal Leeming [Simplicity Media Ltd]
This is absolutely not enough information for us to help you. Please refer to this document for ideas on what information to include: https://code.djangoproject.com/wiki/UsingTheMailingList I'm sure once you've given us further details, more people will be willing to assist you :) Cal On Thu, A

Re: Problem at activating the admin site (Django tutorial part 2)

2011-08-25 Thread Babatunde Akinyanmi
Hi paszkan, First I want you to go to your settings file and tell me what value is specified for SITE_ID. You will need that value for the next step. In your terminal where you would have typed "python manage.py runserver" type "python manage.py shell" Doing that would load django's inbuilt shell

Re: find_template Django 1.3

2011-08-25 Thread Doug Ballance
I haven't moved to 1.3 yet, but we do a few things with the template source too so this is definitely of interest. It looks like most of the template loaders define a load_template_source method implementation that does return the source, except for the cached loader. As a work around you could a

[geo-django] Best way to capture geo-coordinate of an anonymous user?

2011-08-25 Thread Ricardo L. Dani
Hello everyone, Anyone knows how to capture a geo-coordinate of an anonymous user after his insert your address in an input? Using a google api? Thanks so much -- Ricardo Lapa Dani -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to t

Geospatial queries using F() object... Is this even possible?

2011-08-25 Thread Info Cascade
Hi -- I'm trying to figure out how to do a geospatial query that references a model field in the filter. class Article(geomodels.Model): point = PointField(...) radius = IntegerField(...) query_point = Point (...) Articles.objects.filter(point__distance_lt=(query_point, F('radius')))

Re: [geo-django] Best way to capture geo-coordinate of an anonymous user?

2011-08-25 Thread Brian Bouterse
This is off topic, but I did this yesterday; here is a link that should help you along. http://code.google.com/apis/maps/documentation/javascript/basics.html#DetectingUserLocation Brian On Thu, Aug 25, 2011 at 2:06 PM, Ricardo L. Dani wrote: > Hello everyone, > > Anyone knows how to capture a g

Re: [Query] http redirect to non-fragmented url coming from fragmented url

2011-08-25 Thread Tom Evans
On Thu, Aug 25, 2011 at 5:58 PM, Subhranath Chunder wrote: > I got the idea of what was happening looking at the behavior pattern itself. > But, what I was not sure whether these behaviors were defined or just > working like that. Which might lead to some other inconsistencies. > As, in my case th

HTML5 music streaming site

2011-08-25 Thread tharshan muthulingam
Hi, I was wondering if django would be a good choice to build an HTML5 webapp that streams music. Does anyone know of any modules or packages that they think this project would be suitable for? Thanks. -- You received this message because you are subscribed to the Google Groups "Django users

Re: Django Development environment

2011-08-25 Thread Dan Gentry
Ubuntu, Eclipse with PyDev, virtualenv, pip, django debug toolbar, Chrome, and lots of hot chocolate :) On Aug 22, 6:07 pm, Stephen Jackson wrote: > I am new to the world of Django. I would like to hear from other django > developers describe their dev environment (tools, os, editors, etc.). --

using postgresql 9 replication but want to balance to servers online only

2011-08-25 Thread mongoose
Hi, I've got a master and slave database setup working using Postgresql 9 Replication. I followed this guide quite strongly http://brandonkonkle.com/blog/2010/oct/20/postgres-9-streaming-replication-and-django-balanc/ When the master is updated then the slave replicates the changes. The requests

django themes

2011-08-25 Thread sjtirtha
Hi, I'm looking a solution to have themes in django like in wordpress. Currently, I'm starting implement it by myself. But I face some issue namely. In wordpress all themes files: php, html, css, javascript, images are in one folder. So we only need to upload these files in one folder and it work

Re: Django Development environment

2011-08-25 Thread Steven Elliott Jr
> Am 23.08.2011 00:07, schrieb Stephen Jackson: >> I am new to the world of Django. I would like to hear from other django >> developers describe their dev environment (tools, os, editors, etc.). Mac OS X Lion PyCharm and TextMate with Python competion and Django bundles Mysql & MongoDB South Pyg

Help with Django code.

2011-08-25 Thread Dr00p
Hi, I need to get Django to run in my code and I am having trouble. Every time I try to import my project (this is a seperate code I created to generate polls) it gives an import error and says DJANGO_SETTINGS_MODULE is not defined. I have tried multiple things like django.core.management.call_comm

Re: Help with Django code.

2011-08-25 Thread akaariai
On Aug 25, 10:26 pm, Dr00p wrote: > Hi, I need to get Django to run in my code and I am having trouble. > Every time I try to import my project (this is a seperate code I > created to generate polls) it gives an import error and says > DJANGO_SETTINGS_MODULE is not defined. > I have tried multiple

Re: Problem at activating the admin site (Django tutorial part 2)

2011-08-25 Thread pasztilla
Hi Babatunde, Hi Babatunde, SITE_ID == 1 then I did what you've suggested:(see the result) Microsoft Windows [verziószám: 6.1.7601] Copyright (c) 2009 Microsoft Corporation. Minden jog fenntartva. C:\Users\Pászkán Attila> D:\>cd Atilla\Programoz\Django\Gyakorlaas\mysite D:\Atilla\

Re: Problem at activating the admin site (Django tutorial part 2)

2011-08-25 Thread Babatunde Akinyanmi
Cool. I'm really interested in finding out what went wrong. If you are also, try to recreate the problem by using you former username and see if the problem persists. If it does, its a bug that the community could consider fixing. That error was thrown by the Site app so I'm still wondering how a c

Yup!

2011-08-25 Thread Firian
Definitely in! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit

Re: Update the parent model when a related (inline) model changed?

2011-08-25 Thread Matt Schinckel
The advantage of using post_save or overriding save() is that it is immediate: if you then return a representation of the parent model, it will be up-to-date. If you use django-celery (or similar) it may take some time to update. Of course, the disadvantages is that your request has to wait for

Re: Problem updating data

2011-08-25 Thread Karen McNeil
Thank you Malcolm, you were exactly right! I would have never thought of that, but I have a custom save method and when I commented it out and restarted the app, setting the active property worked just as expected. Now I just have to figure out what the hell is wrong with my save method... :-) T

Re: can django be used in destop application?

2011-08-25 Thread kenneth gonsalves
On Tue, 2011-08-23 at 18:36 +0100, Cal Leeming [Simplicity Media Ltd] wrote: > Curious concept, using Django for a desktop application. > > Can't think of any reason why you couldn't at least try it :) > use wxpython instead of templates. -- regards Kenneth Gonsalves -- You received this me

Re: Setting default form value in template

2011-08-25 Thread raj
Bump** On Aug 25, 12:49 pm, raj wrote: > Actually, I think I'm figuring it out. Just a quick question though. > Is it possible to pass javascript values through the form attrs > attribute? For example: > > class forms(forms.Form): >     name = forms.TextInput(attrs={'size': 10, 'value': ' js=firs

Re: Setting default form value in template

2011-08-25 Thread Mike Dewhirst
I think you need a bit of R&D here. The general advice I've seen is to get it working without javascript and then find a js solution. I feel it is difficult. Back at the server you only have the data the browser sends you. If I understand what you are saying, your problem is to write some java