Re: Should I use Django?

2009-03-28 Thread Wiiboy

I thought I'd tell you: I decided to switch to Django/App Engine.
:)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Design Issue / forward referencing

2009-03-28 Thread Alex Gaynor
On Sat, Mar 28, 2009 at 10:14 PM, mahesh  wrote:

>
> Hi Alex,
>
> Solution given by by as worked :) However I wonder how come 'self'
> worked against self (without quotes)
>
> Thank You
> -Mahesh/
>
> On Mar 28, 8:57 pm, Alex Gaynor  wrote:
> > On Sat, Mar 28, 2009 at 10:55 AM, mahesh  wrote:
> >
> > > I am working on a (College) course manager project. Here is a
> > > situation where any course have 0 (Zero) or More Prerequisites, anyone
> > > who register for a course should satisfy dependency.
> >
> > > /course_modue/model.py hash this..
> >
> > > Here how my model looks like ..
> >
> > > class CourseRelation(models.Model):
> > >course = models.CharField(max_length=64)
> > >prereq = models.ManyToManyField(CourseRelation)
> > >instructor = models.ForeignKey(User)
> > >is_active = models.BooleanField(default=False)
> >
> > > Command - python manage.py sqlall course_module error out saying
> > >  File "/course_module/models.py", line 27, in CourseRelation
> > >prereq = models.ManyToManyField(CourseRelation)
> > > NameError: name 'CourseRelation' is not defined
> >
> > > Is this a case of forward referencing ? how do I solve it ?
> >
> > > Thx/Mahesh.
> >
> > To do references to the same model you do ManyToManyField('self').
> >
> > Alex
> >
> > --
> > "I disapprove of what you say, but I will defend to the death your right
> to
> > say it." --Voltaire
> > "The people's good is the highest law."--Cicero
> >
>
self is not in scope there, and as you've already discovered you can't
reference the class name since the class doesn't exist yet, therefore Django
chose 'self' as a magic identifier for this.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Design Issue / forward referencing

2009-03-28 Thread mahesh

Hi Alex,

Solution given by by as worked :) However I wonder how come 'self'
worked against self (without quotes)

Thank You
-Mahesh/

On Mar 28, 8:57 pm, Alex Gaynor  wrote:
> On Sat, Mar 28, 2009 at 10:55 AM, mahesh  wrote:
>
> > I am working on a (College) course manager project. Here is a
> > situation where any course have 0 (Zero) or More Prerequisites, anyone
> > who register for a course should satisfy dependency.
>
> > /course_modue/model.py hash this..
>
> > Here how my model looks like ..
>
> > class CourseRelation(models.Model):
> >    course = models.CharField(max_length=64)
> >    prereq = models.ManyToManyField(CourseRelation)
> >    instructor = models.ForeignKey(User)
> >    is_active = models.BooleanField(default=False)
>
> > Command - python manage.py sqlall course_module error out saying
> >  File "/course_module/models.py", line 27, in CourseRelation
> >    prereq = models.ManyToManyField(CourseRelation)
> > NameError: name 'CourseRelation' is not defined
>
> > Is this a case of forward referencing ? how do I solve it ?
>
> > Thx/Mahesh.
>
> To do references to the same model you do ManyToManyField('self').
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Generic View for create , update and delete !

2009-03-28 Thread Dr.Hamza Mousa
Thanks a lot André  , already tried it , somehow the problem was not in my
tries or code , but in the server , its somehow stuck at certain pages . so
i could not see the effects .

