Re: url problem

2008-08-24 Thread timc3
It looks like you are getting a little confused. For a start you don't match anything for just http://localhost:8000/ (r'^$', 'urus.app.views.main') Don't know whether thats on purpose or not. anyway. > urlpatterns = patterns('', >     # Example: >     # (r'^urus/', include('urus.foo.urls')),

Re: Noob: form class location

2008-08-24 Thread Gerard Petersen
Julien, It's working. It took some shuffling of import statements because I subclass ModelForm in there for use with form.as_table Anyway, thanx again! Regards, Gerard. Julien Phalip wrote: > The import is likely to be in your view: > > # views.py > from forms import MyForm > >

Modify data before save?

2008-08-24 Thread Paddy Joy
What is the best way to modify form data before it is saved to the database? I have tried the following but can't seem to get it to work, can anyone help? models.py -- class MailBox(models.Model): domain = models.ForeignKey(Domain, core=True) address =

Re: Composite Forms? Are widgets the right thing to use?

2008-08-24 Thread Jon Loyens
Thanks guys! Using multiple forms + prefixes is exactly what I need! Would be nice if there was some global wrapper though so you could do validation amongst the forms but beggars can't be choosers. On Aug 23, 2:28 am, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Aug 23, 2:33 am, Jeff

Re: url problem

2008-08-24 Thread Handle Huang
urlpatterns = patterns('', url(r'^$', 'urus.app.views.main', name="main"), ) And in the last version when I use this way to define the URL an invalid syntax will popup. 2008/8/24 Handle Huang <[EMAIL PROTECTED]> > thanks for your replay. > but my problem is still here, the include function

Re: Making Custom Model Methods to Work

2008-08-24 Thread Daniel Roseman
On Aug 24, 7:38 am, rmschne <[EMAIL PROTECTED]> wrote: > I'm new to Django, and have played with Python for a few years on and > off (not a real programmer).  I'm keen to use Django to explore some > data because of its custom data models which I plan to rely on > extensively (putting the complex

Re: HTML in ValidationError?

2008-08-24 Thread Tim Kersten
Ah, I see what you mean. A quick glance at http://code.djangoproject.com/changeset/4544 tell's me this is not possible to do so inside the error message, for good reasons. To style your message take a look at http://www.djangoproject.com/documentation/forms/#how-errors-are-displayed and

Re: Processing multiple forms in same page

2008-08-24 Thread Daniel Roseman
On Aug 24, 1:51 am, Rodolfo <[EMAIL PROTECTED]> wrote: > Just for curiosity, why would one have two forms in a single page? > I don't think it is possible to submit the two in a shot. > > Maybe only of them is intended to be filled per access? > > []s > > Rodolfo You can't have two HTML forms

Re: unregister in old versions of django

2008-08-24 Thread aleray
Really no idea ? On Aug 22, 11:01 pm, aleray <[EMAIL PROTECTED]> wrote: > Hi, > > I'm working with django revision 7513 and satchmo 0.7 because I heard > they were doing nice job together. Howerver I would like to unregister > some models in the admin interface, but I can't (and don't want to) >

Re: unregister in old versions of django

2008-08-24 Thread James Bennett
On Sun, Aug 24, 2008 at 5:04 AM, aleray <[EMAIL PROTECTED]> wrote: > Really no idea ? Well, you could always do the following: >>> from django.contrib import admin >>> help(admin.site) Which shows you full API documentation for the AdminSite class, listing all of its methods and what they do,

First App: devel server - can't establish a connection to 127.0.0.1

2008-08-24 Thread Rob
Running Fedora and Python 2.4. Working my way through the first installation... I've successfully run "python manage.py runserver" and gotten the expected Validating models... 0 errors found Django version 1.0-beta_1-SVN-unknown, using settings 'dja.settings' Development server is

Re: unregister in old versions of django

2008-08-24 Thread aleray
Thanks for the tip, I often forgot the existence of python doc! However the thing is in the version of django I'm using there is not admin.site, so no API to unregister. Like I said, the models are registered with the old fashioned class admin. Then I thought I could override that class Admin to

Module not callable (Practical Django Projects)

2008-08-24 Thread marsii
Hi! I working whit the book Practical Django Project and have a problem with th weblog example. (I have Django revision 8511. I got the following error when I try to add an entry: --- TypeError at /admin/coltrane/entry/add/ 'module' object is not

Re: unregister in old versions of django

2008-08-24 Thread James Bennett
On Sun, Aug 24, 2008 at 6:40 AM, aleray <[EMAIL PROTECTED]> wrote: > Thanks for the tip, I often forgot the existence of python doc! > However the thing is in the version of django I'm using there is not > admin.site, so no API to unregister. Like I said, the models are > registered with the old

Re: HTML in ValidationError?

2008-08-24 Thread coan
On Aug 24, 12:25 pm, "Tim Kersten" <[EMAIL PROTECTED]> wrote: > Ah, I see what you mean. A quick glance > athttp://code.djangoproject.com/changeset/4544 > tell's me this is not possible to do so inside the error message, for > good reasons. To style your message take a look at > >

Re: HTML in ValidationError?

2008-08-24 Thread James Bennett
On Sun, Aug 24, 2008 at 7:07 AM, coan <[EMAIL PROTECTED]> wrote: > I wonder why custom error messages are considered more dangerous than > the help_text in the same form? Because people do things like this: class HackMySiteForm(forms.Form): some_text = forms.CharField(max_length=255)

Re: Making Custom Model Methods to Work

2008-08-24 Thread rmschne
Daniel You helped a lot. You are right that my code wasn't clear. I only extracted snipets and forgot bits, e.g. talk _title and speaker_title which are in the model but not in what I reported. Frankly, all I'm trying to do right now is experiment to learn how this works. Eventually, I have a

Admin: Showing attributes in drop list

2008-08-24 Thread Gerard Petersen
Hi All, With some relational models in place I use droplists in the admin interface to fill my fields. There's a 1-to-n relation between customer and project that the admin module respects with a droplist. The problem is that the droplist shows "customer object" for all entries instead of a

Re: Showing staff users from another model

2008-08-24 Thread Mark
I played for a while and this is my result: StaffSeq = tuple((str(i),)*2 for i in \ auth.models.User.objects.filter(is_staff=True)) (..) models.CharField(max_length=30,choices=StaffSeq) Are there better ways to do this? Mark On Sunday 24 August 2008 13:18:42 Mark wrote: > This class

Techniques to store the confidential matters

2008-08-24 Thread deepa
Techniques to store the confidential matters Workflow process rules http://www.freewebs.com/businesprocs/ Database management http://www.freewebs.com/businesprocs/ BPMN process modeler http://www.freewebs.com/businesprocs/ Prozessautomatisierung http://www.freewebs.com/businesprocs/

Re: unregister in old versions of django

2008-08-24 Thread James Bennett
On Sun, Aug 24, 2008 at 6:23 AM, James Bennett <[EMAIL PROTECTED]> wrote: > Which shows you full API documentation for the AdminSite class, > listing all of its methods and what they do, including this one: (and of course if you have DJANGO_SETTINGS_MODULE set properly, there's also the

Re: HTML in ValidationError?

2008-08-24 Thread coan
On Aug 24, 2:13 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Sun, Aug 24, 2008 at 7:07 AM, coan <[EMAIL PROTECTED]> wrote: > > I wonder why custom error messages are considered more dangerous than > > the help_text in the same form? > > Because people do things like this: >            

Template path for new admin doc broken in revision 8520?

2008-08-24 Thread Ulf Kronman
Hi all, some time ago, I noticed that I got an error when I clicked on the link to Documentation in the Django admin. I also saw that admin docs had been moved from /django/contrib/admin/templates/admin_doc/ to /django/contrib/admindocs/templates/admin_doc/ but some part of my Django

Showing staff users from another model

2008-08-24 Thread Mark
This class is only for the admin page. In the following model I'd like to make owned_by a dropdown box showing staff users. from django.db import models from django.contrib import admin from django.contrib import auth class Car(models.Model): brand = models.CharField(max_length=20)

Re: First App: devel server - can't establish a connection to 127.0.0.1

2008-08-24 Thread Robert Erbaron
> Each time what? It's a development server, expected to be used as you > develop your code. It's pretty good but not perfect about re-loading itself I typically do a long-term development session for a day or two... then go off an do another project for a while (a couple days.) So I'd shut

Admin problems :(

2008-08-24 Thread Shadow
Hi, I'm having some issues with the admin app (using svn rev #8520). 1) I can't get my apps models to show (logged in as superuser). I've added: " class Admin: pass " to each one with no affect. But I can still see them in user permissions?! 2) The "Change password" link gives the

Re: Write Caching

2008-08-24 Thread Steve Potter
This is an interesting idea that I wouldn't have thought of. However, I'm not sure that every select is equal to a display. For example if I load the objects via the admin. Also, I am not sure as there would be a huge gain as the same number or queries would still be executed, however in this

Re: Showing staff users from another model

2008-08-24 Thread James Bennett
On Sun, Aug 24, 2008 at 7:26 AM, Mark <[EMAIL PROTECTED]> wrote: > Are there better ways to do this? Yes. from django.db import models from django.contrib.auth.models import User class Car(models.Model): brand = models.CharField(max_length=20) color = models.CharField(max_length=10)

Re: Admin: Showing attributes in drop list

2008-08-24 Thread Erik Allik
You could define the __unicode__ (or __str__) method for the Customer class: class Customer(models.Model): def __unicode__(self): return '%s %s' % (self.first_name, self.last_name) On 24.08.2008, at 15:22, Gerard Petersen wrote: > > Hi All, > > With some relational

Re: Admin problems :(

2008-08-24 Thread Erik Allik
You should consult the documentation (not djangobook.com) about how the admin site should be set up. Erik On 24.08.2008, at 17:20, Shadow wrote: > > Hi, I'm having some issues with the admin app (using svn rev #8520). > > 1) I can't get my apps models to show (logged in as superuser). > >

Re: Module not callable (Practical Django Projects)

2008-08-24 Thread Cubells
En/na marsii ha escrit: > Hi! > I working whit the book Practical Django Project and have a problem > with th weblog example. > > (I have Django revision 8511. > > I got the following error when I try to add an entry: > --- > TypeError at

Re: ANN: django-morsels

2008-08-24 Thread Richard Ward
I too am unable to display the morsels. I believe it is install correctly. I can add morsels. The morsel tag generates no error when the template is generated. This is my context setting: TEMPLATE_CONTEXT_PROCESSORS = ( "django.core.context_processors.auth",

Re: Admin problems :(

2008-08-24 Thread Shadow
ah... :P thanks But what about the "Change password" link? Not that it really matters... but wondering if its another thing I'm doing wrong? cheers On Aug 25, 12:53 am, Erik Allik <[EMAIL PROTECTED]> wrote: > You should consult the documentation (not djangobook.com) about how   > the admin

Re: Module not callable (Practical Django Projects)

2008-08-24 Thread Cubells
En/na marsii ha escrit: > excerp_html = models.TextField(editable=False, blank=True) > _ ↓ excerpt_html = models.TextField(editable=False, blank=True) You have only that mistake in the code you've attached... Your models.py works on my system. Cheers...

Re: Admin problems :(

2008-08-24 Thread Steve Potter
What Erik is saying is that in recent versions of Django you no longer use the same syntax to activate the admin. This happened when the newforms-admin branch was merged. Steve On Aug 24, 10:13 am, Shadow <[EMAIL PROTECTED]> wrote: > ah... :P thanks > > But what about the "Change password"

Re: Admin problems :(

2008-08-24 Thread Shadow
sorry, that was a "ah... (dam, silly me)" not a "ah... (Erik is strange :s)" ;) So I've managed to get it to work now :D But I'm not sure why the "Change password" link still isn't working. I'm not sure it's associated with the models? http://dpaste.com/73515/ Cheers On Aug 25, 1:17 am,

Re: Template path for new admin doc broken in revision 8520?

2008-08-24 Thread Karen Tracey
On Sun, Aug 24, 2008 at 10:27 AM, Shadow <[EMAIL PROTECTED]>wrote: > > Hi, not an expert! > > but I think I had this same problem. The admin docs were fairly > recently moved into a separate app. So you'll need to update your urls > to something like: > >

Re: Module not callable (Practical Django Projects)

2008-08-24 Thread Christian Joergensen
marsii wrote: > I working whit the book Practical Django Project and have a problem > with th weblog example. > > (I have Django revision 8511. > > I got the following error when I try to add an entry: > --- > TypeError at

Re: url problem

2008-08-24 Thread Handle Huang
thanks for your replay. but my problem is still here, the include function seems not work( I use the last svn version of Django ). And you say why I having serveral different URLS pointing to the same view is that the inculde function not work, I have to point it directly (just to test if the view

Re: Admin: Showing attributes in drop list

2008-08-24 Thread Gerard Petersen
Erik, Marvelous! I saw this in the tutorial but I missed the part where admin uses it as well. Thanx and greetz! Gerard. Erik Allik wrote: > You could define the __unicode__ (or __str__) method for the Customer > class: > > class Customer(models.Model): > > > def

Re: Showing staff users from another model

2008-08-24 Thread Mark
> > Are there better ways to do this? > Yes. > owned_by = models.ForeignKey(User, limit_choices_to={ 'is_staff': True > }) > The model documentation covers the 'limit_choices_to' argument, as > well as the proper syntax for setting up foreign keys. I agree, there is plenty of documentation,

Re: Admin problems :(

2008-08-24 Thread Karen Tracey
On Sun, Aug 24, 2008 at 11:33 AM, Shadow <[EMAIL PROTECTED]>wrote: > > But I'm not sure why the "Change password" link still isn't working. > I'm not sure it's associated with the models? > > http://dpaste.com/73515/ > That's a bug in Django. I've opened a ticket with a patch to get it fixed:

Re: Sum Values in DB

2008-08-24 Thread [EMAIL PROTECTED]
That depends, if this is going to be used for single instances I would make it a method on the model, if this is going to be used for a model as a whole(or over a queryset), I would make it a method on a custom manager. On Aug 23, 6:46 pm, [EMAIL PROTECTED] wrote: > Thanks. > > So if I have

Re: Template path for new admin doc broken in revision 8520?

2008-08-24 Thread Shadow
Are yes, that too ;) On Aug 25, 1:36 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Sun, Aug 24, 2008 at 10:27 AM, Shadow <[EMAIL PROTECTED]>wrote: > > > > > > > Hi, not an expert! > > > but I think I had this same problem. The admin docs were fairly > > recently moved into a separate app.

Re: HTML in ValidationError?

2008-08-24 Thread coan
On Aug 24, 1:18 am, "Tim Kersten" <[EMAIL PROTECTED]> wrote: > Seehttp://www.djangoproject.com/documentation/templates/#automatic-html-... > > Tim ^,^ It doesn't look as the form object is subject to this automatic html escaping, because you can pass html into the form object like this:

Re: locale name conflict (deploy issue)

2008-08-24 Thread Prairie Dogg
I ran into this problem as well when I upgraded to the most recent django trunk. I found out about it because my tests failed the following error: from locale import normalize ImportError: cannot import name normalize Whoever is writing the patch for ticket #5494 (http://

url problem

2008-08-24 Thread Handle Huang
Hi all: I have a strange problem, In my project urls.py I define as follow: urlpatterns = patterns('', # Example: # (r'^urus/', include('urus.foo.urls')), # Uncomment this for admin: (r'^admin/', include('django.contrib.admin.urls')), (r'^site_media/(?P.*)$',

No "normalize" in locale(?)

2008-08-24 Thread Malcolm Tredinnick
On Sun, 2008-08-24 at 10:14 -0700, Prairie Dogg wrote: > I ran into this problem as well when I upgraded to the most recent > django trunk. I found out about it because my tests failed the > following error: > > from locale import normalize > ImportError: cannot import name normalize So

Re: unregister in old versions of django

2008-08-24 Thread aleray
Ok, I was affraid of this. Now, I think I will attach a little javascript code to hide what I don't want to see in the admin interface. That's my best option. Thank you very much for helping. Best On Aug 24, 2:01 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Sun, Aug 24, 2008 at 6:40 AM,

Making Custom Model Methods to Work

2008-08-24 Thread rmschne
I'm new to Django, and have played with Python for a few years on and off (not a real programmer). I'm keen to use Django to explore some data because of its custom data models which I plan to rely on extensively (putting the complex code there). Try as I might, I can't see how to get them to

Re: Template path for new admin doc broken in revision 8520?

2008-08-24 Thread Ulf Kronman
Thanks Karen and Shadow, > > > urlpatterns = patterns('', > > >    # Admin > > >    (r'^admin/doc/', include('django.contrib.admindocs.urls')), > > >    (r'^admin/(.*)', admin.site.root), > > > ) > > You need that in urls.py,  plus you need  'django.contrib.admindocs' added > > to your

Re: FormWizard Problems

2008-08-24 Thread lingrlongr
Looks like my models are working. (YAY!) My save routine failed though, but I finally figured it out. So the done() function looks like this now: def done(self, request, form_list): o = PurchaseApplication() for form in form_list: form.instance = o form.save(commit=False)

Re: Noob: form class location

2008-08-24 Thread phillc
if im moving my form related logic to another file, i wouldnt really need to import forms else where? ;) On Aug 23, 9:10 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On Sat, Aug 23, 2008 at 8:59 PM, Julien Phalip <[EMAIL PROTECTED]> wrote: > > > Hi, > > > In Django there are no

Changing Login Page for Admin

2008-08-24 Thread Tim Sawyer
Hi, I'm using the newforms admin stuff, and I'd like to use my own URL for the login page for the admin site. So, if someone goes to /admin on my site (which is where the admin site is located), I'd like to redirect to /private/login/?next=/admin. (The reason I want to do that is that I have

limiting choices in admin.ModelAdmin based on request.user

2008-08-24 Thread Patrick J. Anderson
How should I limit choices for ForeignKey fields in admin.ModelAdmin instances based on request.user attributes, since I can't pass a request object to the forms.ModelForm constructor? --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: urlpatterns and generic views cheatsheet

2008-08-24 Thread Idan
Useful! Thank you. :) -I On Aug 23, 3:11 pm, DavidY <[EMAIL PROTECTED]> wrote: > Here is a summary of all the tutorials and docs that I have read on > urlpatterns and generic views. It is a 2 page, concise, example code > based cheat sheet. > >

Saving an unbound form

2008-08-24 Thread [EMAIL PROTECTED]
Hello, I have a form that I have created and it works fine. I am now trying to save this form. The data returned from the form spans a relationship and should update 2 tables associated by a foreign key. >From what I have read on the docs, because it is an unbound form I need to write my own

Re: Audit Trail

2008-08-24 Thread Larrik Jaerico
Sérgio, Sorry about the **kwargs thing, my fault. I'm the one who patched AuditTrail to reflect the newest version of Django, but since I have some custom code in there I had to go line-by-line and figure out what to bring back to the website. I missed the **kwargs thing, though, it seems.

Re: Noob: form class location

2008-08-24 Thread Gerard Petersen
True, but it took me some figuring out and there's still some 'spaghetti'. The import of models was needed on more then one place (next to views.py) because of the meta class. myforms.py: from models import * class CustomerForm(ModelForm): class Meta: model = Customer Regards,

Re: Saving an unbound form

2008-08-24 Thread Karen Tracey
On Sun, Aug 24, 2008 at 4:56 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>wrote: > > Hello, > > I have a form that I have created and it works fine. I am now trying > to save this form. The data returned from the form spans a > relationship and should update 2 tables associated by a foreign key. > >

Re: list_filter for my own views

2008-08-24 Thread timc3
Well I implemented it using a queryset. TemplateTag that includes a template to build the filter, then a function that will parse the queryset and apply the querystring to the list_detail view. I also changed my paginator templatetag so that it could parse the Querystring through to build up

Re: locale name conflict (deploy issue)

2008-08-24 Thread msaelices
Maybe you have an __init__.py inside locale directory? On 16 ago, 13:12, dcoy <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to deploy my django project to my VPN (CentOS 5 python > 2.4). I'm having ALL kinds of issues, nothing seems to work after > following the steps in the installation

Re: Example of template tag I can modify?

2008-08-24 Thread Leaf
Also, I was wondering if you could provide me with one could do the same thing, but with a variable. I'm sorry if this seems a bit freeloader, but I don't quite understand the custom tag docs and think it would be easier to learn by example with tags that do the kind of things I'd write tags to

Re: ANN: django-morsels

2008-08-24 Thread Itai Tavor
Hi Richard, Can you provide more information? What URL did you enter in the morsel, and at what URL are you viewing the template that tries to include the morsel? Also, does your SITE_ID setting match the site you selected in the morsel? Itai On 24/08/2008, at 9:11 PM, Richard Ward

Re: Example of template tag I can modify?

2008-08-24 Thread Erik Allik
If you consult the documentation, you will see it has code examples. It seems to me that what you're looking for are inclusion tags. Django is famous for its high quality documentation so I doubt it can't help you. Erik P.S. no HTML tables for layout! :) On 25.08.2008, at 3:05, Leaf

Example of template tag I can modify?

2008-08-24 Thread Leaf
It's me again. After yelling, "I HATE WINDOWS!", switching to Mac, and not thinking about Django again until I upgraded to OS X 10.5 (with Python 2.5 and SQLite 3 included), I've decided to rewrite my Dj Styles application to brush up on my skills. One of the fundamental concepts of Dj Styles is

Re: threadedforum: Anybody that uses it?

2008-08-24 Thread Gus
I'm looking at using this as well, have you got it working? any feedback? g On Jul 30, 6:29 am, Berco Beute <[EMAIL PROTECTED]> wrote: > threadedforum(http://code.google.com/p/django-threadedforum/) seems > like a good forum application for my site, but the documentation is > very minimal (to

Re: APPEND_SLASH and Apache

2008-08-24 Thread [EMAIL PROTECTED]
I was having this exact same problem. I found a solution in chapter 20 of the Django book http://www.djangobook.com/en/1.0/chapter20/ or see the highlighted section of the same page http://www.diigo.com/annotated/dc0730e6af51d60cbcc6ff6a8daf847b According to it "If you deploy Django at a

Re: Problem with generic views in tutorial example

2008-08-24 Thread Rodney Topor
> Anurag, Thanks.  That worked for me too.  But it's hardly a solution. > Now I can't use admin.  I want both.  Is that asking too much?  Has > anyone else any ideas? OK, I've solved all my problems. It was my mistake. For some reason, I had these two lines in urls.py in the reverse order: