Re: Newbie Django Mac OS X suggestions.

2010-01-30 Thread Thomas Schreiber
I am extremely satisfied with Homebrew for OSX packet management: http://github.com/mxcl/homebrew Much cleaner to customize and get right than macports, fink, or manual building. New recipes get added all the time, and most everything I've needed is already there. With home brew I never touch

Re: urlresolvers.py error when using postgres, but not sqlite3

2010-01-30 Thread Shawn Milochik
Karen, Perfect, thanks! I didn't know that attempting the import in './manage.py shell' would give me more information than I was getting from the standard traceback. It led me immediately to the flaw in my code, which was in a forms.Form used in the view. That little trick will probably come

Re: Newbie Django Mac OS X suggestions.

2010-01-30 Thread Dave Murphy
On 30 January 2010 21:15, Shawn Milochik wrote: > In addition, I have the solution to your problem with psycopg2: > http://shawnmilo.blogspot.com/2009/11/psycopg2-on-snow-leopard.html Thanks Shawn! I'll try that one out. I'd already tried all the other suggestions I could

Re: A Couple Newbie Questions

2010-01-30 Thread Dave Murphy
On 30 January 2010 19:59, Sector7B wrote: > 1. Reading the documentation for deploying using mod_wsgi.  It says > not to use just 'settings' in django.wsgi The example has >  sys.path.append('/path/to/app/mysite') >  os.environ['DJANGO_SETTINGS_MODULE'] =

A Couple Newbie Questions

2010-01-30 Thread Sector7B
Hi, got a couple questions after the getting started. I've followed the tutorial and have it deployed to an apache instance locally. But planning out my next steps for my app, i have some questions hopefully someone can add insight to. 1. Reading the documentation for deploying using mod_wsgi.

Re: Using a template variable in the "include" template tag

2010-01-30 Thread shofty
i wasn't very clear. i was referring to the inability to use operators in an if statement until current dev version. Matt On Jan 31, 12:15 am, Super McFly wrote: > You have been able to use if statements as far back as I can remember > using django (over a year). You

Re: Generic templates

2010-01-30 Thread Dylan Evans
No i have processors, i have all the data i need in the template, i just don't know an elegant way to condition out menu items. This is how my model works ACCESS_CHOICES = ( (1, "Public"), (10, "Private"), (100, "Staff"), (1000, "System") ) class Menu(models.Model): name

Re: Cannot add inlines to Flatpages

2010-01-30 Thread Rodrigo
Ok, just restarted (I actually restarted many times) and it magically started working. On Jan 31, 12:47 am, Rodrigo wrote: > I'm following the tutorial on the book "Practical Django Projects", > and I just can't inline the SearchKeywords to Flatpages, maybe the > problem lays

Cannot add inlines to Flatpages

2010-01-30 Thread Rodrigo
I'm following the tutorial on the book "Practical Django Projects", and I just can't inline the SearchKeywords to Flatpages, maybe the problem lays in the fact that I'm using the development version of django. It doesn't output any error, it just shows the flatpages standard admin page, without

Re: ManyToMany Performance

2010-01-30 Thread Russell Keith-Magee
On Sun, Jan 31, 2010 at 1:38 AM, chefsmart wrote: > Let's say I have two models -  Article and Publication. Article has a > field > > publications = models.ManyToManyField(Publication) > > Let's say I present the user with a series of checkboxes representing >

Re: Using a template variable in the "include" template tag

2010-01-30 Thread Super McFly
You have been able to use if statements as far back as I can remember using django (over a year). You might as well finish posting your actual problem since you're here and I'll try to help. As for your version problem you more than likely have the latest development version. I notice the same

Re: URL Matching: 404 Error