Also now the post_save_redirect and post_delete_redirect don't redirect me
to the specific page i assigned :(

also how can replace the delete confirm page with JavaScript alert
confirmation  message ?!



On Sun, Mar 29, 2009 at 4:10 AM, André Santos  wrote:

>
> Try this one:
>
> http://www.b-list.org/weblog/2006/nov/16/django-tips-get-most-out-generic-views/
>
> 2009/3/28 Hamza :
> >
> > Hello ,
> >
> > am trying to use Generic view instead of using the old view way ,
> > however am a django newbie , i tried several tutorials , documentation
> > and non seems works with me yet . can anyone point me an example
> > ( full working good example )  of using generic view 
> >
> > Regards
> >
> > >
> >
>
>
>
> --
> André Santos Teixeira de Carvalho
> Graduando em Ciência da Computação - DCC/UFRJ
>
> >
>


-- 
Hamza E.e Mousa

www.neoxero.com
www.goomedic.com
www.medpeek.com
www.freewaydesign.com

http://www.twitter.com/hamzamusa
http://twitter.com/goomedic

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Generic View for create , update and delete !

2009-03-28 Thread André Santos

Try this one:
http://www.b-list.org/weblog/2006/nov/16/django-tips-get-most-out-generic-views/

2009/3/28 Hamza :
>
> Hello ,
>
> am trying to use Generic view instead of using the old view way ,
> however am a django newbie , i tried several tutorials , documentation
> and non seems works with me yet . can anyone point me an example
> ( full working good example )  of using generic view 
>
> Regards
>
> >
>



-- 
André Santos Teixeira de Carvalho
Graduando em Ciência da Computação - DCC/UFRJ

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Testing form posting

2009-03-28 Thread tsmets

I was wondering how I could test / unittest form posting ?


class TestSomeRequest(TestCase):

  def testCallDefaultDpasteURL(self):
response = self.client.get('/my_app/')
self.failUnlessEqual(response.status_code, 200)

  def testCallDpasteAboutURL(self):
postedData =  {
  'poster'  : 'test',
  'code': SIMPLE_POST,
  'comment' : 'No comment'
}
form = forms.CodePostForm(postedData)
response = self.client.post('/myApp/post', form)
self.failUnlessEqual(response.status_code, 200)

This does not seems OK ???
Any hint would be appreciated

\T,
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Installing Django

2009-03-28 Thread Mike Ramirez
On Saturday 28 March 2009 12:43:26 pm stars wrote:
> I'm totally new at Python and Django and I'm having trouble with the
> installation. I'm running windows vista and I have downloaded pyhton
> 2.6. So basically, I went through the install directions a millon
> times, and nothing worked..
>
> I need someone to walk me through it, step by step so I know exactly
> what I'm doing.
>
> thanks!

It would be more helpful if you stated step by step what you did. 

I find when I want to ask for help, this is what I do first. I'll walk myself 
through each step slowly and examine what is required for the current step, 
then if I'm unsure of the requirements go check out what they really mean. 
Search Google, the official documents, etc...  and repeat for each step. 
Usually I'll find the answer before I hit send. 

I can say that the django docs are very well written, but (correctly) assumes 
more than a passing knowledge in python and your operating system.  In this 
case, I think you should understand more about how python works when using 
external libraries and an understanding of the PYTHONPATH/sys.path, which 
also leads into the Environment variables mentioned previously.  But this is 
just a small guess based on the info provided here. 

Mike
-- 
Ah, but a man's grasp should exceed his reach, 
Or what's a heaven for ?
-- Robert Browning, "Andrea del Sarto"


signature.asc
Description: This is a digitally signed message part.


Re: Installing Django

2009-03-28 Thread Srik

I hope below link helps.

http://www.djangoapp.com/blog/2008/11/18/installing-django-on-windows/

On Mar 28, 7:43 pm, stars  wrote:
> I'm totally new at Python and Django and I'm having trouble with the
> installation. I'm running windows vista and I have downloaded pyhton
> 2.6. So basically, I went through the install directions a millon
> times, and nothing worked..
>
> I need someone to walk me through it, step by step so I know exactly
> what I'm doing.
>
> thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Curious Error

2009-03-28 Thread Ramdas S
Can someone advise? I have the same code working in several web sites. But
since moving to 10177, I am getting this error. It sometimes works in Dev
server, in Apache its been a problem

http://dpaste.com/20529/
-- 
Ramdas S
+91 9342 583 065

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Installing Django

2009-03-28 Thread Y

Why not try Instant Django for Windows and avoid the installation
process altogether?
http://www.instantdjango.com/

Y

On Mar 28, 12:43 pm, stars  wrote:
> I'm totally new at Python and Django and I'm having trouble with the
> installation. I'm running windows vista and I have downloaded pyhton
> 2.6. So basically, I went through the install directions a millon
> times, and nothing worked..
>
> I need someone to walk me through it, step by step so I know exactly
> what I'm doing.
>
> thanks!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Pass a queryset to the admin and display using existing app/model admin?

2009-03-28 Thread Rob Hudson

I have a use case where we want a search form to search across almost
all columns of this particular model.  Upon submit, I thought it would
be a nice feature (since this is already in the admin) to use the
already existing settings for my particular app/model instance.  Is it
possible to build up the queryset in my own view and pass that off to
the admin to display?

I already have a custom admin set up if there's something that's
close.

Thanks,
Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: localhost:8000 problem

2009-03-28 Thread nick

Right after I click "post" to that problem,  I realized that "Work
Offline" was checked.
It works now. Thank you Karen for prompt reply, I appreciate it. I am
sure there are more
to come :-)


On Mar 28, 4:50 pm, Karen Tracey  wrote:
> On Sat, Mar 28, 2009 at 5:44 PM, nick  wrote:
>
> > I am a django newbie.
> > The first example I tried from django's tutorial "mysite", ran python
> > manage.py runserver.
> > Server runs with no errors but my web browser (firefox) get "Firefox
> > offline mode error" and not django 404 errors.
> > I tried different localhost ports, but same error. My browser doesn't
> > seem to communicate with django's lightweight server.
> > What to do?
>
> Go to the Firefox File menu and see if "Work Offline" is checked.  If it is,
> select it, so that it becomes unchecked.  Then Firefox won't stop any
> attempt to connect before even trying.  If "Work offline" is not checked, I
> have no idea.  It sounds like a Firefox problem so I'd probably try a
> different browser, and assuming that works pursue tracking down what the
> problem with Firefox is.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload: how to validate file type

2009-03-28 Thread P M
yes you can, because signature of pdf is in the starting of 1st chunk of
stream... rest of the things are of hardly interest for libmagic
identification...

