Re: Django CSS

2008-02-03 Thread todd
Sorry, I didn't see the reply from Thomas. I do have a question about this answer, it says to use only in a development environment. How can I handle this issue in a production environment? T On Feb 4, 8:30 am, todd <[EMAIL PROTECTED]> wrote: > Hi Django users, > > I have the same problem... >

Re: Django CSS

2008-02-03 Thread todd
Hi Django users, I have the same problem... Do I have to register the css in urls.py (I shouldn't think so)? Also I found the ADMIN_MEDIA_URL (I believe that's the setting, in the settings.py file) It mentions it should be the path to css, and javascript, but I guess that's only for the admin in

Re: Help filter with Admin

2008-02-03 Thread Nathaniel Whiteinge
On Feb 3, 7:56 pm, [EMAIL PROTECTED] wrote: > Is there a way to select both 'A' and 'B' under affiliation and get > both Tom and Diane? You can use non-standard filters in the Admin by manually typing the in the URL. For example: http://yoursite/admin/yourapp/student/?school__in=1,2 Unfortunatel

Re: Tool recommendations

2008-02-03 Thread Nikola Stjelja
Use Django. It's fast to learn, its stable with a vibrant community, excellently documented and easy to use. On Feb 4, 2008 7:54 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I don't know web programming, Java or SQL, but I have lots of other > programming experience, including in C++, fun

Tool recommendations

2008-02-03 Thread [EMAIL PROTECTED]
I don't know web programming, Java or SQL, but I have lots of other programming experience, including in C++, functional languages and some Python. I have some ideas for AJAXy web sites, and I'm thinking of implementing them in my spare time, but I don't know what tools to learn and use. Most of

Re: Extend single admin template

2008-02-03 Thread Aaron Fay
Fixed my own problem :P turns out it was user error (go figure...) /templates/admin/auth/user/change_form.html did the trick... Thanks anyway :) Aaron   Aaron Fay wrote: Hi list, I have successfully extended a custom model's template following the instructions in the djangobook, but I t

Extend single admin template

