Re: permalinks from cron job

2010-01-17 Thread Ted Nyman
More generally, in a crontab, you'll need to set both the PYTHONPATH and give the location of the relevant Django settings. -Ted On Jan 17, 2010, at 8:22 PM, "eric.frederich" wrote: Is there some setting somewhere to set the prefix? Can it be set via an

Re: Newbie question : passing control from one view function to another. I get a function does not return an HttpResponse object error

2010-01-17 Thread Benjamin Welton
Hey harijay, A little warning up front, im fairly new to django as well so if there is some issue with my response sorry in advance. "return HttpResponse()" actually returns just an HttpResponse object. If you are coming from ROR its functionality is not identical to render (which

Re: permalinks from cron job

2010-01-17 Thread eric.frederich
:: bump :: On Jan 14, 1:59 pm, "eric.frederich" wrote: > My django urls work nicely when browsing around, clicking things, and > when my views generate emails.  They all have the appropriate prefix. > > In apache's conf file I have the following... > > WSGIScriptAlias

Re: Should Django handle uploaded files in PUT as well as POST?

2010-01-17 Thread Russell Keith-Magee
On Mon, Jan 18, 2010 at 8:14 AM, Malcolm Box wrote: > On Sat, Jan 16, 2010 at 4:58 AM, Russell Keith-Magee > wrote: >> >> On Sat, Jan 16, 2010 at 6:32 AM, Malcolm Box >> wrote: >> >> > It seems to me that Django should

Re: Load template tags if installed?

2010-01-17 Thread Aaron C. de Bruyn
On 2010-01-16 at 14:37:38 -0800, Tomasz Zieliński wrote: > On 16 Sty, 20:31, "Aaron C. de Bruyn" wrote: > > Am I missing an easy way to check if an application is installed > > so I can make decisions in a template? > > AFAIK there is no such feature, but I think you could

Newbie question : passing control from one view function to another. I get a function does not return an HttpResponse object error

2010-01-17 Thread harijay
Hi i have a question about django and I am afraid it is a slighty academic question. I am a newbie at django and I am trying to hand off control from one view_func1 to another function ( test code below) I am wondering why although the aunthenticate_user function i.e the second function returns

Re: Serving static files from subdomain.

2010-01-17 Thread Malcolm Box
On Mon, Jan 18, 2010 at 12:41 AM, nameless wrote: > Thank you for tips. > Now I want that when an user upload an image ( through forms ), then > it will be saved in media.example.com. > This is the point that I don't understand :-\ > > Does the computer running Django have

Re: Serving static files from subdomain.

2010-01-17 Thread nameless
Thank you for tips. Now I want that when an user upload an image ( through forms ), then it will be saved in media.example.com. This is the point that I don't understand :-\ --- On Jan 18, 1:08 am, Malcolm Box wrote: > On Sat, Jan 16, 2010 at 3:20 PM, nameless

Allowing FileField to overwrite filenames

2010-01-17 Thread Eugene Wee
Hi, The default behaviour of FileField that causes underscores to be appended to the file name (excluding the extension) when the desired file name is taken does come in handy, but sometimes I would like to overwrite the file instead of uploading a file that is given nearly the same name. What is

Re: import json data into my django app

2010-01-17 Thread Bayuadji
if I were you, I also will create a django command to call the utility, it much easier that way. -djibon- On Mon, Jan 18, 2010 at 7:20 AM, nek4life wrote: > On Jan 17, 4:58 pm, lance wrote: >> Python/Django newbie question: >> >> I need to create a cron

Re: import json data into my django app

2010-01-17 Thread nek4life
On Jan 17, 4:58 pm, lance wrote: > Python/Django newbie question: > > I need to create a cron job that fetches json data from a URL, parses > it (presumably using simplejson) and then load the data into my > database using the Django models I've defined. > > I'm having trouble

Re: Should Django handle uploaded files in PUT as well as POST?

2010-01-17 Thread Malcolm Box
On Sat, Jan 16, 2010 at 4:58 AM, Russell Keith-Magee wrote: > On Sat, Jan 16, 2010 at 6:32 AM, Malcolm Box > wrote: > > > It seems to me that Django should process POST and PUT requests the same > - > > i.e. the request.FILES attribute should be

Re: Serving static files from subdomain.

2010-01-17 Thread Malcolm Box
On Sat, Jan 16, 2010 at 3:20 PM, nameless wrote: > I have a site developed with django at www.example.com > > I want that django insert/serve static files ( images, css, js, ect ) > in/from media.example.com. > > Are these files that Django is managing (e.g. via an

Re: Enter a valid value while saving fullname during registration

2010-01-17 Thread Malcolm Box
On Sat, Jan 16, 2010 at 7:56 PM, Praveen wrote: You seem to have forgotten to ask a question, provide an answer or start a thread of conversation. Malcolm -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: My Own Auth Backend

2010-01-17 Thread Olivier Détour
up 2010/1/16 Détour Olivier : > Hi, > I would create my own auth backend. I tried to understand and trace > source code. > I want to create an internal DB with SHA1 and username. > But I cannot login, Django says me I do not set DB ENGINE. I would not > use something like

Re: Admin list_display loop though sub objects and output sum of values - newbie

2010-01-17 Thread pfwd
Thanks fantastic thank you I was also able to do: result = obj.task_set.aggregate(Count('id'))['id__count'] to get the a count of the tasks for quote I don't suppose you know any good books regarding Python/Django that I could buy to help me learn the syntax better? Many thanks On Jan 17, 10:15 

Re: Admin list_display loop though sub objects and output sum of values - newbie

2010-01-17 Thread Daniel Roseman
On Jan 17, 8:28 pm, pfwd wrote: > Hi am very new to Django/Python and I need some help with a model > method > > I have two tables Linked by a foreign key and their forms are embedded > in the admin interface. > One table is called Quote and one table is called Task. The

import json data into my django app

2010-01-17 Thread lance
Python/Django newbie question: I need to create a cron job that fetches json data from a URL, parses it (presumably using simplejson) and then load the data into my database using the Django models I've defined. I'm having trouble finding any tips, examples, or documentation on how to do this...

Efficient access through two manytomany layers

2010-01-17 Thread Alastair Campbell
Hi everyone, I have something that works, but I'm guessing it's *very* inefficient, I'm guessing that nested for-loops for two layers of many to many fields is bad, but how could I go about this better? The aim is for my admin users to fill in the sub-categories (classes), and for the system to

Re: Querysets returns wrong result when using threading.

2010-01-17 Thread Kieran Brownlees
Fantastic, thank you :) On Jan 16, 9:02 pm, Tomasz Zieliński wrote: > On 16 Sty, 06:15, Kieran Brownlees wrote: > > > Firstly thank you, secondly, how to get around it? I assume I need to > > force a commit for the transaction my thread is

Admin list_display loop though sub objects and output sum of values - newbie

2010-01-17 Thread pfwd
Hi am very new to Django/Python and I need some help with a model method I have two tables Linked by a foreign key and their forms are embedded in the admin interface. One table is called Quote and one table is called Task. The task table has a field called time_taken In the Quote list I want to

Re: Custom filters and partial mark_safe?

2010-01-17 Thread Andrew Turner
On 16 Jan, 23:05, "pjrhar...@gmail.com" wrote: > It's not as bad as you fear! Just escape it, then apply your filter, > then mark it all safe. Genius! This is so obvious in hindsight. Much better than all of the outrageously complicated possible solutions I have been going

Re: NoReverseMatch:

2010-01-17 Thread Andreas Pfrengle
> I am putting same pattern because both tellfriend and hero belongs to > same template. > > refer template has two form. Okay, so want to display two forms on one template and want some logic that depends on which of the two "Submit" buttons the user pressed. Is that assumption right? urls.py

Re: NoReverseMatch:

2010-01-17 Thread Juan Pedro Fisanotti
The urls define wich views should be executed when the user access an address (url). Different urls can point to the same view. But if you specify two different views for the same url, wich one should be executed when the user enters that url? Django can't know. It's invalid. 2010/1/17 Bhaskar

Re: NoReverseMatch:

2010-01-17 Thread Bhaskar Gara
Thank you, I am putting same pattern because both tellfriend and hero belongs to same template. refer template has two form. Thank you Bhaskar On Jan 17, 11:25 am, Andreas Pfrengle wrote: > > url(r'^member/refer/$', direct_to_template, > >         {'template':

Using the form field values in templates

2010-01-17 Thread adrian_m
Hello people, How can I access the value of a form field in the template ? I'm having two different use cases : - display a field value as simple text (the field is not meant to be edited by the user, therefore i don't want to use a input field) - use the field value for generating a link (

Re: Send and Receive SMS from a django app

2010-01-17 Thread Chris Withers
Alessandro Ronchi wrote: I cannot use an SMS gateway for my app (I must use a SIM and an hardware modem). Why? This is not a sane requirement for a web app... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You

Debugging Templates

2010-01-17 Thread oakmad
What is the best way to debug templates when data is not showing? Here is my problem. I'm using Google App Engine with app-engine-patch so I realize it may not be a Django specific issue. I have one property on a model that will not display on my template yet all the model's other properties

Re: NoReverseMatch:

2010-01-17 Thread Andreas Pfrengle
> url(r'^member/refer/$', direct_to_template, >         {'template': 'member_refer.html'}, name='member_refer'), > > url(r'^refer/$', 'erp_site.views.tellfriend', name='tell_friend'), > url(r'^refer/$', 'erp_site.views.hero', name='hero'), tell_friend and hero have the same pattern r'^refer/$',

Multilingual project with applications in different default-languages

2010-01-17 Thread Andreas Pfrengle
We are working on a django-project that shall support several languages. i18n works so far, translation strings are marked, po-files can be created and LocaleMiddleware is also installed. We've decided to start with German as default locale (so all translation strings in python code and templates

How to lazy-sort a list of translation strings alphabetically

2010-01-17 Thread Andreas Pfrengle
For a multilingual project, I have a ChoiceField and want to display the choices in alphabetical order - according to the current language. Example: choices = ((1, _('Some choice')), (2, _('Another choice')), (3, _('One more choice'))) In English it should be ordered 'Another choice', 'One more

Re: List as filterinput, possible?

2010-01-17 Thread Andreas Pfrengle
You could try myDevices = Device.objects.filter(group__in=groups) see: http://docs.djangoproject.com/en/1.1/ref/models/querysets/#in -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: NoReverseMatch:

2010-01-17 Thread Andreas Pfrengle
Your urls.py needs to contain sth. like that: urlpatterns = patterns('your_app.views', url(r'^the_url_you_want_for_tellfriend$', 'name_of_viewfunction', name='tellfriend'), ) the last argument, name='tellfriend', is what the {% url %} tag is searching for in your urlpatterns, and

django hosting

2010-01-17 Thread alrobeler
hi i ve heard you can provide with free django hosting http://www.jjude.com/2008/06/10/a-free-but-superb-django-hosting/ if this service is still actual can i afford torequest one account provided by you? for the Django-based cms delopment and testing -- many thanks in advance and best regards --

List as filterinput, possible?

2010-01-17 Thread Odd
I have this query: myDevices=Device.objects.filter(group=groups) where groups is a list. What I want is get all the devices that is in one of the groups in the list groups. If group only has one element, everything goes as expected. But if groups has more than one element, which is often the

Re: Convert Joomla Template to Django Template

2010-01-17 Thread esatterwh...@wi.rr.com
You are in for a treat my friend. I will say that my short 4 or 5 encounters with Joomla were the reason took up django. I had never seen a line of python code in my life, but I was so thoroughly frustrated and irritated with Joomla that I took up a new language so I could use django. The good

Re: NoReverseMatch:

2010-01-17 Thread Bhaskar Gara
Thank you Lan, I am pretty new to the Django. How do I know its needs an argument? which file will have that, is that in URL.py? On Jan 17, 12:30 am, Ian Lewis wrote: > Bhaskar, > > The error means that there is either no defined URL called > 'tellfriend' or it requires

Re: Django site behind an Apache reverse proxy

2010-01-17 Thread Graham Dumpleton
On Jan 17, 3:44 am, AlK wrote: > Hi ! > > I developed a small Website querying some other sites in background > like a "cron". The queries are handled in a separate thread that I can > start and stop when I want from a simple web-interface. It works great > on my

Editing ModelForm instance

2010-01-17 Thread David
When editing an object using ModelForm, the best way I know is def my_view(request): obj_id = request.POST.get('obj_id', '') old_object = MyModel.objects.get(pk=obj_id) form = MyModelForm(request.POST, instance=old_object) ... but I'm thinking the first two lines are a pain to