what ever method you are using to handle the chunks/streams is still the
same, regardless of type of data user is uploading,

one more tip :) libmagic python interface also provide a option to you to
feed in stream/part of chunk... so hack that simple interface and you are
done ;)

greetings,
Puneet


On Sat, Mar 28, 2009 at 10:37 PM, Torsten Bronger <
bron...@physik.rwth-aachen.de> wrote:

>
> Hallöchen!
>
> P M writes:
>
> > there are various ways to check, but best will be to use
> > Python-libmagic interface... it did worked well for me ..
>
> Thank for the hint, however, the interesting part is whether I can
> safely tamper with the file object in the clean method, so that the
> actual download with .chunks() afterwards still works correctly.
>
> Tschö,
> Torsten.
>
> --
> Torsten Bronger, aquisgrana, europa vetus
>   Jabber ID: torsten.bron...@jabber.rwth-aachen.de
>
>
> >
>


-- 
If you spin an oriental man, does he become disoriented?
(-: ¿ʇɥǝɹpɹǝʌ ɟdoʞ uǝp ɹıp ɥɔı ,qɐɥ 'ɐɐu

is der net süß » ε(●̮̮̃•̃)з
-PM

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic on-action update form

2009-03-28 Thread Nizan Freedman

can you supply an example of adding JS to a widget?

On Mar 28, 5:46 pm, Daniel Roseman 
wrote:
> On Mar 28, 1:44 pm, Nizan Freedman  wrote:
>
> > is it possible to make a Django form that hides\shows different fields
> > by other fields changing?
>
> If you write some Javascript, yes.
> --
> DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



share info on 2 systems

2009-03-28 Thread Leonel Nunez

Hello

I have 2 applications on different servers and I need to share any
selected record on the ADMIN on the 2 applications

Is there a Django way to do it

Thank you

Leonel



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: localhost:8000 problem

2009-03-28 Thread Karen Tracey
On Sat, Mar 28, 2009 at 5:44 PM, nick  wrote:

>
> I am a django newbie.
> The first example I tried from django's tutorial "mysite", ran python
> manage.py runserver.
> Server runs with no errors but my web browser (firefox) get "Firefox
> offline mode error" and not django 404 errors.
> I tried different localhost ports, but same error. My browser doesn't
> seem to communicate with django's lightweight server.
> What to do?
>

Go to the Firefox File menu and see if "Work Offline" is checked.  If it is,
select it, so that it becomes unchecked.  Then Firefox won't stop any
attempt to connect before even trying.  If "Work offline" is not checked, I
have no idea.  It sounds like a Firefox problem so I'd probably try a
different browser, and assuming that works pursue tracking down what the
problem with Firefox is.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Installing Django

2009-03-28 Thread stars

Yes I tried to follow those instructions and I know I didnt di it
right, basically as far as I got would be..I unzipped Django and
attempted the install..which did nothing. I didnt get an errors, I
have no idea how to install it. Thats what I'm not understanding,
thats why I would like someone to walk me through it..step by step, i
never used these programs before, so installing them is complicated
for me.

Step by step would be very helpful and also help me in understanding.

As for defining the environment variables..how do I do that?

On Mar 28, 1:44 pm, "Dr.Hamza Mousa"  wrote:
> You need to define " Environment Variables " parameter in windows ,
> In User Variable :
>
> PATH : C:\Python26\Lib\site-packages\django\bin ( add the path to your
> django binary directory )  .
>
> -
>
> and also in System Variable , make sure you have the Python path as well
>
> On Sat, Mar 28, 2009 at 10:22 PM, Dougal Matthews wrote:
>
>
>
>
>
>
>
> > Your not giving us anything to go on here. How far do you get? do you
> > get any errors?
>
> > I am assuming you followed the very detailed instructions here;
> >http://docs.djangoproject.com/en/dev/topics/install/#topics-install
>
> > Dougal
>
> > ---
> > Dougal Matthews - @d0ugal
> >http://www.dougalmatthews.com/
>
> > 2009/3/28 stars :
>
> > > I'm totally new at Python and Django and I'm having trouble with the
> > > installation. I'm running windows vista and I have downloaded pyhton
> > > 2.6. So basically, I went through the install directions a millon
> > > times, and nothing worked..
>
> > > I need someone to walk me through it, step by step so I know exactly
> > > what I'm doing.
>
> > > thanks!
>
> --
> Hamza E.e Mousa
>
> www.neoxero.comwww.goomedic.comwww.medpeek.comwww.freewaydesign.com
>
> http://www.twitter.com/hamzamusahttp://twitter.com/goomedic- Hide quoted text 
> -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



localhost:8000 problem

2009-03-28 Thread nick

I am a django newbie.
The first example I tried from django's tutorial "mysite", ran python
manage.py runserver.
Server runs with no errors but my web browser (firefox) get "Firefox
offline mode error" and not django 404 errors.
I tried different localhost ports, but same error. My browser doesn't
seem to communicate with django's lightweight server.
What to do?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: help with form's cleaned_data

2009-03-28 Thread ihomest...@gmail.com

i have found it. just use form.error.

On Mar 28, 5:18 pm, ihome  wrote:
> Hi,
>
> My form always gets is_valid() as False. Some validation is wrong.
>
> Is there any error message I could dump from form or form.cleaned_data
> to understand why is_valid() is always false?
>
> thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload: how to validate file type

2009-03-28 Thread Torsten Bronger

Hallöchen!

P M writes:

> there are various ways to check, but best will be to use
> Python-libmagic interface... it did worked well for me ..

Thank for the hint, however, the interesting part is whether I can
safely tamper with the file object in the clean method, so that the
actual download with .chunks() afterwards still works correctly.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
   Jabber ID: torsten.bron...@jabber.rwth-aachen.de


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload: how to validate file type

2009-03-28 Thread P M
servus,

there are various ways to check, but best will be to use Python-libmagic
interface... it did worked well for me ..

mit freundliche Grüß

On Sat, Mar 28, 2009 at 10:16 PM, Torsten Bronger <
bron...@physik.rwth-aachen.de> wrote:

>
> Hallöchen!
>
> I'd like to ensure that people only upload PDF files, so the file
> must start with "%PDF".  If the file starts with something else, the
> form must not validate.
>
> How do I do that?  I though about a clean_... method which reads the
> start of the file and then re-opens it.  Is this a good idea?
>
> Tschö,
> Torsten.
>
> --
> Torsten Bronger, aquisgrana, europa vetus
>   Jabber ID: torsten.bron...@jabber.rwth-aachen.de
>
>
> >
>


-- 
If you spin an oriental man, does he become disoriented?
(-: ¿ʇɥǝɹpɹǝʌ ɟdoʞ uǝp ɹıp ɥɔı ,qɐɥ 'ɐɐu

is der net süß » ε(●̮̮̃•̃)з
-PM

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



help with form's cleaned_data

2009-03-28 Thread ihome

Hi,

My form always gets is_valid() as False. Some validation is wrong.

Is there any error message I could dump from form or form.cleaned_data
to understand why is_valid() is always false?

thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



File upload: how to validate file type

2009-03-28 Thread Torsten Bronger

Hallöchen!

I'd like to ensure that people only upload PDF files, so the file
must start with "%PDF".  If the file starts with something else, the
form must not validate.

How do I do that?  I though about a clean_... method which reads the
start of the file and then re-opens it.  Is this a good idea?

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
   Jabber ID: torsten.bron...@jabber.rwth-aachen.de


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Installing Django

2009-03-28 Thread Dr.Hamza Mousa
You need to define " Environment Variables " parameter in windows ,
In User Variable :

PATH : C:\Python26\Lib\site-packages\django\bin ( add the path to your
django binary directory )  .

-

and also in System Variable , make sure you have the Python path as well








On Sat, Mar 28, 2009 at 10:22 PM, Dougal Matthews wrote:

>
> Your not giving us anything to go on here. How far do you get? do you
> get any errors?
>
> I am assuming you followed the very detailed instructions here;
> http://docs.djangoproject.com/en/dev/topics/install/#topics-install
>
> Dougal
>
>
> ---
> Dougal Matthews - @d0ugal
> http://www.dougalmatthews.com/
>
>
>
>
> 2009/3/28 stars :
> >
> > I'm totally new at Python and Django and I'm having trouble with the
> > installation. I'm running windows vista and I have downloaded pyhton
> > 2.6. So basically, I went through the install directions a millon
> > times, and nothing worked..
> >
> > I need someone to walk me through it, step by step so I know exactly
> > what I'm doing.
> >
> > thanks!
> >
> > >
> >
>
> >
>


-- 
Hamza E.e Mousa

www.neoxero.com
www.goomedic.com
www.medpeek.com
www.freewaydesign.com

http://www.twitter.com/hamzamusa
http://twitter.com/goomedic

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Installing Django

2009-03-28 Thread Dougal Matthews

Your not giving us anything to go on here. How far do you get? do you
get any errors?

I am assuming you followed the very detailed instructions here;
http://docs.djangoproject.com/en/dev/topics/install/#topics-install

Dougal


---
Dougal Matthews - @d0ugal
http://www.dougalmatthews.com/




2009/3/28 stars :
>
> I'm totally new at Python and Django and I'm having trouble with the
> installation. I'm running windows vista and I have downloaded pyhton
> 2.6. So basically, I went through the install directions a millon
> times, and nothing worked..
>
> I need someone to walk me through it, step by step so I know exactly
> what I'm doing.
>
> thanks!
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Installing Django

2009-03-28 Thread stars

I'm totally new at Python and Django and I'm having trouble with the
installation. I'm running windows vista and I have downloaded pyhton
2.6. So basically, I went through the install directions a millon
times, and nothing worked..

I need someone to walk me through it, step by step so I know exactly
what I'm doing.

thanks!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Fulltext searching

2009-03-28 Thread Petite Abeille


On Mar 26, 2009, at 10:37 PM, TheIvIaxx wrote:

> Is there a major benefit to go with one of these other
> packages or write something else beyond mysql-fulltext?

As always, it all depends on your requirements. For basic full text  
search, what comes bundled with most databases is Good Enough (SM).

Even SQLite comes packaged with a very handy full text search module:

http://www.sqlite.org/cvstrac/wiki?p=FtsTwo

You can see it in action bellow:

http://svr225.stepx.com:3388/search?q=django

HTH.

Cheers,

--
PA.
http://alt.textdrive.com/nanoki/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Generic View for create , update and delete !

2009-03-28 Thread Hamza

Hello ,

am trying to use Generic view instead of using the old view way ,
however am a django newbie , i tried several tutorials , documentation
and non seems works with me yet . can anyone point me an example
( full working good example )  of using generic view 

Regards

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django.contrib.auth.models.User User model can't be saved

2009-03-28 Thread Brian Neal

On Mar 28, 7:02 am, Joshua Partogi  wrote:
> Yes you're right. In my template I only have username, first_name,
> last_name, email and password. I also print out the errors too.

Probably what is happening is that some of the other fields you are
excluding are required fields. Thus you should use the ModelForm save
with commit=False, then assign values to the rest of the fields, then
do a save on the object.

new_member = form.save(commit=False)
new_member.x = something
new_member.y = something_else
...
new_member.save()

Where x and y are the other required fields.

>
> Are you saying that I should have all the other fields from
> django.contrib.auth.models.User too?
>

No, typically you don't want the user to be able to say if they are an
admin, etc.

BN
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with Field errors

2009-03-28 Thread Jack Orenstein

On Mar 28, 2009, at 12:26 PM, Daniel Roseman wrote:

>
> On Mar 28, 4:14 pm, Jack Orenstein  wrote:
>> My application needs to validate data from a from beyond the
>> validation of Fields done by django. So in my form handler, I check
>> Form.is_valid, and if that returns true, then I do my own validation.
>> In case of errors, I attach an error message to the field, e.g.
>>
>>  self.form.fields['foobar'].errors = 'some error message'
>>
>> And then I redisplay the form. But the error message doesn't show up,
>> even though the template includes
>>
>>  {{ form.foobar.errors }}
>>
>> And through logging I have confirmed that the errors attribute of the
>> field has been set, right before the render_to_response call
>> containing the form. I'm guessing that this has something to do with
>> the fact that the form already passed the is_valid check.
>>
>> How can I force the form to become "invalid" again, once my own
>> validation detects errors?
>>
>> Jack Orenstein
>
> Try self.form._errors['foobar'] instead.

That works, thank you.

Why does it work?

Jack

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with Field errors

2009-03-28 Thread Daniel Roseman

On Mar 28, 4:14 pm, Jack Orenstein  wrote:
> My application needs to validate data from a from beyond the  
> validation of Fields done by django. So in my form handler, I check  
> Form.is_valid, and if that returns true, then I do my own validation.  
> In case of errors, I attach an error message to the field, e.g.
>
>      self.form.fields['foobar'].errors = 'some error message'
>
> And then I redisplay the form. But the error message doesn't show up,  
> even though the template includes
>
>      {{ form.foobar.errors }}
>
> And through logging I have confirmed that the errors attribute of the  
> field has been set, right before the render_to_response call  
> containing the form. I'm guessing that this has something to do with  
> the fact that the form already passed the is_valid check.
>
> How can I force the form to become "invalid" again, once my own  
> validation detects errors?
>
> Jack Orenstein

Try self.form._errors['foobar'] instead.
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Problem with Field errors

2009-03-28 Thread Jack Orenstein

My application needs to validate data from a from beyond the  
validation of Fields done by django. So in my form handler, I check  
Form.is_valid, and if that returns true, then I do my own validation.  
In case of errors, I attach an error message to the field, e.g.

 self.form.fields['foobar'].errors = 'some error message'

And then I redisplay the form. But the error message doesn't show up,  
even though the template includes

 {{ form.foobar.errors }}

And through logging I have confirmed that the errors attribute of the  
field has been set, right before the render_to_response call  
containing the form. I'm guessing that this has something to do with  
the fact that the form already passed the is_valid check.

How can I force the form to become "invalid" again, once my own  
validation detects errors?

Jack Orenstein


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Design Issue / forward referencing

2009-03-28 Thread David Zhou

Also see:

http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ManyToManyField.symmetrical

-- dz



On Sat, Mar 28, 2009 at 11:57 AM, Alex Gaynor  wrote:
>
>
> On Sat, Mar 28, 2009 at 10:55 AM, mahesh  wrote:
>>
>> I am working on a (College) course manager project. Here is a
>> situation where any course have 0 (Zero) or More Prerequisites, anyone
>> who register for a course should satisfy dependency.
>>
>> /course_modue/model.py hash this..
>>
>> Here how my model looks like ..
>>
>> class CourseRelation(models.Model):
>>    course = models.CharField(max_length=64)
>>    prereq = models.ManyToManyField(CourseRelation)
>>    instructor = models.ForeignKey(User)
>>    is_active = models.BooleanField(default=False)
>>
>> Command - python manage.py sqlall course_module error out saying
>>  File "/course_module/models.py", line 27, in CourseRelation
>>    prereq = models.ManyToManyField(CourseRelation)
>> NameError: name 'CourseRelation' is not defined
>>
>> Is this a case of forward referencing ? how do I solve it ?
>>
>> Thx/Mahesh.
>>
>>
>>
>
> To do references to the same model you do ManyToManyField('self').
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Design Issue / forward referencing

2009-03-28 Thread Alex Gaynor
On Sat, Mar 28, 2009 at 10:55 AM, mahesh  wrote:

>
> I am working on a (College) course manager project. Here is a
> situation where any course have 0 (Zero) or More Prerequisites, anyone
> who register for a course should satisfy dependency.
>
> /course_modue/model.py hash this..
>
> Here how my model looks like ..
>
> class CourseRelation(models.Model):
>course = models.CharField(max_length=64)
>prereq = models.ManyToManyField(CourseRelation)
>instructor = models.ForeignKey(User)
>is_active = models.BooleanField(default=False)
>
> Command - python manage.py sqlall course_module error out saying
>  File "/course_module/models.py", line 27, in CourseRelation
>prereq = models.ManyToManyField(CourseRelation)
> NameError: name 'CourseRelation' is not defined
>
> Is this a case of forward referencing ? how do I solve it ?
>
> Thx/Mahesh.
>
>
> >
>
To do references to the same model you do ManyToManyField('self').

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Design Issue / forward referencing

2009-03-28 Thread mahesh

I am working on a (College) course manager project. Here is a
situation where any course have 0 (Zero) or More Prerequisites, anyone
who register for a course should satisfy dependency.

/course_modue/model.py hash this..

Here how my model looks like ..

class CourseRelation(models.Model):
course = models.CharField(max_length=64)
prereq = models.ManyToManyField(CourseRelation)
instructor = models.ForeignKey(User)
is_active = models.BooleanField(default=False)

Command - python manage.py sqlall course_module error out saying
  File "/course_module/models.py", line 27, in CourseRelation
prereq = models.ManyToManyField(CourseRelation)
NameError: name 'CourseRelation' is not defined

Is this a case of forward referencing ? how do I solve it ?

Thx/Mahesh.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Mysterious "=32" for all strings extracted from list showing up via send_mail

2009-03-28 Thread Peter Herndon

The answer is here:  http://www.faqs.org/rfcs/rfc2045.html

Specifically, section 6.7, "Quoted-Printable
Content-Transfer-Encoding".  If you take a tour through Python's email
module in the standard library, you'll find some bits for handling
decoding.

On Thu, Mar 26, 2009 at 4:11 PM, NoviceSortOf  wrote:
>
>
> My objective is to send a clean list of field names and values via
> email
> after the completion of a form in Django.
>
> When formating an email message after extracting a list of field names
> and values from a list i get a string that prints something like this.
>
> $print(message_str):
> ...
> name="Bill Jones"
> street="Baker St."
> zipcode="9"...
>
> When I send this string as message parameter with Send_mail it arrives
> looking like this in the body of the email
> ...
> name=3D"Bill Jones"
> street=3D"Baker St."
> zipcode=3D"9"...
>
> I'm curious where between the string being readable without the 3D via
> the Django debugger via Send_mail and into the arriving mail
> where the 3D might be interjected into the string.
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: No admin-url match when DEBUG=False

2009-03-28 Thread Stephan John

Am Freitag, 27. März 2009 21:05:09 schrieb Karen Tracey:
> On Fri, Mar 27, 2009 at 9:44 AM, Stephan John  wrote:
>
> Your calls to admin.site.register should not be in your models.py file.
> They should be in a file named admin.py and a call to admin.autodiscover()
> ought to be included in your urls.py, as described here:
>
> http://docs.djangoproject.com/en/dev/ref/contrib/admin/
>
> If you put the calls in models.py first it is intdeterminate when that file
> will be loaded, so unpredictable when the registrations will happen.  I'd
> guess when you run with DEBUG set to True your models.py hapens to be
> loaded early on, but not when you run with DEBUG=False.  Another problem
> with register calls in models.py is that if/when models.py file is imported
> multiple times, you will get AlreadyRegistered exceptions on the register
> calls, since the models were registered the first time models.py was
> loaded.
>
> Placing the registrations in admin.py and calling admin.autodiscover() from
> urls.py ensures that the admin registrations happen only once, at a
> predictable time.
>

>
> I can't explain that, but as a first step I'd change your setup to match
> standard practice.  Having admin registrations in models.py is just asking
> for trouble.
>
> Karen


YES! :-) That's it. With the registration in the file admin.py it works ok.
Thanks a lot!

Stephan


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic on-action update form

2009-03-28 Thread Daniel Roseman

On Mar 28, 1:44 pm, Nizan Freedman  wrote:
> is it possible to make a Django form that hides\shows different fields
> by other fields changing?

If you write some Javascript, yes.
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Dynamic on-action update form

2009-03-28 Thread Nizan Freedman

is it possible to make a Django form that hides\shows different fields
by other fields changing?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: redirect back after save

2009-03-28 Thread Eric Abrahamsen


On Mar 28, 2009, at 8:04 PM, Paddy Joy wrote:

>
> I have a form that can be called from multiple places. What's the best
> way to redirect back to the original page after the form has been
> saved.

I think the standard way to do this is to include a hidden form  
element (usually called "next") the value of which is set to the  
current page (or wherever you want to send the user). This value  
sticks during form processing, and is used as a redirect value  
afterwards. Many built-in or third-party forms are already set up to  
take advantage of a "next" (or something similar), and it's easy  
enough to do for your own forms.

HTH,
Eric


>
> Do I need to extract the HTTP referrer or is there a better way?
>
> Paddy
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



redirect back after save

2009-03-28 Thread Paddy Joy

I have a form that can be called from multiple places. What's the best
way to redirect back to the original page after the form has been
saved.

Do I need to extract the HTTP referrer or is there a better way?

Paddy
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django.contrib.auth.models.User User model can't be saved

2009-03-28 Thread Joshua Partogi



On Mar 28, 9:31 pm, Matthew Somerville 
wrote:
> Joshua Partogi wrote:
> > That is exactly the problem. No exception is thrown. But I guess it
> > didn't pass the validation because it wasn't redirecting to another
> > page. Which is funny because all the required field in
> > django.contrib.auth.models.User object is filled in.
>
> How are you printing out the form in the template? If it's not
> redirecting, it's not validating, so there's an error - make sure you're
> printing out all the errors in the template. Without any more clues, it
> could be something as simple as your form has method GET rather than
> POST. ;) But I'm guessing you don't want your registration form to have
> all the fields from the User model (such as is_superuser), and you're
> printing out only those ones you do want in the template, rather than
> restricting the form with the fields Meta variable, and so aren't
> printing out the error messages correctly. That's just a guess.