2010-01-30 Thread When ideas fail
Ah, I see, the problem is with the keys.., not the URLs On 30 Jan, 22:16, When ideas fail wrote: > Hi, I seem to be having a problem matching one of my URLs. > I have this URL in my .py file in one of my user app. > >  url(r'^activate/(?P\w+)/$', >                      

urlresolvers.py error when using postgres, but not sqlite3

2010-01-30 Thread Shawn Milochik
I tried to switch an existing Django app from sqlite3 to Postgres. I know the database stuff is working because I can run syncdb and South migrations, as well as external scripts that use my models. However, when I actually try to load any of the pages in the browser, I get the error below. If

admin error

2010-01-30 Thread zweb
Upgraded to 1.1.1 added admin for first time per instructions in settings.py and urls.py after upgrading to 1.1.1. No admin.py at this point. created new super user logged in to admin console for first time. and got the following error: In template

URL Matching: 404 Error

2010-01-30 Thread When ideas fail
Hi, I seem to be having a problem matching one of my URLs. I have this URL in my .py file in one of my user app. url(r'^activate/(?P\w+)/$', activate, name='registration_activate'), and then thats added to my project urls: (r'^users/',

Re: Generic templates

2010-01-30 Thread Shawn Milochik
I think you've missed context processors, which is easy to do. I'm assuming that your issue is that you want to have something passed in the context on every page load to do something like decide which menu items are available based upon whether the user is logged in, their privileges, or

Django FormWizard Dynamically Alter form_list

2010-01-30 Thread leveille
I'm having some issues with the form wizard, that maybe someone can shed some light on. According to the docstring in the method process_step: I can "dynamically alter self.form_list". So, based on my project needs, I'm appending forms to the form_list. The forms I'm appending contain questions

Bound forms and file-/imagefields

2010-01-30 Thread Stefan Nitsche
Hi, I have a two model classes, Article and Image, and with ModelForm and inline_formset I've created a form for editing an article and the images that belong to it. If the article has two attached images the inline_formset will create two "file inputs" for the attached images and three "file

Re: doubt about permalink and name in urlpatterns

2010-01-30 Thread harryos
> So you can use them with the {% url %} tag in templates, as shown later on. thanks a lot harry -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this

Re: doubt about permalink and name in urlpatterns

2010-01-30 Thread James Bennett
On Sat, Jan 30, 2010 at 10:55 AM, harryos wrote: > 'coltrane_entry_archive_day' ,'coltrane_entry_archive_month' etc are > never used in any method in class Entry.Even if I remove it from the > urlpattern the entries will be listed properly and get_absolute_url in >

Re: REST & Django

2010-01-30 Thread Ovnicraft
2010/1/29 myfreeweb > REST is a web service architecture, not a program functionality. > If you want to implement a RESTful API for your app, take a look at > django-piston: http://bitbucket.org/jespern/django-piston/wiki/Home > piston rocks ! > > On 29 янв, 19:03, pyleaf

ManyToMany Performance

2010-01-30 Thread chefsmart
Let's say I have two models - Article and Publication. Article has a field publications = models.ManyToManyField(Publication) Let's say I present the user with a series of checkboxes representing publications (much like the ModelMultipleChoiceField, but I am not using ModelForms here) and

Generic templates

2010-01-30 Thread Dylan Evans
I'm new to django and i think it's brilliant except for the weird template system. It seems the only way i can write templates which are generic enough to be reusable is to write complex tags and filters for tasks which could be handled by a simple argument on a function call, or as a compromise

Re: Record is not saving

2010-01-30 Thread Praveen
Thanks Actually earlier i was passing instance of Phone phoneform = PhoneForm(request.POST,instance=Phone.objects.get (user=request.user)) but at very first time there was no record in Phone table that is what i was getting the sql query is not matching so i tried with try: userob

doubt about permalink and name in urlpatterns

2010-01-30 Thread harryos
In Bennet's book ,chapter4, decoupling the urls (page 74 in my ebook) ,the name 'coltrane_entry_detail' is added to the urlpattern for an entry and the get_absolute_url() method in class Entry makes use of that name ,and permalink causes the method to output correct url. But I can't understand why

Re: error in file reading after deploy with mod_wsgi

2010-01-30 Thread cootetom
'public/index.html' is a relative URL. I think the problem is probably because Apache is trying to open the directory from a place where is doesn't exist. You can make it an absolute path from the executing file by using the following code. import os os.path.join(os.path.dirname(__file__),

Re: Using a template variable in the "include" template tag

2010-01-30 Thread shofty
On Jan 30, 5:37 am, Sam Lai wrote: > You can always use if blocks, e.g. > > {% ifequal content.model_type "post" %} > {% include "content/post/include.html" %} > {% elseifequal ... %} > ... > {% endif %} > I believe im right in saying that you can only use if statements

Re: Record is not saving

2010-01-30 Thread cootetom
You are created a PhoneForm but passing it an instance of User. You need to pass the form an instance of the model it works on. - Tom On Jan 30, 3:45 pm, Praveen wrote: > Hi > > here is my views > def phone_register(request, success_url=None,form_class =

Record is not saving

2010-01-30 Thread Praveen
Hi here is my views def phone_register(request, success_url=None,form_class = PhoneForm, template_name="phone/phonereg_form.html", extra_context=None): userobj = User.objects.get(pk=request.user.id) if request.method == 'POST': phoneform = form_class(request.POST,

Re: Models, forms and inlineformset

2010-01-30 Thread andreas schmid
it works now :) thank you!! Stefan Nitsche wrote: > On Sat, Jan 30, 2010 at 11:23, andreas schmid > wrote: > > Stefan Nitsche wrote: > > > > > > On Thu, Jan 28, 2010 at 10:15, andreas schmid >

Django Test Server and threading

2010-01-30 Thread Cristiano Paris
Hi, can you explain why this doesn't work: - import os, sys, thread, time sys.path.append('/mysite') os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' from django.core.handlers.wsgi import WSGIHandler() from django.db import connection import wsgiref.simple_server

Re: 'Reverse' (??) InlineModelAdmin objects

2010-01-30 Thread Alexey
You should inline Books, not Author. So: class BookInline(admin.TabularInline): model = Book class AuthorAdmin(admin.ModelAdmin): ... inlines = [BookInline, ] and then you'll be able to create books in the same time as creating authors. (Books form already has author (foreign key)

error in file reading after deploy with mod_wsgi

2010-01-30 Thread ts
Hi, in my views.py i have the following code: from django.http import HttpResponse def index(request): fp = open('public/index.html') html = fp.read() fp.close() return HttpResponse(html) this works fine when i use "python manage.py runserver", and the page serves up ok. but

DateField input_formats in auto-generated generic view forms

2010-01-30 Thread Baurzhan Ismagulov
Hello, Is it possible to specify DateField input_formats somewhere (e.g., in a model or a global setting) without overriding the generic view (create_update.create_object, create_update.update_object) forms? I'm using 1.0. Thanks in advance, -- Baurzhan Ismagulov http://www.kz-easy.com/ --

Re: Models, forms and inlineformset

2010-01-30 Thread Stefan Nitsche
On Sat, Jan 30, 2010 at 11:23, andreas schmid wrote: > Stefan Nitsche wrote: > > > > > > On Thu, Jan 28, 2010 at 10:15, andreas schmid > > wrote: > > > > and your form works on edit too? > > i really cant

django.contrib.redirects only working when DEBUG = True under wsgi

2010-01-30 Thread sunn
I have a very strange problem with django redirects. When running locally redirects works just fine. Debug on or off. When running under wsgi on WebFaction it will just give me 404:s if DEBUG = False WIth DEBUG = True everything works fine on Webfaction as well. Any ideas? Thanks jonas --

Re: Models, forms and inlineformset

2010-01-30 Thread andreas schmid
Stefan Nitsche wrote: > > > On Thu, Jan 28, 2010 at 10:15, andreas schmid > wrote: > > and your form works on edit too? > i really cant understand why mine isnt... > > its giving me this MultiValueDictKeyError which i dont

Filter objects by reference

2010-01-30 Thread Alessandro Ronchi
I Have an object that have this method. def is_available(self, da, a): if self.manutenzioni.filter(data_inizio__lte=da, data_fine__gte=a).count() > 0: return False else: return True I want to make a method that get all objects available from data to data

Re: Django 1.1 features covered in book.

2010-01-30 Thread Sebastian Pawlus
Thanks Shawn for a book, and ekm Bill for link cool website cool colors ;) one for you http://tinyurl.com/ydud8rl On Fri, Jan 29, 2010 at 6:07 PM, Shawn Milochik wrote: > "The Definitive Guide to Django," Second Edition by Adrian Holovaty and > Jacob Kaplan-Moss covers