Subclass AdminSite vs. custom admin views

2009-04-22 Thread MrJogo
Hi, I'm creating a website for an organization that is going to need a complicated web admin interface. The built in one is fine for the site administrators, but there are different staff positions that need access to different models, and sometimes individual fields in those models should be hid

table display with AJAX

2009-02-06 Thread MrJogo
Hi, One of my pages is going to have a table that I'd like to be sortable, and I'm wondering the best way to do this. I looked into django- tables, which seems good, but once the page is loaded, I'd also like to be able to sort dynamically (using javascript). Before I go and implement this myself

Re: Authenticating static files against Django Auth with FastCGI

2008-11-04 Thread MrJogo
Awesome! This is INCREDIBLY helpful. In terms of using it (I'm not too familiar with server stuff), I have a few questions (which have to do with Apache, not lighttpd, so you might not know). Basically, once I create that handler file and view, how do I use them? Do I modify the .fcgi file (from

Re: Authenticating static files against Django Auth with FastCGI

2008-10-23 Thread MrJogo
40 am, MrJogo <[EMAIL PROTECTED]> wrote: > Hi, > > I am using Django on my university webspace. I set it up by following > (and slightly modifying) the instructions on this > page:http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#runnin... > > Now I would like

Authenticating static files against Django Auth with FastCGI

2008-10-21 Thread MrJogo
Hi, I am using Django on my university webspace. I set it up by following (and slightly modifying) the instructions on this page: http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#running-django-on-a-shared-hosting-provider-with-apache Now I would like to protect certain static file

modelformset_factory or formset_factory for registration form that writes to two models?

2008-09-18 Thread MrJogo
Hi, I want to make a registration form that writes to two models: User and a custom Preferences. It seems that model formsets would be the best way to do that, but all the documentation I can find seems to say that modelformset_factory gets associated with a queryset. If I want to create a new mo

Re: specifying MEDIA_URL in CSS files

2008-09-18 Thread MrJogo
Erik: I can't use relative URLs because of how my hosting service (my university) is set up. Each account is at something like www.university.edu/~studentname/. I could hard code it if I were leaving it on my space, but I'm making it for a group (which has space at www.university.edu/group/groupna

specifying MEDIA_URL in CSS files

2008-09-13 Thread MrJogo
What's the best way to use MEDIA_URL in a CSS file. For example, right now my CSS file has something like: body { background: transparent url('/media/images/bg.gif') repeat; } I would like to use MEDIA_URL instead of /media/ (in a number of places), but other than that the file is static. What

Re: Custom manager for many-to-many traversal

2008-09-03 Thread MrJogo
H'ok, got this working. First off, I had a brain hiccup: my model was one-to-many (the actual model is more complicated than my Book example; I just used the Book to illustrate my point). What I ended up doing was basically what you suggested to do using Django's ORM: I ran two queries, one for B

Re: Custom manager for many-to-many traversal

2008-09-01 Thread MrJogo
I read that post, and now have a general idea of what to do, but I'm still confused on the specifics. It doesn't help that my SQL is VERY rusty. Am I supposed to use cursor.execute() to do the INITIAL lookup? That is, instead of calling a filter, or whatnot, on each book entry, I do a cursor.exec

Re: Custom manager for many-to-many traversal

2008-08-26 Thread MrJogo
I guess I saw it as operating on a group of objects: filtering the group of authors related to my_book by is_living. I also think I got RelatedManager confused with Manager. I think I can handle two db hits, although it's not optimal. I wish there was a way to get a set of data filtered on many l

Re: Custom manager for many-to-many traversal

2008-08-25 Thread MrJogo
John M <[EMAIL PROTECTED]> wrote: > Since my_book.auther_set.all() returns a QS, can't you just say > something like ...all().filter(author__isalive=True) or something like > that?  I've never tried, but I thought that django would figure it > out? > > J > &

Custom manager for many-to-many traversal

2008-08-25 Thread MrJogo
How do I create a custom manager for many-to-many traversal? An example will illustrate what I want to do better. Suppose I have the following models.py: class Book(models.Model): title = models.CharField(max_length=100) class Author(models.Model): books = models.ForeignKey(Book) name = mo

EmailMultiAlternatives send error

2008-06-22 Thread MrJogo
I'm sending a user-submitted form using EmailMultiAlternatives. From my view, I'm calling a helper function in a different file (but in the same directory) to actually compose and send the email. When I send the message from this helper function (using msg.send()), I get a Server Error page. When,

Re: sending email without "from" specified

2008-06-10 Thread MrJogo
Never mind, it was an EMAIL_HOST problem. On Jun 10, 7:25 pm, MrJogo <[EMAIL PROTECTED]> wrote: > I use a university webservice, and they do not allow scripts to set > the "from" address when sending mail (for example, php's mail function > works fine). How

sending email without "from" specified

2008-06-10 Thread MrJogo
I use a university webservice, and they do not allow scripts to set the "from" address when sending mail (for example, php's mail function works fine). How should I send mail from Django? --~--~-~--~~~---~--~~ You received this message because you are subscribed to

APPEND_SLASH and fastcgi

2008-06-06 Thread MrJogo
I am using Django with fastcgi and I cannot get the append slashes middleware to work (I have CommonMiddleware installed in my settings folder, and APPEND_SLASH is true). I have come across a number of posts where append slashes breaks their installating, but for mine it just does not append the s

getting form data in a template - using form labels

2008-06-01 Thread MrJogo
I'm trying to create a simple plain text email template that displays user-submitted, clean form data. Right now, the template is: email_template.txt {% for field, value in data.items %} {{ field }}: {{ value }} {% endfor %} The view passes the template {'data': form.cleaned_data}. Unfortunately

Creating a form class based on fields stored in the database

2008-05-20 Thread MrJogo
I want to create a web interface where users can create a form (ie, define the number of fields and what types of fields they are and the name to display), which will be stored in the Django database, and then displayed elsewhere on the site as an actual form. Any ideas how best to do this, specif

using templates for javascript files

2008-05-12 Thread MrJogo
I'd like my javascripts to know MEDIA_URL so they can pull pictures from there (for a slideshow) and I was wondering the best way of doing this. I figure the best way would be to create one javascript file that goes through the Django templating and makes a variable available for the other script

Re: relative link problem with admin login

2008-04-05 Thread MrJogo
My urls.py file is (I only used the non-testing part): from django.conf.urls.defaults import * urlpatterns = patterns('', ('', url(r'^~mysite/', include('mysite.mysiteurls'))), ) And my mysiteurls.py file: from django.conf.urls.defaults import * urlpatterns = patterns('', url(r'^admin/',

Re: relative link problem with admin login

2008-04-02 Thread MrJogo
I tried doing what you suggested, but now it gives me the error 'RegexURLResolver' object has no attribute 'rindex' when I try to go to the admin page (or any page that exists, for that matter. Pages that don't exist get an unhandled exception). Also, I'm not sure if your solution will fix my pro

relative link problem with admin login

2008-04-02 Thread MrJogo
I'm trying to set up my site on a university webspace, so the root is a subdirectory, ie www.university.edu/~mysite/. Because of this, I'm having trouble logging into the admin pages. I go to www.university.edu/~mysite/admin/ and get the login page, but when I try to login, it goes to www.univers

adding data to the forms.Form class and rendering it

2007-12-24 Thread MrJogo
I'm working on a photo tagging app where the admin specifies categories (such as people, places, etc) and the users can input tags for different pictures. On the page, each category is rendered as an input (with some pretty titles and divs) on a single tagging form. For text inputs, I'd like to ha

determining newforms field type in a template

2007-12-17 Thread MrJogo
If I pass a form into my template as a variable, is there a way to tell what input type a field is in the template? My template creates pretty boxes for the form fields, but I don't want them around hidden inputs. I was hoping for something like {% ifequal field.type "hidden" %} but I can't seem t

Re: database API filter() vs get()

2007-12-17 Thread MrJogo
I understand now. Thanks. On Dec 17, 9:11 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 18-Dec-07, at 10:33 AM, MrJogo wrote: > > > What's the practical difference between calling > > DB.objects.filter(**kwargs) and DB.objects.get(**kwargs) (where

database API filter() vs get()

2007-12-17 Thread MrJogo
What's the practical difference between calling DB.objects.filter(**kwargs) and DB.objects.get(**kwargs) (where **kwargs can be whichever paramenters)? I understand that filter returns a QuerySet, but I don't really get how that affects me or my code. --~--~-~--~~~---~-

design for static/dynamic website

2007-12-15 Thread MrJogo
I'd like to migrate a currently static website to Django to add some dynamic features to it and I have some questions about how best to do that. The public site has mainly informational pages that can be static, but a few, like a members list, work better dynamic. The Django docs say that Django