Yes you're right. In my template I only have username, first_name,
last_name, email and password. I also print out the errors too.


{{ form.first_name.errors }}
First Name
{{ form.first_name }}


{{ form.last_name.errors }}
Last Name
{{ form.last_name }}


{{ form.username.errors }}
Username
{{ form.username }}


{{ form.password.errors }}
Password
{{ form.password }}


{{ form.email.errors }}
E-mail
{{ form.email }}

 

Are you saying that I should have all the other fields from
django.contrib.auth.models.User too?

Thank you very much.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: send_mail and cc

2009-03-28 Thread drakkan

ok for the records subclassing EmailMessage this way work:

class MyEmailMessage(EmailMessage):
def __init__(self, subject='', body='', from_email=None, to=None,
cc=None, bcc=None,
connection=None, attachments=None, headers=None):
super(MyEmailMessage,self).__init__
(subject,body,from_email,to,bcc,connection,attachments,headers)
self.cc=cc

def message(self):
msg=super(MyEmailMessage,self).message()
msg['Cc']= ', '.join(self.cc)
return msg

def recipients(self):
return self.to + self.cc + self.bcc

regards
drakkan

On 28 Mar, 01:13, Malcolm Tredinnick  wrote:
> On Fri, 2009-03-27 at 16:50 -0700, drakkan wrote:
> > Hi all,
>
> > there is a way to send cc mail using django mail wrapper?
>
> > reading the official docs:
>
> >http://docs.djangoproject.com/en/dev/topics/email/#topics-email
>
> > seems only possible to define to and bcc recipients but not cc,
>
> That's correct, since "to" is functionally equivalent to "cc" (whereas
> "to" and "bcc" are not). You can, and are encouraged to, subclass the
> email message class if you want to add things like that.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Fulltext searching