2008-02-03 Thread Aaron Fay
Hi list, I have successfully extended a custom model's template following the instructions in the djangobook, but I tried to do the same with a built-in template (edit user form) by adding {% extends "admin/change_form.html" %} {% block form_top %}   Edit this user's profile {% endblock %

In need of a more flexible URL routing scheme...

2008-02-03 Thread Kyle Fox
I've been having a hard time figuring out how to solve this problem: We're building *another* django blogging app, but we want the app to support multiple blogs on the same site, ideally by having each Blog "mounted" on it's own URL, ie: "/politics/" is a Blog, "/tumbles/" is another Blog, etc.

Re: Read-only connection to database. How to?

2008-02-03 Thread James Bennett
On Feb 3, 2008 7:59 PM, Julien <[EMAIL PROTECTED]> wrote: > Could you please indicate how to do this? Once again, either: 1. Set up a second Django settings file, fill in the read-only user there, and use that settings file for the site that your clients use. 2. Write your custom query method s

Re: Help filter with Admin

2008-02-03 Thread sanrioyt
Sorry, I guess I did not explain too well. What I am asking has to do with list_filter = ('affiliation', 'publication', 'research',) in the admin. This displays a list on the right hand side of the admin. If I have Tom in school 'A', and Diane in school 'B'. I can filter on affiliation on 'A', a

Search Page with Pagination, why do I need to refresh the page to see updated results?

2008-02-03 Thread boralyl
I'm using django and I have a search page that uses pagination. All works well, but if I change the search term the first page is fine, but if I go to the 2nd page I see results from the previous search. I must manually reload the page to see the 2nd page for the new search term. Is there somet

Re: Rendering splitdatetime widget with upgrade

2008-02-03 Thread jeffhg58
Matt, Thanks so much for the info. That fixed my problem Jeff -- Original message -- From: Matt McClanahan <[EMAIL PROTECTED]> > > On Feb 3, 6:30 am, jeffhg58 wrote: > > > I just recently upgrading my trunk to revision 7054 and I noticed that > > the form I have th

def __str__ invalid syntax

2008-02-03 Thread SeanFromIT
class Report(models.Model): ID = models.AutoField(primary_key=True) Abstract = models.CharField(blank=True, maxlength=60) def __str__(self): return self.Abstract class Meta: db_table = 'Report' Invalid syntax error on first letter of def __str__(self). Any ideas? -

Re: Read-only connection to database. How to?

2008-02-03 Thread Julien
Oops! Didn't think of that! Thanks, guys, for spotting the mistake. I totally understand what you suggest, having a RO user at the database (in this case MySQL) level. But I am fairly new to Django and Python, and I am unsure how to implement that dual-setting option. I was thinking, maybe t

Re: has many through relationship

2008-02-03 Thread Eric Abrahamsen
On Feb 4, 1:29 am, "R. K." <[EMAIL PROTECTED]> wrote: > "posts = Post.objects.filter(topic__forum__name="myforumname") # > double underscores in both spots " > This works, but anyway, how can I get just the posts quantity for the > specific forum, for example I have ten forums, and I can get numbe

Re: (Conceptual?) problem w/login_required

2008-02-03 Thread Jason Witherspoon
Belated thanks, Karen-- I was indeed logged in (as "root") in a nearby admin screen. I'm having a devil of a time conceptualizing this model, & I know what I have below isn't correct. I'm trying to set up a simple form; each user would get to select how convenient several different meeti

Re: TemplateDoesNotExist at /admin/

2008-02-03 Thread Nathan
Same error here on Mac OS X Leopard, having installed from the 0.96.1 tarball via setup.py. TemplateDoesNotExist at /admin/ admin/login.html Those folders are not present in: /Library/Python/2.5/site-packages/django/contrib/admin/ A manual copy + authenticate resolved the issue. --~--~

programmatically alter ManyToManyField?

2008-02-03 Thread Tuom
hello, i have two models, image and tag. in image there is also ManyToManyField with tag in its arguments. in admin, i can create new tags, new images and most importantly, alter which tags an image is connected with. but how to do this programmatically? i mean, how to connect/disconnect tags to

Re: Optimistic Locking

2008-02-03 Thread code_berzerker
How about rewriting save method complately and make additional condition in WHERE clausule like this: UPDATE ... WHERE id=666 AND mtime=object_mtime Checking number of updated rows would give you information about success and would guarantee that there is no data manipulation between mtime che

Re: Help filter with Admin

2008-02-03 Thread sanrioyt
Hi, How do I hook that into the Admin? This is what I don't know. Thanks, sanrio On Feb 3, 4:09 pm, William Siegrist <[EMAIL PROTECTED]> wrote: > Have you tried using the IN filter? > > Student.objects.filter(school__in = [A, B]) > > http://www.djangoproject.com/documentation/db-api/#in > > -Bi

Re: Help filter with Admin

2008-02-03 Thread William Siegrist
Have you tried using the IN filter? Student.objects.filter(school__in = [A, B]) http://www.djangoproject.com/documentation/db-api/#in -Bill On Feb 3, 2008, at 1:41 PM, [EMAIL PROTECTED] wrote: Hi, I have a situation whereby I need to use filters with "OR" . Here is a description of my

Re: Rendering splitdatetime widget with upgrade

2008-02-03 Thread Matt McClanahan
On Feb 3, 6:30 am, jeffhg58 <[EMAIL PROTECTED]> wrote: > I just recently upgrading my trunk to revision 7054 and I noticed that > the form I have that uses the splitdatetime > widget no longer renders correctly. This issue has been reported in ticket #6113. The ticket has a patch which you can

Help filter with Admin

2008-02-03 Thread sanrioyt
Hi, I have a situation whereby I need to use filters with "OR" . Here is a description of my model: 1) A student affiliated to only one school. (ForeignKey) 2) A student can only have one publication. (ForeignKey) 3) A student can have multiple research interest(s). (ManytoManyField) I want to

help_text not showing for ForeignKey with models.TABULAR