2009-03-28 Thread Peter Herndon

In addition, full text indexing with Sphinx has been shown to be
faster than the same using MySql'ls fulltext search.

Django-NYC recently had some talks on search, and the gentleman who
presented on David Cramer's django-sphinx module had run some rough
timing tests.

On 3/27/09, Antoni Aloy  wrote:
>
> 2009/3/26 Malcolm Tredinnick :
>>
>> On Thu, 2009-03-26 at 14:37 -0700, TheIvIaxx wrote:
>>> So i have been trying to get a solid search going in django.  I have
>>> seen things liek Whoosh and Solr or Lucene(sp?) which all add fulltext
>>> searching to your models.  Are these better than the mysql fulltext
>>> searches?
>
> I prefer to stay away from database indexing so the application is
> database agnostic. I have integrated xapian successfully in some
> projects using django-xapian, and it works quite well. You can see it
> in action in trespams.com.
>
>
> --
> Antoni Aloy López
> Blog: http://trespams.com
> Site: http://apsl.net
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Overriding get_form to customize admin forms based on request

2009-03-28 Thread AndyB

I've tried various methods to achieve this.

I decided against overriding formfield_for_dbfield as it's doesn't get
a copy of the request object and I was hoping to avoid the
thread_locals hack.

I settled on overriding get_form in my ModelAdmin class and tried the
following:

class PageOptions(admin.ModelAdmin):
def get_form(self, request, obj=None, **kwargs):
if request.user.is_superuser:
self.fieldsets = ((None, {'fields':
('title','name',),}),)
else:
self.fieldsets = ((None, {'fields': ('title',),}),)
return super(PageOptions,self).get_form(request, obj=None,
**kwargs)

When I print fieldsets or declared_fieldsets from within get_form I
get None (or whatever I set as an initial value in PageOptions).

Why doesn't this work and is there a better way to do this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django wont display images on my CSS file

2009-03-28 Thread Nathan Reynolds

On Sat, Mar 28, 2009 at 7:17 AM, Ayaz Ahmed Khan  wrote:

> Furthermore, it stipulates that if the given URL path is
> relative, the absolute path is derived at by combining that relative
> path with a base URL which, for CSS style sheets, is the base URL for
> the style sheet. However, your guess is as good as mine about which
> popular browsers adhere to that latter specification, in particular,
> and which don't.


Relative URLs in stylesheets aren't a problem these days - I think it
was
Netscape 4 that didn't handle them properly, or maybe an old IE.
Still, no
reason to abstain.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django.contrib.auth.models.User User model can't be saved

2009-03-28 Thread Matthew Somerville

Joshua Partogi wrote:
> That is exactly the problem. No exception is thrown. But I guess it
> didn't pass the validation because it wasn't redirecting to another
> page. Which is funny because all the required field in
> django.contrib.auth.models.User object is filled in.

How are you printing out the form in the template? If it's not 
redirecting, it's not validating, so there's an error - make sure you're 
printing out all the errors in the template. Without any more clues, it 
could be something as simple as your form has method GET rather than 
POST. ;) But I'm guessing you don't want your registration form to have 
all the fields from the User model (such as is_superuser), and you're 
printing out only those ones you do want in the template, rather than 
restricting the form with the fields Meta variable, and so aren't 
printing out the error messages correctly. That's just a guess.

> Am I doing a good practice anyway for doing registration using this 
> django.contrib.auth.models.User object?

I believe that's what it's for, yes :) The code you give looks fine in 
its structure.

ATB,
Matthew

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django.contrib.auth.models.User User model can't be saved

2009-03-28 Thread Joshua Partogi



On Mar 28, 2:17 pm, Malcolm Tredinnick 
wrote:
> On Sat, 2009-03-28 at 13:45 +1100, Joshua Partogi wrote:
> > Dear all,
>
> > I currently want to have a registration system. For that matter I will
> > be using the existing django.contrib.auth.models.User.
>
> > So I created a form object as such:
> > class RegisterForm(ModelForm):
> >     class Meta:
> >         model = User
>
> > And the view:
> > def form(request):
> >     if request.method == 'POST': # If the form has been submitted...
> >         form = RegisterForm(request.POST) # A form bound to the POST data
> >         if form.is_valid(): # All validation rules pass
> >             # Process the data in form.cleaned_data
> >             new_member = form.save()
>
> >             return HttpResponseRedirect('/register/thanks/') #
> > Redirect after POST
> >     else:
> >         form = RegisterForm() # An unbound form
>
> >     return render_to_response('register/form.html', {
> >         'form': form,
> >     })
>
> > But unfortunately I can not save the User object into database.
>
> What happens when you try? The answer could be anywhere from "it fails
> silently" to "my computer caught on fire" or worse, so we can't guess at
> the problem. If you see an error, paste the traceback.
>
> Is form validation passing -- i.e. are you actually getting to the line
> with form.save() in it?