2008-02-03 Thread Stefan Wallner
Hi, I have a model with the following field: --- class UseFor(models.Model): TYPE_CHOICES = ( ('X', "Page 1"), ('Y', "Page 2"), ) use_for = models.CharField(max_length = 1, choices = TYPE_CHOICES, core = True, verbose_name='use for', help_text='Show on which pa

Re: unknown encoding: cp0 (apache, mod_python)

2008-02-03 Thread Michael Hipp
Karen Tracey wrote: > On Feb 2, 2008 8:14 PM, Michael Hipp <[EMAIL PROTECTED] > > wrote: > > > My code runs fine on the development server, but dies on a local copy of > apache with mod_python. > > It's giving me this error: > unknown encoding: cp0

Re: newforms-admin replacement for core=True in inline models?

2008-02-03 Thread Brian Rosner
> Yes, I think that is the problem. It's not just Boolean fields -- any field > that has a default set to something non-blank will make the inline-edited > item seem non-empty on a save attempt. Not sure what the right way to fix > this is...it's probably worth opening an issue in trac if you ca

Re: newforms file-upload troubleshooting

2008-02-03 Thread birkin
Got file uploading to work. The dpaste views.py lines... file_instance.originalfile = cleaned_form_data['originalfile'] file_instance.save() ...can be replaced with the line... file_instance.save_originalfile_file( cleaned_form_data['originalfile'].filename, cleaned_form_data['originalfile'].

Re: when following along in the django book, i get a 'name 'django' is not defined' error when accessing the admin page (sorry if this is a double post)

2008-02-03 Thread djrocks
Hi Rajesh, I tried import django in a Python shell and it didn't return any errors. So, here is the full stack of the error page. Thanks for your help: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ site-packages/django/core/handlers/ba

Re: has many through relationship

2008-02-03 Thread R. K.
"posts = Post.objects.filter(topic__forum__name="myforumname") # double underscores in both spots " This works, but anyway, how can I get just the posts quantity for the specific forum, for example I have ten forums, and I can get number of posts for one or another or even for all of them, but ano

Re: newforms-admin replacement for core=True in inline models?

2008-02-03 Thread Karen Tracey
On Feb 3, 2008 10:38 AM, NickJ <[EMAIL PROTECTED]> wrote: > > I was definately getting this issue. Cant find any related issue in > track. I have gone back to standard trunk due to this error so I cant > retest right now, but I think the inline model that gives this error > is: > > class Link(mode

Implementing RSS Feeding to Blog App -

2008-02-03 Thread goober
Hello, I am trying to implement a Django RSS based on the Definitive Guide to Django, but I seem to be having trouble viewing the RSS output in my browser. My codes are: # urls.py urls.py (located in the apps directory) from django.conf.urls.defaults import * snip from django_apps.blog.fee

Re: newforms-admin replacement for core=True in inline models?

2008-02-03 Thread NickJ
I was definately getting this issue. Cant find any related issue in track. I have gone back to standard trunk due to this error so I cant retest right now, but I think the inline model that gives this error is: class Link(models.Model): """ Outbound link for directory item. """ directory_

Re: template: how to make use of forloop.counter0

2008-02-03 Thread Michael Hipp
Malcolm Tredinnick wrote: >> Or is there some other way to get at my 'align' list? > > Look at the {% cycle %} template tag. It's designed for precisely this > purpose. Thank you. But can someone show me how to make 'cycle' work? from django.template import Context, Template items = (0, 1, 2, 3

Re: has many through relationship

2008-02-03 Thread Eric Abrahamsen
On Feb 3, 8:31 pm, "R. K." <[EMAIL PROTECTED]> wrote: > Hello, I'm wondering if there is such thing in django? For example, > forum has topics, and topics has posts, so it would be post has > foreign key to topic, and topic has foreign key to forum. And the > question is, how to get how many posts

Rendering splitdatetime widget with upgrade

2008-02-03 Thread jeffhg58
I just recently upgrading my trunk to revision 7054 and I noticed that the form I have that uses the splitdatetime widget no longer renders correctly. On my form it displays my field like Start Date/Time:* instead of actually rendering the date and time fields. Here is a snippet of form: eve

Re: problems with custom template library

2008-02-03 Thread Jonathan Lukens
This is a good idea for consistency, but did nothing to fix the problem. Is the a Category class somewhere in Django that I don't know about that could be conflicting?? On Feb 3, 2008 8:15 AM, Ned Batchelder <[EMAIL PROTECTED]> wrote: > It looks like you are using different styles of importing

Re: Read-only connection to database. How to?

2008-02-03 Thread Tim Chase
> I found a trick that works for my use case. I just don't execute if > it's not a SELECT request. I do the test like so: > > def execute(self): > if self.sql.split()[0].lower() != 'select': > return 'You can only execute SELECT queries.' > So the user puts

Re: problems with custom template library

2008-02-03 Thread Ned Batchelder
It looks like you are using different styles of importing your models in different places: views.py: from weblog.models import Category, Entry blog_extras.py: from lukenslanguages.weblog.models import Entry I can't quite see how that leads to your "cannot import name Category" error,

Re: Read-only connection to database. How to?

2008-02-03 Thread James Bennett
On Feb 3, 2008 6:37 AM, Julien <[EMAIL PROTECTED]> wrote: > I found a trick that works for my use case. I just don't execute if > it's not a SELECT request. I do the test like so: Things your filter doesn't catch: * PostgreSQL's table-creating SELECT INTO statement. * Any "query" which consists

Re: problems with custom template library

2008-02-03 Thread jonathan . lukens
Hi Ned, I figured as much, but since without the 'try' made no difference, I thought I'd give it a whirl here is the source. 'lukenslanguages' is the project directory. #lukenslanguages/weblog/models.py from django.db import models class Category(models.Model): name = models.CharField

Re: problems with custom template library

2008-02-03 Thread Ned Batchelder
When Kenneth suggested "try: @register.filter", he meant, try: "@register.filter", that is, the word "try:" was not meant to go in the file. You may have an import problem in your models file. Can you post more of the source so that we can take a look? --Ned. http://nedbatchelder.com/blog [E

Re: Template help, gotta be simple

2008-02-03 Thread rex
it *should* be in the view anyway??? it's logic... but it should be possible? Something like this would work... although.. it's hideously innefficient. {% for row in data %} {% for key,val in row.items %} {% for field in fields %} {% ifequal field key %} {{ key }}: {{ val }} {% endifequal %} {% e

Re: Read-only connection to database. How to?

2008-02-03 Thread Julien
Hi again, I found a trick that works for my use case. I just don't execute if it's not a SELECT request. I do the test like so: def execute(self): if self.sql.split()[0].lower() != 'select': return 'You can only execute SELECT queries.' On Feb 3, 9:29 pm, J

has many through relationship

2008-02-03 Thread R. K.
Hello, I'm wondering if there is such thing in django? For example, forum has topics, and topics has posts, so it would be post has foreign key to topic, and topic has foreign key to forum. And the question is, how to get how many posts forum has? Thanks in advance, R. K. --~--~-~--~~-

Re: problems with custom template library

2008-02-03 Thread jonathan . lukens
Thanks for the input. > try: @register.filter <--- without the '()' so long as this is in the file, I get a syntax error if I run the file from the command prompt, with the caret pointing to the '@', with or without the '()'. I get the same thing if I do this after the function: try: register

Using guids wih mysql

2008-02-03 Thread shabda
I want to use guids instead of auto incrementing keys with my models for primary keys. I am using mysql. Using the UUID funcion in mysql I can do this, but is there a simpler way? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goog

Re: Read-only connection to database. How to?

2008-02-03 Thread Julien
Thanks James, I thought about that, but how could I use that read-only user just in that Query.execute() function? Cheers, Julien On Feb 3, 9:11 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Feb 3, 2008 4:00 AM, Julien <[EMAIL PROTECTED]> wrote: > > > What should I change to force the re

Re: Read-only connection to database. How to?

2008-02-03 Thread James Bennett
On Feb 3, 2008 4:00 AM, Julien <[EMAIL PROTECTED]> wrote: > What should I change to force the read-only access? Create a new database-level user, and grant that user SELECT but nothing else. Then fill in those credentials in the settings file used by the site. You can always set up a read/write "

Read-only connection to database. How to?

2008-02-03 Thread Julien
Hello there, Is it possible to force database access to be read-only when executing custom SQL? I want to make a simple admin application that lets my clients execute some SQL code (only "SELECT" queries, so they can pull out some data when they need). I don't want them to mess up the database so

Re: What is best way of positioning html edit boxes?

2008-02-03 Thread Kenneth Gonsalves
On 03-Feb-08, at 1:02 PM, Glenn_NZ wrote: > I am not modifying form.as_p() in the view. Should I be? you shouldnt be. If you want fine-grained control over the positioning of parts of the form, you have to break the form up in the template and manually position the elements. Like what is d

Re: Problem creating a model instance with data captured from an URL in a View

2008-02-03 Thread Daniel Roseman
On 3 Feb, 07:04, "Jack Oswald" <[EMAIL PROTECTED]> wrote: > I have just created my first, very simple, Django app. Using the URL as a > way to pass in parameters, I capture information and use a template to > create an iCal file. I intend to put this up on the web to allow anyone who > wants to

Re: Invalid Syntax on ForeignKey Class

2008-02-03 Thread Daniel Roseman
On 3 Feb, 08:52, SeanFromIT <[EMAIL PROTECTED]> wrote: > I'm just not seeing what's wrong with this models.py. > > from django.db import models > class AdditionalEvidence(models.Model): > AEID = models.AutoField(primary_key=True) > class Meta: > db_table = 'Additional_Evidence' > >

Invalid Syntax on ForeignKey Class

2008-02-03 Thread SeanFromIT
I'm just not seeing what's wrong with this models.py. from django.db import models class AdditionalEvidence(models.Model): AEID = models.AutoField(primary_key=True) class Meta: db_table = 'Additional_Evidence' class Recording(models.Model): RID = models.AutoField(primary_key=