That is exactly the problem. No exception is thrown. But I guess it
didn't pass the validation because it wasn't redirecting to another
page. Which is funny because all the required field in
django.contrib.auth.models.User object is filled in. Am I doing a good
practice anyway for doing registration using this
django.contrib.auth.models.User object?

Best regards,
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django wont display images on my CSS file

2009-03-28 Thread Ayaz Ahmed Khan


On 28-Mar-09, at 3:14 AM, Dougal Matthews wrote:
>
> 2009/3/27 Brian Neal :
>>
>> I seem to recall that when you put references to files in your
>> CSS, they are relative to that CSS file, not to the document
>> root. So if that graphic file is in the same directory as your
>> CSS file, change your url to:
>>
>> background: url(header_background.gif) no-repeat top left;
>>
> Isn't it just because you don't have quotes around the image address?
>
> background: url('/site_media/header_background.gif') no-repeat top  
> left;

The CSS specification[0] dictates that the surrounding quotes--be they
single or double--within the url() notation for describing URLs are
optional. Furthermore, it stipulates that if the given URL path is
relative, the absolute path is derived at by combining that relative
path with a base URL which, for CSS style sheets, is the base URL for
the style sheet. However, your guess is as good as mine about which
popular browsers adhere to that latter specification, in particular,
and which don't. Having said that, I should mention that I have in
web projects that I have worked on before, where style sheets were
kept within /static/css/ and the accompanying images in /static/images,
specified URLs for images within the CSS style sheets via URLs of the
form `/static/images/file.ext`, and found them to seamlessly work across
a diverse set of browsers.

[0] http://www.w3.org/TR/CSS2/syndata.html#uri

-- 
Ayaz Ahmed Khan

An evil mind is a great comfort.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---