Re: Plugin for Eclipse

2010-04-13 Thread phoebebright
Have you checked out PyCharm - also uses pydev but geared for python
and django aware.  Is only in public alpha but I'm very impressed.

Phoebe.

On Apr 13, 1:07 am, Zbiggy  wrote:
> Hi,
> maybe someone would be interested in:http://eclipse.kacprzak.org/
>
> I use Eclipse + PyDev, however Django tags coloring was always sth I
> was missing.
> However if you found such a plugin already, please let me know.
> I'd like to avoid wasting my time in duplicate implementation.
>
> Regards,
> Zbiggy

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this 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 uploads not held on loaded Form

2010-04-12 Thread phoebebright
If you edit an item in admin, a files uploaded are displayed above the
input field.  But if the model form is loaded with an instance, the
form seems unaware that there may already be an uploaded file.  No
existing file is displayed and if the form is resaved, the uploaded
file link is lost.

Am populating the form like this: requestForm =
RequestForm(instance=comm)

Found a similar question here:
http://groups.google.com/group/django-users/browse_thread/thread/1ba9bd1ae11c4e1a/a0c865b9317626ac?lnk=gst=upload+file#a0c865b9317626ac
and here
http://groups.google.com/group/django-users/browse_thread/thread/b3de8d6ef3fd8da9/1271517128e75720?lnk=gst=upload+file#1271517128e75720
with now answers

A partial answer here:http://groups.google.com/group/django-users/
browse_thread/thread/14922dca454e3782/d3b370cc47fe9ca1?lnk=gst=upload
+file#d3b370cc47fe9ca1
To the effect that this behaviour is correct due to security issue. Is
that the case?

Have I missed something or is there a way around this without hard
coding the form?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this 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.



Why would the {{new_password}} be blank in the reset password email?

2010-04-12 Thread phoebebright
I'm using the standard reset password option and all the other fields
are filled in but the {{new_password}} field is blank.
Here is the email:

You're receiving this e-mail because you requested a password reset
for your user account at nwlc

Your new password is:

Feel free to change this password by going to this page:

http://nwlegalconsortium.com/password_change/

Your username, in case you've forgotten: phoebe


Any suggests on why the new password is coming up blank?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this 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: Passing hidden foreign key to form as initial value

2010-04-02 Thread phoebebright
OK - Now I've actually read your code properly!  Yes that is a
brilliant solution!

Thanks.

Phoebe.


On Apr 1, 7:01 pm, Nuno Maltez <nuno.li...@gmail.com> wrote:
> I think the form I sent, with ModelChoiceField, will validate with the
> returned values without any further code. Or am I missing something
> obvious?
>
> On Thu, Apr 1, 2010 at 6:49 PM, phoebebright <phoebebright...@gmail.com> 
> wrote:
> > That's one option, the problem is changing the course value returned
> > from the form into a course object so that the form will validate.
> > This turned out to be a surprising amount of trouble (because you have
> > to do it before validation), hence reason for doing simpler work
> > around.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this 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: Passing hidden foreign key to form as initial value

2010-04-01 Thread phoebebright
That's one option, the problem is changing the course value returned
from the form into a course object so that the form will validate.
This turned out to be a surprising amount of trouble (because you have
to do it before validation), hence reason for doing simpler work
around.

On Apr 1, 2:08 pm, Nuno Maltez <nuno.li...@gmail.com> wrote:
> What about:
>
> class CourseBook(ModelForm):
>    course = ModelChoiceField(queryset=Course.objects.all(),
> widget=HiddenInput())
>
>    class Meta:
>        model = CourseBooking
>
> and in your view:
>
> form = CourseBook(initial = {'course': course.pk})
>
> Nuno
>
> On Wed, Mar 31, 2010 at 8:06 PM, phoebebright <phoebebright...@gmail.com> 
> wrote:
> > Final approach:
> > in the forms.py excluded the courses foreign key field
> > in models.py made courses blank and nullable
> > didn't pass any initial values to the form
> > in the view, saved the form like this:
> >            item = Courses.objects.get(pk=whatever)
> >            obj = form.save(commit=False)
> >            obj.course = item
> >            obj.save()
>
> > This doesn't feel very tidy to me, I think the form should have the
> >hiddenvalues, but it works!
>
> > On Mar 31, 4:15 pm, phoebebright <phoebebright...@gmail.com> wrote:
> >> Brandon, Thanks for your suggestion.
> >> I tried passing it an ID, but as you say, I also have to override the
> >> save.  What I don't understand is why it does it fine if the form
> >> includes the foreign key in a popup?  They are both passing back
> >> integers after all.
>
> >> Also failed to get the save method working, tried to pass in the
> >> course instance, but it still ends up trying to save with the id of
> >> the course.  Is it not using cleaned_data?
>
> >>     def save(self, course=False, force_insert=False,
> >> force_update=False, commit=True):
> >>         if course:
> >>             self.cleaned_data['course'] = course
> >>             return super(CourseBook, self).save(commit=commit)
>
> >> Any suggestions welcome as I've spent the whole afternoon on this - I
> >> won't go through the many other workarounds that havn't worked!
>
> >> Phoebe.
>
> >> On Mar 31, 4:02 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> >> > Hi there,
>
> >> > Instead of using the course object in your initial data, which will
> >> > pass in the __unicode__ representation of the object, pass in the id:
>
> >> > form = CouseBook(initial = {'course': course.id})
>
> >> > That should get you the numeric id, but you'll also need to override
> >> > your save method to get the course object to assign when you save your
> >> > CourseBook form, as you can't assign an integer (coming from your
> >> >hiddenform field) to the value of a ForeignKey field on a model.
>
> >> > HTH,
> >> > Brandon
>
> >> > On Mar 31, 8:20 am, phoebebright <phoebebright...@gmail.com> wrote:
>
> >> > > Displayed fields resolve as expected,hiddenfields cause errors.
>
> >> > > This works:
>
> >> > > in the model
> >> > > CourseBook has a foreign key to Course
>
> >> > > In the view:
>
> >> > > course = Course.objects.get(pk=whatever)
> >> > > form = CouseBook(initial = {'course': course})
>
> >> > > in the Form:
>
> >> > > class CourseBook(ModelForm):
> >> > >     class Meta:
> >> > >         model = CourseBooking
>
> >> > > The web page now displays a picklist of courses with the initial value
> >> > > highlighted.  I can now do a form.save() no problem.
>
> >> > > However, if I make the course ahiddenfield, which is what I want.
>
> >> > > class CourseBook(ModelForm):
> >> > >     course = forms.CharField(widget=forms.HiddenInput())
>
> >> > >     class Meta:
> >> > >         model = CourseBooking
>
> >> > > then when I come to save() I get a ValueError, unable to assign "My
> >> > > course"  etc. as it tries to put the name of the course into the
> >> > > foreign key instead of a course instance.
>
> >> > > I can work around this putting a save method on the form, but it seems
> >> > > to me django should resolve this for me
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this 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: Passing hidden foreign key to form as initial value

2010-03-31 Thread phoebebright
Final approach:
in the forms.py excluded the courses foreign key field
in models.py made courses blank and nullable
didn't pass any initial values to the form
in the view, saved the form like this:
item = Courses.objects.get(pk=whatever)
obj = form.save(commit=False)
obj.course = item
obj.save()

This doesn't feel very tidy to me, I think the form should have the
hidden values, but it works!


On Mar 31, 4:15 pm, phoebebright <phoebebright...@gmail.com> wrote:
> Brandon, Thanks for your suggestion.
> I tried passing it an ID, but as you say, I also have to override the
> save.  What I don't understand is why it does it fine if the form
> includes the foreign key in a popup?  They are both passing back
> integers after all.
>
> Also failed to get the save method working, tried to pass in the
> course instance, but it still ends up trying to save with the id of
> the course.  Is it not using cleaned_data?
>
>     def save(self, course=False, force_insert=False,
> force_update=False, commit=True):
>         if course:
>             self.cleaned_data['course'] = course
>             return super(CourseBook, self).save(commit=commit)
>
> Any suggestions welcome as I've spent the whole afternoon on this - I
> won't go through the many other workarounds that havn't worked!
>
> Phoebe.
>
> On Mar 31, 4:02 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
>
> > Hi there,
>
> > Instead of using the course object in your initial data, which will
> > pass in the __unicode__ representation of the object, pass in the id:
>
> > form = CouseBook(initial = {'course': course.id})
>
> > That should get you the numeric id, but you'll also need to override
> > your save method to get the course object to assign when you save your
> > CourseBook form, as you can't assign an integer (coming from your
> > hidden form field) to the value of a ForeignKey field on a model.
>
> > HTH,
> > Brandon
>
> > On Mar 31, 8:20 am, phoebebright <phoebebright...@gmail.com> wrote:
>
> > > Displayed fields resolve as expected, hidden fields cause errors.
>
> > > This works:
>
> > > in the model
> > > CourseBook has a foreign key to Course
>
> > > In the view:
>
> > > course = Course.objects.get(pk=whatever)
> > > form = CouseBook(initial = {'course': course})
>
> > > in the Form:
>
> > > class CourseBook(ModelForm):
> > >     class Meta:
> > >         model = CourseBooking
>
> > > The web page now displays a picklist of courses with the initial value
> > > highlighted.  I can now do a form.save() no problem.
>
> > > However, if I make the course a hidden field, which is what I want.
>
> > > class CourseBook(ModelForm):
> > >     course = forms.CharField(widget=forms.HiddenInput())
>
> > >     class Meta:
> > >         model = CourseBooking
>
> > > then when I come to save() I get a ValueError, unable to assign "My
> > > course"  etc. as it tries to put the name of the course into the
> > > foreign key instead of a course instance.
>
> > > I can work around this putting a save method on the form, but it seems
> > > to me django should resolve this for me
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this 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: Passing hidden foreign key to form as initial value

2010-03-31 Thread phoebebright
Brandon, Thanks for your suggestion.
I tried passing it an ID, but as you say, I also have to override the
save.  What I don't understand is why it does it fine if the form
includes the foreign key in a popup?  They are both passing back
integers after all.

Also failed to get the save method working, tried to pass in the
course instance, but it still ends up trying to save with the id of
the course.  Is it not using cleaned_data?


def save(self, course=False, force_insert=False,
force_update=False, commit=True):
if course:
self.cleaned_data['course'] = course
return super(CourseBook, self).save(commit=commit)


Any suggestions welcome as I've spent the whole afternoon on this - I
won't go through the many other workarounds that havn't worked!

Phoebe.

On Mar 31, 4:02 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
> Hi there,
>
> Instead of using the course object in your initial data, which will
> pass in the __unicode__ representation of the object, pass in the id:
>
> form = CouseBook(initial = {'course': course.id})
>
> That should get you the numeric id, but you'll also need to override
> your save method to get the course object to assign when you save your
> CourseBook form, as you can't assign an integer (coming from your
> hidden form field) to the value of a ForeignKey field on a model.
>
> HTH,
> Brandon
>
> On Mar 31, 8:20 am, phoebebright <phoebebright...@gmail.com> wrote:
>
> > Displayed fields resolve as expected, hidden fields cause errors.
>
> > This works:
>
> > in the model
> > CourseBook has a foreign key to Course
>
> > In the view:
>
> > course = Course.objects.get(pk=whatever)
> > form = CouseBook(initial = {'course': course})
>
> > in the Form:
>
> > class CourseBook(ModelForm):
> >     class Meta:
> >         model = CourseBooking
>
> > The web page now displays a picklist of courses with the initial value
> > highlighted.  I can now do a form.save() no problem.
>
> > However, if I make the course a hidden field, which is what I want.
>
> > class CourseBook(ModelForm):
> >     course = forms.CharField(widget=forms.HiddenInput())
>
> >     class Meta:
> >         model = CourseBooking
>
> > then when I come to save() I get a ValueError, unable to assign "My
> > course"  etc. as it tries to put the name of the course into the
> > foreign key instead of a course instance.
>
> > I can work around this putting a save method on the form, but it seems
> > to me django should resolve this for me
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this 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.



Passing hidden foreign key to form as initial value

2010-03-31 Thread phoebebright
Displayed fields resolve as expected, hidden fields cause errors.

This works:

in the model
CourseBook has a foreign key to Course

In the view:

course = Course.objects.get(pk=whatever)
form = CouseBook(initial = {'course': course})


in the Form:

class CourseBook(ModelForm):
class Meta:
model = CourseBooking


The web page now displays a picklist of courses with the initial value
highlighted.  I can now do a form.save() no problem.

However, if I make the course a hidden field, which is what I want.

class CourseBook(ModelForm):
course = forms.CharField(widget=forms.HiddenInput())

class Meta:
model = CourseBooking

then when I come to save() I get a ValueError, unable to assign "My
course"  etc. as it tries to put the name of the course into the
foreign key instead of a course instance.

I can work around this putting a save method on the form, but it seems
to me django should resolve this for me

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this 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: Any clues on error importing middleware?

2010-02-02 Thread phoebebright
OK - removed all the custom middleware and revealed an earlier
problem:

] __import__(name), referer: http://phb.tinycomms.com/
]   File "/home/django/tinycomms/libs/tinycomm.py", line 13, in
, re
] from tinycomms.tinycomm.models import *, referer: http://phb.tinycomms
]   File "/home/django/tinycomms/tinycomm/models.py", line 14, in
,
] from tinycomm.fields import *, referer: http://phb.tinycomms.com/
] ImportError: No module named fields, referer: http://phb.tinycomms.com/


Here is the code in libs/tincyomm.py, error was a recent one in
development environment

#PHB don't ask me why I have to put the project here
#after over a day getting
#Could not import web.views. Error was: No module named models
#I don't care why, I just want it working
from tinycomms.tinycomm.models import *


And the code in tinycomm/models.py
from tinycomm.fields import *


I tried removing the project from the first bit of code:
from tinycomm.models import *
which had been fine until recently, and I got the No module named
models error again

If I put the project back and add project in models.py then I get

__import__(name), referer: http://phb.tinycomms.com/
  File "/home/django/tinycomms/avatar/__init__.py", line 19, in
, refe
from avatar.models import Avatar, referer: http://phb.tinycomms.com/
  File "/home/django/tinycomms/avatar/models.py", line 25, in
, refere
class Avatar(models.Model):, referer: http://phb.tinycomms.com/
  File "/home/django/tinycomms/avatar/models.py", line 26, in Avatar,
referer:
from tinycomm.models import Who, referer: http://phb.tinycomms.com/
ImportError: No module named models, referer: http://phb.tinycomms.com/



SO if you use the full path to a module once are you supposed to use
it everywhere?  If so, why was it working in development?
Am running python 2.5.2 on both the production and development box.

Now totally confused

Phoebe.

On Feb 2, 12:12 pm, Gonzalo Delgado <gonzalo...@gmail.com> wrote:
> El 02/02/10 08:33, phoebebright escribi :
>
> > But fields is not mentioned in the middleware:
>
> > from libs.utils import  changehat
> > class CheckScopeMiddleware:
> >     """
> >     if there is a hat in the GET then swithc to that hat (if
> > different)
> >     """
> >     def process_request(self, request):
>
> >           if 'hat' in request.GET:
> >                if request.GET['hat'] != request.session['hat']:
> >                    hatcontext = changehat(request, request.GET['hat'])
>
> How about in the "changehat" module, is "fields" not mentioned there
> either (or in a module it imports, and so on)?
>
> --
> Gonzalo Delgado <gonzalo...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this 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: Any clues on error importing middleware?

2010-02-02 Thread phoebebright
Gonzalo, Double checked that one,
Checked all calls to a fields module (only 2) and I can import both
fine in the shell and I can see both in the list of files.

Any other thoughts?!

Phoebe.


On Feb 2, 12:12 pm, Gonzalo Delgado <gonzalo...@gmail.com> wrote:
> El 02/02/10 08:33, phoebebright escribi :
>
> > But fields is not mentioned in the middleware:
>
> > from libs.utils import  changehat
> > class CheckScopeMiddleware:
> >     """
> >     if there is a hat in the GET then swithc to that hat (if
> > different)
> >     """
> >     def process_request(self, request):
>
> >           if 'hat' in request.GET:
> >                if request.GET['hat'] != request.session['hat']:
> >                    hatcontext = changehat(request, request.GET['hat'])
>
> How about in the "changehat" module, is "fields" not mentioned there
> either (or in a module it imports, and so on)?
>
> --
> Gonzalo Delgado <gonzalo...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this 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: CheddarGetter module for Django/Python - easy recurring billing

2010-02-02 Thread phoebebright
This might be very timely.  Have a new project that will require
subscriptions...

Thanks.

On Feb 1, 9:11 pm, Jason Ford  wrote:
> We just released pychedder, an open source module for integrating
> CheddarGetter with Django and Python:
>
> http://www.feedmagnet.com/blog/cheddargetter-for-python-and-django/
>
> Anyone who's built commercial web app knows that payment processing
> can be one of the toughest pieces to put in place - and it can
> distract you from working on the core functionality of your app.
> CheddarGetter is a web service that abstracts the entire process of
> managing credit cards, processing transactions on a recurring basis,
> and even more complex setups like free trials, setup fees, and overage
> charges.
>
> We're using CheddarGetter for FeedMagnet.com and we thought the Django
> community in general could benefit from the module we wrote to
> interact with it. More just just a Python wrapper for CheddarGetter,
> pycheddar gives you class objects that work a lot like Django models,
> making the whole experience of integrating with CheddarGetter just a
> little more awesome and Pythonic.
>
> We're a week or two away from putting pycheddar into production on
> FeedMagnet, but we felt like it was close enough that others could
> start using it. We also published it to PyPi so you can easy_install
> pycheddar and get the latest version (currently 0.9). Hope others can
> benefit from it!
>
> - Jason

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this 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.



Any clues on error importing middleware?

2010-02-02 Thread phoebebright
I've just uploaded my changes from development (1.2 alpha) to
production (1.1) and now getting this error on my ubuntu server.  Done
a check around for missing __init__.py files but nothing obvious
missing - and was working on osx system.

[Tue Feb 02 11:11:45 2010] [error] [client 92.60.198.120] mod_wsgi
(pid=30181): Exception occurred within WSGI script '/home/django/
tinycomms/django.wsgi'.
[Tue Feb 02 11:11:45 2010] [error] [client 92.60.198.120] Traceback
(most recent call last):
[Tue Feb 02 11:11:45 2010] [error] [client 92.60.198.120]   File "/usr/
lib/python2.5/site-packages/Django-1.1-py2.5.egg/django/core/handlers/
wsgi.py", line 230, in __call__
[Tue Feb 02 11:11:45 2010] [error] [client 92.60.198.120]
self.load_middleware()
[Tue Feb 02 11:11:45 2010] [error] [client 92.60.198.120]   File "/usr/
lib/python2.5/site-packages/Django-1.1-py2.5.egg/django/core/handlers/
base.py", line 42, in load_middleware
[Tue Feb 02 11:11:45 2010] [error] [client 92.60.198.120] raise
exceptions.ImproperlyConfigured, 'Error importing middleware %s: "%s"'
% (mw_module, e)
[Tue Feb 02 11:11:45 2010] [error] [client 92.60.198.120]
ImproperlyConfigured: Error importing middleware
tinycomm.scope_middleware: "No module named fields"
r...@ct162:/home/django/tinycomms/tinycomm#

But fields is not mentioned in the middleware:

from libs.utils import  changehat
class CheckScopeMiddleware:
"""
if there is a hat in the GET then swithc to that hat (if
different)
"""
def process_request(self, request):

  if 'hat' in request.GET:
   if request.GET['hat'] != request.session['hat']:
   hatcontext = changehat(request, request.GET['hat'])


Syncdb works fine, and I can get a shell and do runserver ok but
asking for any page from the brower gives 500 internal error.

Have implemented apatan+pydev on development, but not copied through
new manage.py
Have upgraded to 1.2 alpha but not used any new features (that I
remember!)

Any suggestions on what this is trying to tell me?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this 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: Reasons why syncdb ignores an application?

2010-01-28 Thread phoebebright
OK Found it.

Used this

from autoslug.fields import AutoSlugField

and had one autoslug field.

Autoslug not on the pythonpath and syncdb failed silently.  Once I
took these out, normal service resumed.  Phew!

Phoebe.


On Jan 28, 9:56 am, phoebebright <phoebebright...@gmail.com> wrote:
> It can see the app fine - the import views suggested above works fine,
> and if I put print statements in models.py, they are displayed when
> syncdb runs (4 times!).
>
> Checked all the folders for __init__ and all there.
>
> Am going to create a new app from scratch and put stuff in one small
> piece at a time.  Aghhh, don't you just love computers!
>
> Thanks for your suggestions, I'll keep them in a checklist for future
> reference.
>
> Phoebe
>
> On Jan 28, 12:46 am, mtnpaul <mountainp...@gmail.com> wrote:
>
>
>
> > In manage.py you could add
>
> > sys.path.insert(0, "/path/to/web")
>
> > Just before the  if __name__="__main__":   line
>
> > You will also need to handle this in your wsgi file for deployment.
>
> > Are you using "South"? If so, new tables for something you have
> > migrated will not be built by syncdb.
>
> > On Jan 27, 11:54 am, phoebebright <phoebebright...@gmail.com> wrote:
>
> > > I cannot find the reason why syncdb will not create tables from a
> > > models.py.
>
> > > It is quite happy to create the auth tables and ones from an external
> > > app that is included in INSTALLED_APPS but it won't build the tables
> > > from my 'web' folder.
>
> > > I can put a print statement in the web.models.py and it appears.  It
> > > is clearly parsing all the models, because if I put a foreignkey to a
> > > model which doesn't exist, it complains until I fix the error, but it
> > > won't build the tables.  I do a syncdb and nothing happens and nothing
> > > is displayed.
>
> > > Have tried running it with verbosity 2 and this folder is never
> > > referred to.
>
> > > Have included 'from web.models import *' in urls.py and admin.py for
> > > luck.
>
> > > Have tried copying the web folder to another name and putting that
> > > name in the INSTALLED_APPS.
>
> > > The only other symptom is that if I do  'python manage.py sql web'  I
> > > get the error
> > > Error: App with label web could not be found. Are you sure your
> > > INSTALLED_APPS setting is correct?
>
> > > Here is my INSTALLED_APPS:
> > > INSTALLED_APPS = (
> > >     'django.contrib.auth',
> > >     'django.contrib.contenttypes',
> > >     'django.contrib.sessions',
> > >     'django.contrib.sites',
> > >     'django.contrib.admin',
> > >     'web',
> > >     'lifestream',
> > > )
>
> > > I have no idea what to try next!!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this 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: Reasons why syncdb ignores an application?

2010-01-28 Thread phoebebright
It can see the app fine - the import views suggested above works fine,
and if I put print statements in models.py, they are displayed when
syncdb runs (4 times!).

Checked all the folders for __init__ and all there.

Am going to create a new app from scratch and put stuff in one small
piece at a time.  Aghhh, don't you just love computers!

Thanks for your suggestions, I'll keep them in a checklist for future
reference.

Phoebe

On Jan 28, 12:46 am, mtnpaul <mountainp...@gmail.com> wrote:
> In manage.py you could add
>
> sys.path.insert(0, "/path/to/web")
>
> Just before the  if __name__="__main__":   line
>
> You will also need to handle this in your wsgi file for deployment.
>
> Are you using "South"? If so, new tables for something you have
> migrated will not be built by syncdb.
>
> On Jan 27, 11:54 am, phoebebright <phoebebright...@gmail.com> wrote:
>
>
>
> > I cannot find the reason why syncdb will not create tables from a
> > models.py.
>
> > It is quite happy to create the auth tables and ones from an external
> > app that is included in INSTALLED_APPS but it won't build the tables
> > from my 'web' folder.
>
> > I can put a print statement in the web.models.py and it appears.  It
> > is clearly parsing all the models, because if I put a foreignkey to a
> > model which doesn't exist, it complains until I fix the error, but it
> > won't build the tables.  I do a syncdb and nothing happens and nothing
> > is displayed.
>
> > Have tried running it with verbosity 2 and this folder is never
> > referred to.
>
> > Have included 'from web.models import *' in urls.py and admin.py for
> > luck.
>
> > Have tried copying the web folder to another name and putting that
> > name in the INSTALLED_APPS.
>
> > The only other symptom is that if I do  'python manage.py sql web'  I
> > get the error
> > Error: App with label web could not be found. Are you sure your
> > INSTALLED_APPS setting is correct?
>
> > Here is my INSTALLED_APPS:
> > INSTALLED_APPS = (
> >     'django.contrib.auth',
> >     'django.contrib.contenttypes',
> >     'django.contrib.sessions',
> >     'django.contrib.sites',
> >     'django.contrib.admin',
> >     'web',
> >     'lifestream',
> > )
>
> > I have no idea what to try next!!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this 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: Reasons why syncdb ignores an application?

2010-01-27 Thread phoebebright
Malcolm,

Thanks for your reply. Path does not include web:

 '/Users/phoebebr/Development/tinyhq',
 '/Users/phoebebr/Development/tinyhq/libs',
 '/Users/phoebebr/Development/tinyhq',
 '/Users/phoebebr/Development/tinyhq/libs',
 '/Users/phoebebr/Development/tinyhq',


but if I do import web I don't get any error.
Tried adding a path directly at the top of settings so I get

 '/Users/phoebebr/Development/tinyhq',
 '/Users/phoebebr/Development/tinyhq/web',
 '/Users/phoebebr/Development/tinyhq/libs',
 '/Users/phoebebr/Development/tinyhq',
 '/Users/phoebebr/Development/tinyhq/web',
 '/Users/phoebebr/Development/tinyhq/libs',
 '/Users/phoebebr/Development/tinyhq',

but symptoms remain the same.

What is going on?!


On Jan 27, 7:23 pm, Malcolm Box <malcolm@gmail.com> wrote:
> On Wed, Jan 27, 2010 at 6:54 PM, phoebebright 
> <phoebebright...@gmail.com>wrote:
>
>
>
>
>
> > I cannot find the reason why syncdb will not create tables from a
> > models.py.
>
> > It is quite happy to create the auth tables and ones from an external
> > app that is included in INSTALLED_APPS but it won't build the tables
> > from my 'web' folder.
>
> > I can put a print statement in the web.models.py and it appears.  It
> > is clearly parsing all the models, because if I put a foreignkey to a
> > model which doesn't exist, it complains until I fix the error, but it
> > won't build the tables.  I do a syncdb and nothing happens and nothing
> > is displayed.
>
> > Have included 'from web.models import *' in urls.py and admin.py for
> > luck.
>
> > This would explain the print statement appearing.
> > Have tried copying the web folder to another name and putting that
> > name in the INSTALLED_APPS.
>
> > The only other symptom is that if I do  'python manage.py sql web'  I
> > get the error
> > Error: App with label web could not be found. Are you sure your
> > INSTALLED_APPS setting is correct?
>
> What is your python path?  Do manage.py shell
>
> >>> import sys
> >>> sys.path
>
> Then try
>
> >>> import web
>
> My guess is that for some reason your python path doesn't include the web
> directory.
>
> The only other thing I can think of is some import error in your app that's
> silently failing on syncdb - the "import web" test above should spot that.
>
> Cheers,
>
> 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-us...@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: ExtendableModel

2010-01-27 Thread phoebebright
Maybe you should consider an alternative backend to SQL - which is
after all a relational database!  CouchDB?
I could see queries being very expensive with your model.



On Jan 26, 10:08 am, Igor Rubinovich 
wrote:
> Hi,
>
> I need an educated opinion on the following idea. It's supposed to
> provide a (very-)weakly coupled architecture where any object that
> inherits from ExtendableModel can be said to relate to one or many
> objects that also inherit from it. This way I want to achieve at least
> two things:
>
>   (1) No need to hard-code relationships
>   (2) As a consequence of (1) no need to reconstruct the tables every
> time I want to add a new relationship
>
> I think this is not a very bad idea, but maybe technically there are
> better ways to implement this. Or, maybe, it IS a bad idea
> altogether? :)
> Also - how is it (if at all) possible to still use the admin interface
> with this kind of architecture?
>
> The code is below - thanks for any comments!
>
> Thanks,
> Igor
> 
>
> from django.db import models
> from django.contrib.contenttypes import generic
> from django.contrib.contenttypes.models import ContentType
>
> class ExtendableModel(models.Model):
>         id = models.AutoField(primary_key=True)
>         extendable_content_type = models.ForeignKey(ContentType)
>         extendable_object_id = models.PositiveIntegerField()
>         extendable_content_object = generic.GenericForeignKey
> ('extension_content_type', 'extension_object_id')
>
>         def __init__(self, *args, **kwargs):
>                 super(ExtendableModel, self).__init__(self, args, kwargs)
>                 self.extendable_content_type_id = int
> (ContentType.objects.get_for_model(self).id)
>                 print type(self.extendable_content_type_id)
>
>         def get_related(self, model_class): # Returns objects of type
> model_class that extend self
>                 ContentType.objects.get_for_model(b)
>
>                 return model_class.objects.filter(
>                                 
> extendable_content_type__pk=ContentType.objects.get_for_model
> (self).id,
>                                 extendable_object_id=self.id)
>
> 
>
> Sample usage:
>
> class Entry(ExtendableModel):
>         title = models.TextField(editable=False, blank=True)
>         ...
>
> class Event(ExtendableModel):
>     start_datetime = models.DateTimeField
> (default=datetime.datetime.now)
>     end_datetime = models.DateTimeField(default=datetime.datetime.now)
>
> 
>
> entry = Entry(title="A blog post")
> event = Event(start_datetime=somestime1, end_datetime_sometime2)
>
> entry.associate(event) # suppose this is how actual object-to-object
> relationships
>                                  # are added - haven't thought this
> thru

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this 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: I am new to the Django community

2010-01-27 Thread phoebebright
Not reading but after a year using Django I have just got myself setup
with Aptana + Pydev which includes an interactive debugger.  I found
this very useful for understanding what is going on in Django behind
the scenes, and wish I'd made the effort to do it sooner!


On Jan 27, 1:14 am, kamilski81  wrote:
> I have done the tutorial on the site, are there any other recommended
> readings?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this 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.



Reasons why syncdb ignores an application?

2010-01-27 Thread phoebebright
I cannot find the reason why syncdb will not create tables from a
models.py.

It is quite happy to create the auth tables and ones from an external
app that is included in INSTALLED_APPS but it won't build the tables
from my 'web' folder.

I can put a print statement in the web.models.py and it appears.  It
is clearly parsing all the models, because if I put a foreignkey to a
model which doesn't exist, it complains until I fix the error, but it
won't build the tables.  I do a syncdb and nothing happens and nothing
is displayed.

Have tried running it with verbosity 2 and this folder is never
referred to.

Have included 'from web.models import *' in urls.py and admin.py for
luck.

Have tried copying the web folder to another name and putting that
name in the INSTALLED_APPS.

The only other symptom is that if I do  'python manage.py sql web'  I
get the error
Error: App with label web could not be found. Are you sure your
INSTALLED_APPS setting is correct?

Here is my INSTALLED_APPS:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'web',
'lifestream',
)

I have no idea what to try next!!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this 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: Querying for objects created on a certain date

2009-10-12 Thread phoebebright

Try this:

from datetime import date

today = date.today()

todays_stuff = Stuff.objects.filter(created_on = today)



On Oct 12, 10:07 pm, aa56280  wrote:
> I have a DateTimeField called "created_on" on a model called
> "Documents". It serves as a timestamp for when the record was added.
>
> I'm trying to write a query that will return all Documents created_on
> a particular date, say today. I can make it work if I look for a
> record within a range of dates...
>
> 
> today = datetime.datetime.today()
> thirty_days_ago = today - datetime.timedelta(days=30)
> Document.objects.filter(created_on__range=(thirty_days_ago, today))
> 
>
> But now, I need to find records that were created on a particular
> date, like, today.
>
> How do I do that?
>
> Any thoughts greatly appreciated.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Commercial Photo App?

2009-10-12 Thread phoebebright

Are there any django apps suitable for a events photographer who wants
to sell their photos online?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Trying to make django-mptt work with inherited models

2009-10-03 Thread phoebebright

Have spent quite a few hours on this one but not familiar enough with
django inerds to make much progress.

Here is the model:

class Stuff(models.Model):
name = models.CharField(max_length=140)
parent = models.ForeignKey('self', null=True, blank=True,
related_name='children')

mptt.register(Stuff)

class ToDo(Stuff):
status = models.CharField(_('status'), max_length=1,
choices=STATUS_CHOICES, default=1)

class Concept(Stuff):
priority = models.CharField(_('status'), max_length=1,
choices=PRIORITY_CHOICES,
default='C')


And the code where I am saving (tried many different options!)

obj = ToDo(**field_vals)
obj.tags = " ".join(set(self.keyw_used))
obj.save()

# add parent
if self.parent:
obj.move_to(self.parent)

obj.save()

Am getting the error  'Options' object has no attribute 'parent_attr'
when trying to add to ToDo.
Error occurring here:
def is_root_node(self):
return getattr(self, '%s_id' % self._meta.parent_attr) is None

This is because the ToDo model is not in the mptt registery.

I tried adding an attribute to register to say it was inherited so
that the __init__ method of mptt would add the ToDo and Concept models
to the registry but not all the fields.  ie.

in models:
mptt.register(Stuff)
mptt.register(ToDo, inherited=True)
mptt.register(Concept, inherited=True)

and hacked __init__:

if model in registry:
raise AlreadyRegistered(
_('The model %s has already been registered.') %
model.__name__)
registry.append(model)

#added by PHB
if not inherited:

# Add tree options to the model's Options
opts = model._meta
opts.parent_attr = parent_attr
opts.right_attr = right_attr


This got me past the first error but it's still putting the mptt
fields in the _meta of the ToDo model and failing in the models
pre_save with:

AttributeError: 'ToDo' object has no attribute 'lft'


I need to find some way of telling django these fields are in the
parent class and not the child.  Any suggestions very welcome as way
out of my depth there!




--~--~-~--~~~---~--~~
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: Abstract model across apps

2009-10-01 Thread phoebebright

Karen,

Aghh - was editing a backup copy of the file, so django quite happy to
use abstract models from other apps.

However, my cunning plan does not work because of the many to many
relationships within microformats - can't have a many to many
relationship with an abstract model obviously.

Time to do some strategic copy and paste.

Thanks for your interest.

Phoebe.


On Oct 1, 6:21 pm, phoebebright <phoebebri...@spamcop.net> wrote:
> Karen,
>
> Am wanting to use the standard in django-microformats (with an s!) but
> want additional fields, so rather than change the models within
> microformats I thought I could be clever and make them all abstract
> and inherit them.  My suspicion is django doesn't like inheriting from
> another app, and maybe it shouldn't.  I can do some more exploration,
> but thought I would check I going in the right direction before
> proceeding.
>
> Phoebe.
>
> On Oct 1, 5:04 pm, Karen Tracey <kmtra...@gmail.com> wrote:
>
>
>
> > On Thu, Oct 1, 2009 at 10:59 AM, phoebebright 
> > <phoebebri...@spamcop.net>wrote:
>
> > > I am trying to use use a hCalendar model from django-microformats as
> > > the base class for events in my own app,
>
> > > microformat.models.py
>
> > Is that really microformat.models.py or microformats.models.py?  I'm unsure
> > what you are using here, as searching on django-microformats brings up more
> > than one possibility.
>
> > > class hCalendar(LocationAwareMicroformat):
> > >    ...
> > >    class Meta:
>
> > >        abstract = True
>
> > This class here looks like it matches what you are using:
>
> >http://github.com/ntoll/microformats/blob/master/models.py#L638
>
> > Except it does not specify abstract=True in its class Meta:
>
> >http://github.com/ntoll/microformats/blob/master/models.py#L705
>
> > Are you using something else or have you modified this?
>
> > web.models.py
>
> > > class Event(hCalendar):
>
> > >    owner = models.ForeignKey(Account)
> > >    created = models.DateTimeField(default=datetime.now)
> > >    last_update = models.DateTimeField(auto_now = True)
>
> > > It doesn't seem to want to recognise the abstract = True, or is the
> > > problem with multi-inheritance?  The table generated is:
>
> > > CREATE TABLE `web_event` (
> > >  `hcalendar_ptr_id` int(11) NOT NULL,
> > >  `owner_id` int(11) NOT NULL,
> > >  `created` datetime NOT NULL,
> > >  `last_update` datetime NOT NULL,
> > >  PRIMARY KEY  (`hcalendar_ptr_id`),
> > >  KEY `web_event_owner_id` (`owner_id`),
> > >  CONSTRAINT `owner_id_refs_id_3952a136` FOREIGN KEY (`owner_id`)
> > > REFERENCES `web_account` (`id`)
> > > ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
>
> > > Is this expected behaviour?
>
> > These models:
>
> > class Abs1(models.Model):
> >    abs1f = models.IntegerField()
> >    class Meta:
> >       abstract = True
>
> > class Abs2(Abs1):
> >    abs2f = models.IntegerField()
> >    class Meta:
> >       abstract = True
>
> > class Concrete(Abs2):
> >    pass
>
> > produce SQL:
>
> > BEGIN;
> > CREATE TABLE "ttt_concrete" (
> >     "id" integer NOT NULL PRIMARY KEY,
> >     "abs1f" integer NOT NULL,
> >     "abs2f" integer NOT NULL
> > )
> > ;
> > COMMIT;
>
> > so multiple levels of abstract models seems to work fine.
>
> > 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: Abstract model across apps

2009-10-01 Thread phoebebright

Karen,

Am wanting to use the standard in django-microformats (with an s!) but
want additional fields, so rather than change the models within
microformats I thought I could be clever and make them all abstract
and inherit them.  My suspicion is django doesn't like inheriting from
another app, and maybe it shouldn't.  I can do some more exploration,
but thought I would check I going in the right direction before
proceeding.

Phoebe.

On Oct 1, 5:04 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Thu, Oct 1, 2009 at 10:59 AM, phoebebright <phoebebri...@spamcop.net>wrote:
>
>
>
> > I am trying to use use a hCalendar model from django-microformats as
> > the base class for events in my own app,
>
> > microformat.models.py
>
> Is that really microformat.models.py or microformats.models.py?  I'm unsure
> what you are using here, as searching on django-microformats brings up more
> than one possibility.
>
> > class hCalendar(LocationAwareMicroformat):
> >    ...
> >    class Meta:
>
> >        abstract = True
>
> This class here looks like it matches what you are using:
>
> http://github.com/ntoll/microformats/blob/master/models.py#L638
>
> Except it does not specify abstract=True in its class Meta:
>
> http://github.com/ntoll/microformats/blob/master/models.py#L705
>
> Are you using something else or have you modified this?
>
> web.models.py
>
>
>
>
>
>
>
> > class Event(hCalendar):
>
> >    owner = models.ForeignKey(Account)
> >    created = models.DateTimeField(default=datetime.now)
> >    last_update = models.DateTimeField(auto_now = True)
>
> > It doesn't seem to want to recognise the abstract = True, or is the
> > problem with multi-inheritance?  The table generated is:
>
> > CREATE TABLE `web_event` (
> >  `hcalendar_ptr_id` int(11) NOT NULL,
> >  `owner_id` int(11) NOT NULL,
> >  `created` datetime NOT NULL,
> >  `last_update` datetime NOT NULL,
> >  PRIMARY KEY  (`hcalendar_ptr_id`),
> >  KEY `web_event_owner_id` (`owner_id`),
> >  CONSTRAINT `owner_id_refs_id_3952a136` FOREIGN KEY (`owner_id`)
> > REFERENCES `web_account` (`id`)
> > ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
>
> > Is this expected behaviour?
>
> These models:
>
> class Abs1(models.Model):
>    abs1f = models.IntegerField()
>    class Meta:
>       abstract = True
>
> class Abs2(Abs1):
>    abs2f = models.IntegerField()
>    class Meta:
>       abstract = True
>
> class Concrete(Abs2):
>    pass
>
> produce SQL:
>
> BEGIN;
> CREATE TABLE "ttt_concrete" (
>     "id" integer NOT NULL PRIMARY KEY,
>     "abs1f" integer NOT NULL,
>     "abs2f" integer NOT NULL
> )
> ;
> COMMIT;
>
> so multiple levels of abstract models seems to work fine.
>
> 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
-~--~~~~--~~--~--~---



Abstract model across apps

2009-10-01 Thread phoebebright

I am trying to use use a hCalendar model from django-microformats as
the base class for events in my own app,

microformat.models.py

class hCalendar(LocationAwareMicroformat):
...
class Meta:

abstract = True

web.models.py

class Event(hCalendar):

owner = models.ForeignKey(Account)
created = models.DateTimeField(default=datetime.now)
last_update = models.DateTimeField(auto_now = True)

It doesn't seem to want to recognise the abstract = True, or is the
problem with multi-inheritance?  The table generated is:

CREATE TABLE `web_event` (
  `hcalendar_ptr_id` int(11) NOT NULL,
  `owner_id` int(11) NOT NULL,
  `created` datetime NOT NULL,
  `last_update` datetime NOT NULL,
  PRIMARY KEY  (`hcalendar_ptr_id`),
  KEY `web_event_owner_id` (`owner_id`),
  CONSTRAINT `owner_id_refs_id_3952a136` FOREIGN KEY (`owner_id`)
REFERENCES `web_account` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin

Is this expected behaviour?
--~--~-~--~~~---~--~~
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: Internal Server Error for just one site

2009-09-23 Thread phoebebright

Graham,

Yes to all your questions and thanks for the very helpful link - That
is going to come in most useful.

Found the error inspired by another thread, which was a missing custom
Middleware call that had been copied through from another app.  Once
that was removed django started displaying error messages again.  What
was so frustrating was that no errors were being displayed in the
apache error log - I guess the check for middleware happens early in
django.

Thanks for your help.

Phoebe.

On Sep 23, 10:56 am, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> On Sep 23, 7:11 pm, phoebebright <phoebebri...@spamcop.net> wrote:
>
> > Can anyone suggest where the problem might be for this one.
>
> > I am using wsgi and have a number of other django sites on this server
> > all running fine.  Have recreated the subdomain on the server, have
> > copied the vhost.conf file from a site that works and changed the
> > appropriate names (several times!) and ditto for the django.wsgi
> > file.  So it seems likely that it is reaching django ok but something
> > in my django setup for this site is wrong.  I'm not getting any error
> > messages in the apache log file to give me a clue.
>
> > Totally baffled so any suggestions would be welcome!
>
> Have you looked in the Apache error logs for what error may be getting
> logged?
>
> Have you defined a 404 page handler in Django?
>
> Have you turned on Django DEBUG to try and get it to display a more
> information error page if it is getting to Django?
>
> Have you tried using a WSGI wrapper around Django to capture request/
> response to confirm that request is coming and exactly what response
> is coming out?
>
> For the last one, see:
>
>  http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Tracking_Re...
>
> Graham
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Internal Server Error for just one site

2009-09-23 Thread phoebebright

Can anyone suggest where the problem might be for this one.

I am using wsgi and have a number of other django sites on this server
all running fine.  Have recreated the subdomain on the server, have
copied the vhost.conf file from a site that works and changed the
appropriate names (several times!) and ditto for the django.wsgi
file.  So it seems likely that it is reaching django ok but something
in my django setup for this site is wrong.  I'm not getting any error
messages in the apache log file to give me a clue.

Totally baffled so any suggestions would be welcome!

--~--~-~--~~~---~--~~
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: Model object has no attribute 'get'

2009-09-21 Thread phoebebright

Karen,

Yes absolutely right.  Thanks for rescuing me from own stupidity!

On Sep 21, 4:54 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Mon, Sep 21, 2009 at 11:49 AM, phoebebright 
> <phoebebri...@spamcop.net>wrote:
>
>
>
>
>
> > On Sep 21, 3:25 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> > Karen,
>
> > Spot on with the first positional argument I think, but I now get the
> > error:
> > form = TweetForm(instance=obj)
> > TypeError: __init__() got an unexpected keyword argument 'instance'
>
> > Here is the view:
>
> >    if request.method == 'POST':
> >        form = TweetForm(request.POST)
> >        etc.
> >    elif isinstance(obj, TweetLog):
> >        form = TweetForm(instance=obj)     <- had TweetForm(obj)
> > before!
> >    else:
> >        default_taglist = request.session.get('taglist', '')
> >        form = TweetForm(initial = {'tweet_taglist' :
> > default_taglist}) # An unbound form
>
> >    return form
>
> > And the form:
>
> > class TweetForm(forms.Form):
>
> TweetForm isn't a ModelForm, therefore it doesn't support passing a model
> instance as a parameter.  Given it looks like you are giving it a Meta class
> as if it were a ModelFrom below, perhaps all you need to do to fix it is
> change the base class here.
>
> >    tweet = forms.CharField(widget=TweetFieldWidget(), required=True)
> >    tweet_taglist = forms.CharField(max_length=100, required=False)
> >    process_backwards = forms.BooleanField(required=False)
>
> >    attached_notes = forms.CharField(widget=forms.Textarea,
> > required=False)
> >    attached_url = forms.URLField(required=False)
> >    attached_file = forms.FileField(required=False)
> >    attached_image = forms.ImageField(required=False)
>
> >    class Media:
> >        js = ('/js/jquery.js', '/js/jquery-ui.min.js','js/
> > jeditable.js','js/tweetform.js', 'js/jquery-ui.tabs.js')
> >        css = { 'all': ('/css/jquery-ui.css','/css/smoothness/jquery-
> > ui-1.7.2.custom.css') }
>
> >    class Meta :
> >        model = TweetLog
> >        fields =
> > ('tweet','attached_notes','attached_url','attached_file','attached_image')
>
>
--~--~-~--~~~---~--~~
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: Form Select Selected Choice

2009-09-21 Thread phoebebright

Can you give a more detailed example of your code?


On Sep 21, 3:25 am, "Leonel Nunez"  wrote:
> Hello:
>
> I'm using
>
> form.base_fields['MYFIELD'].widget=widgets.Select(choices=CA)
>
> to fill a   tag, all works fine but I can't find how to add a
> SELECTED  value, been with this issue all day ..
>
> 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: Model object has no attribute 'get'

2009-09-21 Thread phoebebright


On Sep 21, 3:25 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Mon, Sep 21, 2009 at 10:05 AM, phoebebright 
> <phoebebri...@spamcop.net>wrote:
>
>
>
> > Have been stuck on this one for a couple of days so hoping for some
> > enlightenment from some more able django users.  Am aware of the
> > 'gotcha' where the model name matches and attribute or one of the Meta
> > values.
>
> > I am getting this when a form is instantiated with an existing object
> > - no problem if the form is blank.
>
> Since you are getting an error when the form is instantiated with an
> existing object, that would have been more helpful code to post than the
> model definition.  It appears based on the error you are getting that in
> this case you are passing the existing object as the first positional
> argument?  At any rate the model instance you are using appears to be
> getting assigned to the form data attribute, which could happen if you are
> passing the instance as the first positional argument when you create the
> form.
>
> I do not think the problem has anything to do with the names of the fields
> in your model but rather it has to do with exactly what code you are using
> to create the form when you have an existing instance you want to use.
>
> Karen

Karen,

Spot on with the first positional argument I think, but I now get the
error:
form = TweetForm(instance=obj)
TypeError: __init__() got an unexpected keyword argument 'instance'


Here is the view:

if request.method == 'POST':
form = TweetForm(request.POST)
etc.
elif isinstance(obj, TweetLog):
form = TweetForm(instance=obj) <- had TweetForm(obj)
before!
else:
default_taglist = request.session.get('taglist', '')
form = TweetForm(initial = {'tweet_taglist' :
default_taglist}) # An unbound form

return form

And the form:

class TweetForm(forms.Form):

tweet = forms.CharField(widget=TweetFieldWidget(), required=True)
tweet_taglist = forms.CharField(max_length=100, required=False)
process_backwards = forms.BooleanField(required=False)

attached_notes = forms.CharField(widget=forms.Textarea,
required=False)
attached_url = forms.URLField(required=False)
attached_file = forms.FileField(required=False)
attached_image = forms.ImageField(required=False)

class Media:
js = ('/js/jquery.js', '/js/jquery-ui.min.js','js/
jeditable.js','js/tweetform.js', 'js/jquery-ui.tabs.js')
css = { 'all': ('/css/jquery-ui.css','/css/smoothness/jquery-
ui-1.7.2.custom.css') }

class Meta :
model = TweetLog
fields =
('tweet','attached_notes','attached_url','attached_file','attached_image')

--~--~-~--~~~---~--~~
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: ImportError: Could not import settings 'WWlove.settings'

2009-09-21 Thread phoebebright

Only a guess but maybe mixed case in WWlove is causing a problem?


On Sep 20, 10:50 pm, Jose Sibande  wrote:
> Hi,
> I get this error in /var/log/apache2/error.log:
>
> [Mon Sep 21 01:38:14 2009] [error] [client 41.157.12.3] ImportError:
> Could not import settings 'WWlove.settings' (Is it on sys.path? Does
> it have syntax errors?): No module named settings
>
> And my /home/jose/WWlove/apache/django.wsgi Looks like this:
> import os, sys
> sys.path.append('/home/jose')
> sys.path.append('/home/jose/WWlove')
> os.environ['DJANGO_SETTINGS_MODULE'] = 'WWlove.settings'
>
> import django.core.handlers.wsgi
>
> application = django.core.handlers.wsgi.WSGIHandler()
>
> *The mod_wsgi documentation address this issue and says that if this
> error occurs then that means I haven't spelled my path welll.
> I looked, trying to spot the error, but evrything seems spelt ok.
>
> Please help, everythinhg works well on local machine.
> Thank You
--~--~-~--~~~---~--~~
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: Records doesn't sometimes get upated

2009-09-21 Thread phoebebright

The code looks like it only handles the case of adding a new foo
object but your comments refer to "old values".  Are you also
expecting this to work for an update?



On Sep 21, 7:35 am, Szymon  wrote:
> Hello,
>
> I have strange problem. I will give example. I have model:
>
> class foo(models.Model)
>  bar = models.IntegerField()
>
> and method in it
>
>  def add_bar(c):
>   from something.models import bar_log
>   b = bar_log(foo=self, cnt=c)
>   b.save()
>   self.bar += c
>   self.save()
>
> ... and now the problem. Sometimes "bar" in "foo" doesn't get updated.
> There is record in bar_log, but "bar" in "foo" have old value. How can
> I trace problem? There are no exceptions at all.
>
> I'm using Django 1.1, Postgresql with psycopg2 as interface. There are
> two parts of my application - web interface and daemonized part that
> runs some background tasks every 5 seconds.
>
> Best regards,
> Szymon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Model object has no attribute 'get'

2009-09-21 Thread phoebebright

Have been stuck on this one for a couple of days so hoping for some
enlightenment from some more able django users.  Am aware of the
'gotcha' where the model name matches and attribute or one of the Meta
values.

I am getting this when a form is instantiated with an existing object
- no problem if the form is blank.
Have tried renaming the model and renaming most of the fields in case
the model name was used elsewhere or the fields were reserved words.
Not sure what else to try and suspect the real problem is that I don't
understand what the error message is trying to tell me!

Here is the model:

class TweetLog(models.Model):

tweet = models.TextField()

content_type = models.ForeignKey(ContentType, blank=True,
null=True)
object_id = models.PositiveIntegerField(blank=True, null=True)
content_object = generic.GenericForeignKey('content_type',
'object_id')

project = models.ForeignKey(Project, blank=True, null=True)
attached_notes = models.TextField(blank=True, null=True)
attached_url = models.URLField(blank=True, null=True)
attached_file = models.FileField(upload_to="uploads/files/",
blank=True, null=True)
attached_image = models.FileField(upload_to="uploads/images/",
blank=True, null=True)

owner = models.ForeignKey(Who, related_name='tweeter')
created = models.DateTimeField(default=datetime.now)

And the traceback - it gets to the template before complaining:

Original Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/template/debug.py", line 71, in
render_node
result = node.render(context)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/template/debug.py", line 87, in render
output = force_unicode(self.filter_expression.resolve(context))
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/utils/encoding.py", line 71, in
force_unicode
s = unicode(s)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/forms/forms.py", line 356, in
__unicode__
return self.as_widget()
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/forms/forms.py", line 386, in as_widget
data = self.data
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/forms/forms.py", line 413, in _data
return self.field.widget.value_from_datadict(self.form.data,
self.form.files, self.html_name)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/forms/widgets.py", line 170, in
value_from_datadict
return data.get(name, None)
AttributeError: 'TweetLog' object has no attribute 'get'


--~--~-~--~~~---~--~~
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 Module named ... problem

2009-09-03 Thread phoebebright

Russ,

Phew - you set me on the right track there.  I actually had an app
called events at the same level as the main app

/django
   /appwithproblem
   /web
   /events
   /events
  /web


There are various errors reported - like the above .__init__ one where
python behaves correctly but not in the way some newbies might
expect.  Be great to write an app that looked for all these possible
errors  - called "dont_do_that" maybe.  If I had a spare 5 mins


Thanks so much.




On Sep 3, 12:39 am, Russell Keith-Magee <freakboy3...@gmail.com>
wrote:
> On Wed, Sep 2, 2009 at 11:38 PM, phoebebright<phoebebri...@spamcop.net> wrote:
>
> > And it's not a missing __init__.py program that I can see.
>
> > Am trying to move a site to a new server - CentOS to Ubuntu and
> > version of python are changing from 2.4.3 to 2.5.2 and using wsgi now
> > instead of mod_python.
>
> > I already have one django site running on the new server so the basic
> > setup is ok.
> > The old site runs fine on the old server
> > But when I copy the code across, and the data, and change the settings
> > and try to run I get
>
> > ViewDoesNotExist
> > Exception Value:
> > Could not import towns.town.views. Error was: No module named models
>
> > The offending line seems to be:
> >      from events.models import Event
>
> > There is an events app off the main directory
> > It has a __init__.py
> > There is a models.py and it does contain a class Event
> > The paths look fine.
>
> > I've deleted and recopied the whole lot, restarted apache countless
> > times, deleted the offending line and it just falls over on the next
> > reference to the events.model file.
>
> > Googled till I'm cross eyed - I bet it's something simple but I'm
> > baffled!
>
> > An ideas gratefully received.
>
> One possible cause is a naming confusion. Take the following directory
> structure:
>
> events/
>     __init__.py
>     models.py
> stuff/
>     __init__.py
>     events.py
>     utils.py
>
> In this situation, if utils.py includes "from events.models import
> Event", you will get the error you describe because the 'events'
> module that is found is actually stuff.events, not the top level
> events.
>
> This error can even persist after you delete the events.py - if
> events.pyc still exists in the stuff directory, it will get used in
> preference to the actual code module.
>
> I don't know if this is your problem specifically, but this has bitten
> me in the past.
>
> Yours,
> Russ Magee %-)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



No Module named ... problem

2009-09-02 Thread phoebebright

And it's not a missing __init__.py program that I can see.

Am trying to move a site to a new server - CentOS to Ubuntu and
version of python are changing from 2.4.3 to 2.5.2 and using wsgi now
instead of mod_python.

I already have one django site running on the new server so the basic
setup is ok.
The old site runs fine on the old server
But when I copy the code across, and the data, and change the settings
and try to run I get

ViewDoesNotExist
Exception Value:
Could not import towns.town.views. Error was: No module named models

The offending line seems to be:
  from events.models import Event

There is an events app off the main directory
It has a __init__.py
There is a models.py and it does contain a class Event
The paths look fine.


I've deleted and recopied the whole lot, restarted apache countless
times, deleted the offending line and it just falls over on the next
reference to the events.model file.

Googled till I'm cross eyed - I bet it's something simple but I'm
baffled!

An ideas gratefully received.




--~--~-~--~~~---~--~~
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: Error - got an unexpected keyword argument 'instance' on initialising form

2009-07-28 Thread phoebebright

That would be it!  Thanks for your prompt help - onwards

On Jul 28, 7:06 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
> On Tue, Jul 28, 2009 at 2:02 PM, phoebebright<phoebebri...@spamcop.net> wrote:
>
> > I thought I was faithfully coping the tutorial, so don't understand
> > why I get this error.
>
> > Here is the code in the view:
>
> > @login_required
> > def edit_todo(request, todo_id):
>
> >    task = Task.objects.get(id=todo_id)
>
> >    if request.method == 'POST':
> >         form = TaskForm(request.POST)
> >         ...
>
> >    else:
> >         form1 = TaskForm()  # this is ok
> >         form2 = TaskForm(instance=task) #this fails with error
>
> >  __init__() got an unexpected keyword argument 'instance'
>
> > Form is simple:
>
> > class TaskForm(forms.Form):
> >    owner = forms.ModelChoiceField(Who.objects.filter(owner=1),
> > empty_label=None, required=True)
> >    name = forms.CharField(max_length=140, required=True)
> >    taglist = forms.CharField(max_length=100, required=False)
> >    description = forms.CharField(widget=forms.Textarea,
> > required=False)
>
> >    class Media:
> >        js = ('/js/jquery.js', '/js/jquery-ui.min.js','js/
> > jeditable.js',)
> >        css = { 'all': ('/css/jquery-ui.css','/css/smoothness/jquery-
> > ui-1.7.2.custom.css') }
>
> >    class Meta :
> >        model = Task
>
> > ??? Is it something obvious again?
>
> It looks like you intended to use a ModelForm, but instead inherited
> from Form, change you form to subclass forms.ModelFrom.
>
> 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
> "Code can always be simpler than you think, but never as simple as you
> want" -- Me
--~--~-~--~~~---~--~~
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 select multiple date from calendar

2009-07-28 Thread phoebebright

Don't have the whole answer, but google parsedatetime python library
which has some good utilities to extract dates from text.  You can
then build the required queryset.

On Jul 28, 10:49 am, kimo  wrote:
> Hi,
>
> Im new in using Django, and i want to know if there is some way to
> have a multiple date selection from a calendar,
>
> i have multiple days :
>
> for example a day is :
>
> [ 28 july 2009 8:30 - 28 july 17h00 ]
>
> Is there any way to do this with Django Forms
>
> Thanks a lot
>
> kimo
--~--~-~--~~~---~--~~
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: MS Word Characters

2009-07-28 Thread phoebebright

Be very interested in the answer too!

On Jul 28, 4:02 pm, cootetom  wrote:
> I know why it's failing when I send it as an email. The django
> EmailMessage class will try to encode any text based attachment down
> to ascii. So any attachment containing characters out side of ascii
> can't be sent using django's EmailMessage class.
>
> This doesn't really solve my problem, sort of makes it harder to see a
> way forward.
>
> Someone must have a way of working with text pasted from MS Word in
> django?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Error - got an unexpected keyword argument 'instance' on initialising form

2009-07-28 Thread phoebebright

I thought I was faithfully coping the tutorial, so don't understand
why I get this error.

Here is the code in the view:

@login_required
def edit_todo(request, todo_id):

task = Task.objects.get(id=todo_id)

if request.method == 'POST':
 form = TaskForm(request.POST)
 ...

else:
 form1 = TaskForm()  # this is ok
 form2 = TaskForm(instance=task) #this fails with error

 __init__() got an unexpected keyword argument 'instance'

Form is simple:

class TaskForm(forms.Form):
owner = forms.ModelChoiceField(Who.objects.filter(owner=1),
empty_label=None, required=True)
name = forms.CharField(max_length=140, required=True)
taglist = forms.CharField(max_length=100, required=False)
description = forms.CharField(widget=forms.Textarea,
required=False)

class Media:
js = ('/js/jquery.js', '/js/jquery-ui.min.js','js/
jeditable.js',)
css = { 'all': ('/css/jquery-ui.css','/css/smoothness/jquery-
ui-1.7.2.custom.css') }

class Meta :
model = Task

??? Is it something obvious again?

--~--~-~--~~~---~--~~
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: OSX - says view is missing but it isn't

2009-07-22 Thread phoebebright

Finally found the problem was a recusive call when I happened to be
using the shell.  Strange that it would work at all!


In [1]: import tweetlog.views
---
ImportError   Traceback (most recent call
last)

/Users/phoebebr/Development/tinywho/ in ()

/Users/phoebebr/Development/tinywho/tweetlog/views.py in ()
 10
 11
---> 12 from web.views import *
 13 from forms import *
 14 from django.contrib.auth.decorators import login_required

/Users/phoebebr/Development/tinywho/web/views.py in ()
  4 from tagging.models import *
  5 from tweetlog.models import TweetLog
> 6 from tweetlog.views import parse_tweet, autolink
  7
  8

ImportError: cannot import name parse_tweet



On Jul 20, 11:11 am, phoebebright <phoebebri...@spamcop.net> wrote:
> My development environment has just started behaving strangely.  If I
> cause an error, fix it and call the same URL again (not refresh, just
> enter link)  I get
>
> ViewDoesNotExist: Could notimporttweetlog.views. Error was: cannotimportname 
> parse_tweet
>
> The module and view are fine and if I go to the home page and click on
> the link to the exact same URL it works fine until the next error,
> when I have to go back to the home page.  It was working fine until
> yesterday so I presume I have broken something somewhere but a bit
> baffled as to where to look!
>
> Any ideas welcome.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Template tags as parameter to template tag

2009-07-20 Thread phoebebright

Is there a way to get this to work:

{% for tag in tags %}
{% tag_link
"{{tag.name}}" %}
{% endfor %}


The outer loop is using the standard tagging application and the
tag_link is my custom template tag which has a different url depending
on the type of tag.
I don't really want to amend the tagging app, so what is the correct
way of doing this.  Extending the template tag class?



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



OSX - says view is missing but it isn't

2009-07-20 Thread phoebebright

My development environment has just started behaving strangely.  If I
cause an error, fix it and call the same URL again (not refresh, just
enter link)  I get

ViewDoesNotExist: Could not import tweetlog.views. Error was: cannot
import name parse_tweet

The module and view are fine and if I go to the home page and click on
the link to the exact same URL it works fine until the next error,
when I have to go back to the home page.  It was working fine until
yesterday so I presume I have broken something somewhere but a bit
baffled as to where to look!

Any ideas welcome.

--~--~-~--~~~---~--~~
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-registration .missing templates?

2009-07-20 Thread phoebebright

Send me an email and I will post back the forms I used. email username
as above plus spamcop.net.

On Jul 19, 6:08 pm, Asinox  wrote:
> Hi guys, im trying to use the django-registration...im new with
> django, but i was thinking that maybe some templates are missing, like
> registration, login... i cant found ..but i dont know if i need to
> create the templates...
>
> Some help?
>
> 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: in admin interface - how to edit/show data based on ownership/not ownership

2009-06-11 Thread phoebebright

This post might help -
http://groups.google.com/group/django-users/browse_thread/thread/c84dbbac27c6fea2/cf6624cca547fe89?lnk=gst=admin+owner#cf6624cca547fe89
Not exactly what you want but might give you some ideas.

On Jun 11, 7:36 pm, "Sergio A."  wrote:
> Hello,
>
> in this blog post:
>
> http://www.b-list.org/weblog/2008/dec/24/admin/
>
> it is explained how to list only data that someone owns and restrict
> edit permission.
> What I'd like to do is to list all the data, but let users change only
> those owned, while showing the rest for reading.
>
> This means that I should be able to compare logged user to the data
> owner and then select a proper template (to change/present) data.
>
> Any example on how to do this in the admin module?
>
> Thanks, Sergio
--~--~-~--~~~---~--~~
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 Views vs. Admin

2009-06-11 Thread phoebebright

Jashugan,

I agree that generic views for non-admins make sense, just be nice to
be able to say

body_html = auto_generate(model, list/display/update etc.)

or whatever admin is doing and stick that in a generic template.

{% extends 'base.html' %}

{% block main %}

{{body_html}}

{% endblock %}


What do you think?


On Jun 11, 4:34 pm, Jashugan <jashu...@gmail.com> wrote:
> On Jun 11, 8:03 am, phoebebright <phoebebri...@spamcop.net> wrote:
>
> > I have spent a good deal time researching this online and in this
> > group but can find no clear answer.
>
> I think the reason why is that it depends on what you want to do.
>
> > My instinct is that I should use the former, but do I really have to
> > go and write all those templates when admin is so good at it already?
>
> I use generic views for models that need to be administered by any non-
> programmer admins.  One reason is that they are consistent with the
> look of the rest of the site, whereas the admin interface is not.
> Another is that I usually end up having to customize either the view
> logic or the template that it uses slightly, so I would prefer to have
> a 'stub' in place to go off of.
--~--~-~--~~~---~--~~
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 Views vs. Admin

2009-06-11 Thread phoebebright

I have spent a good deal time researching this online and in this
group but can find no clear answer.

Generally, I can either use generic views and write a template for
each model to list/view/update/delete or I can use admin and do a
filter to only show a particular person's entries.

My instinct is that I should use the former, but do I really have to
go and write all those templates when admin is so good at it already?

(I'm sure this discussion has already been done so do point me at the
thread - I have looked and looked...)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Book: Python Web Development with Django

2009-06-04 Thread phoebebright

Just finished reading this book and found it really helpful as a
newbie to both Python and Django.  The things I really liked about
this book:
- assumes I know very little
- intro to python programming just the right level of detail for me
- tutorials include plenty of real code examples
- gotchas chapters listing comment mistakes
- sections on chacheing, version control and testing


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Looking for coupon/voucher plugin

2009-05-20 Thread phoebebright

Have a client looking to add special 1euro night offers on local
hotels.  Have googled extensively for any site offering to manage the
issuing of vouchers/coupons but can only find sites issuing coupons on
behalf of others.  If there is not such service, is there an opening
for doing a django one?

I imagine being able to register as the customer and getting a bit of
code they can stick on their site that allows their visitors to
request a voucher.

If you know of an existing service, please let me know, I have no
desire to re-invent the wheel!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Signals giving: global name 'MyModel' is not defined

2009-05-14 Thread phoebebright

Have been at this now for some hours and still can't see the wood for
the trees.  Failed to get two signals working - one called on pre_save
to keep an audit trail of one field on a model (didn't implemenet the
Audit.py version in the wiki as more complex than I needed).  The
other to create some default records in a related table.  Both are
failing with the same error and I suspect I am going to kick myself
when someone points out the obvious, but here goes.

Model.py

(simplified)

class Version(models.Model):

version_no = models.CharField(_('ver'), max_length=10, unique=True)
name = models.CharField(_('name'), max_length=50, unique=True)

class VersionDocs(models.Model):

version = models.ForeignKey('Version')
doc_content = models.TextField(_('content'))


class VersionDocsVer(models.Model):

doc = models.ForeignKey('VersionDocs')
doc_content = models.TextField(_('content'))


pre_save.connect(keep_version, sender=VersionDocs)
post_save.connect(default_docs, sender=Version)



signals.py

(simplified)

from devcycle.models import *

def default_docs(instance, **kwards):

try:
doc = VersionDocs.objects.filter(version=instance.id)

except:



def keep_version(instance, **kwargs):

print 'version instance =',instance.id
original = VersionDocs.objects.get(id=instance.id)





Using Django version 1.1 beta 1,





--~--~-~--~~~---~--~~
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: Print question

2009-05-09 Thread phoebebright

Masklinn,

Thanks. I see what you mean about being bored!  But that's a big step
forward for me.

As a PHP convert to Django/Python, I'm looking for the equivalent of
print_r

On May 9, 4:31 pm, Masklinn <maskl...@masklinn.net> wrote:
> On 9 May 2009, at 16:37 , phoebebright wrote:
>
> > Not looking for a discussion on debug methods, just want to know if
> > there is any way to print an object.
>
> > eg. print myobject  OR  pprint.pprint(myobject)
>
> > just says something like
>
> > 
>
> > And unless I know the structure of the object I can't access the
> > values.
>
> > I'm probably going to get a blasting for not understanding how python
> > works, but there we go!
>
> You can print its __dict__ attribute if you're really bored. If it's  
> an object you created, correctly override the corresponding magic  
> methods (__str__, __repr__, ...)
--~--~-~--~~~---~--~~
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: Only show field in admin for superuser

2009-05-09 Thread phoebebright

Just a postscript to this - this will fail if the field being left out
is a required field.  The admin form will show an error but as the
field is missing you will not know what the error is.  I think with
the new hidden_fields option, this will be a workaround.

On Apr 23, 8:20 pm, phoebebright <phoebebri...@spamcop.net> wrote:
> That just what I needed!  Many thanks.
> Here is the code that worked for me:
>
> class WhoAdmin(admin.ModelAdmin):
>
>         fields = ('name','owner')
>
>         def get_fieldsets(self, request, obj=None):
>
>                 fs = super(WhoAdmin, self).get_fieldsets(request, obj)
>                 # only allow superusers to see/change owner
>                 fields=list(fs[0][1]['fields'])
>
>                 if not request.user.is_superuser:
>                         fields.remove('owner')
>
>                 return [(None, {'fields': tuple(fields)})]
>
>         def queryset(self, request):
>                 if request.user.is_superuser:
>                         return Who.objects.all()
>                 else:
>                         return Who.objects.filter(owner=request.user)
>
>         class Meta:
>                 model = Who
>
> admin.site.register(Who,WhoAdmin)
>
> On Apr 23, 12:06 pm, Zain Memon <z...@inzain.net> wrote:
>
>
>
> > In that case, try overriding ModelAdmin.get_fieldsets(); add the owner field
> > to self.fieldset if request.user.is_superuser, and then call
> > super.get_fieldsets().
> > For reference, you can find get_fieldsets() (and other beautiful things you
> > can override) in django/contrib/admin/options.py.
>
> > On Thu, Apr 23, 2009 at 3:32 AM, phoebebright 
> > <phoebebri...@spamcop.net>wrote:
>
> > > Zain,
>
> > > Thanks for responding.
> > > I would really prefer not to show the field at all - I don't want
> > > ordinary users being able to see a list of all the users on the
> > > system!
>
> > > Phoebe
>
> > > On Apr 23, 9:42 am, Zain Memon <z...@inzain.net> wrote:
> > > > You can override the ModelAdmin.save_model() method to check if the
> > > current
> > > > user has permission to change the owner.
> > > > Take a look athttp://www.b-list.org/weblog/2008/dec/24/admin/toseean
> > > > example.
>
> > > > On Thu, Apr 23, 2009 at 1:37 AM, phoebebright <phoebebri...@spamcop.net
> > > >wrote:
>
> > > > > I have a model with an owner field that I only want a superuser to be
> > > > > able to change.  I can't change the list of fields in form in admin.py
> > > > > because there is not request.user to test at that time.  If I were
> > > > > using custom templates I could put it in the template, but would
> > > > > rather stick to the standard admin.
>
> > > > > If I add the field by default, Is there somewhere I could remove the
> > > > > field as it's being loaded if the requesting user is not a superuser?
> > > > > Any ideas gratefully received!
>
> > > > > THIS DOES NOT WORK:
>
> > > > >    if request.user.is_superuser:
> > > > >         fieldsets = [
> > > > >             (None,   {'fields':
> > > > > ['tourism','community','cat','name','is_live','paid','owner']}),
> > > > >             ('Contact', {'fields':
> > > > > ['phone','mobile','fax','email','web','address']}),
> > > > >             ('Details', {'fields':
> > > > > ['description','pic1','pic2','pic3','pic4']}),
> > > > >         ]
> > > > >    else:
> > > > >         fieldsets = [
> > > > >             (None,   {'fields':
> > > > > ['tourism','community','cat','name','is_live','paid','owner']}),
> > > > >             ('Contact', {'fields':
> > > > > ['phone','mobile','fax','email','web','address']}),
> > > > >             ('Details', {'fields':
> > > > > ['description','pic1','pic2','pic3','pic4']}),
> > > > >         ]
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Print question

2009-05-09 Thread phoebebright

Not looking for a discussion on debug methods, just want to know if
there is any way to print an object.

eg. print myobject  OR  pprint.pprint(myobject)

just says something like



And unless I know the structure of the object I can't access the
values.


I'm probably going to get a blasting for not understanding how python
works, but there we go!



--~--~-~--~~~---~--~~
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: Error message in admin - row level permissions

2009-05-09 Thread phoebebright

A victim of my own cleverness!  Part of the row permissions was to
prevent the owner changing ownership, so I had this in the admin form:

def get_fieldsets(self, request, obj=None):
if request.user.is_superuser or request.user.has_perm
('town.admin_business'):
fields=[
(None,   {'fields':
['tourism','community','cat','name','is_live','paid','owner']}),
]
else:
fields=[
(None,   {'fields':
['tourism','community','cat','name','is_live','paid']}),
]
return fields


So the form is generating an error that owner is not filled in, but
because owner is not on the form there is nowhere to display it!
Mystery solved.

So now trying to work out how to pass the owner info to the admin
form.  Tried hidden_fields, but this not available in version 1.0 of
Django.



On May 9, 9:18 am, phoebebright <phoebebri...@spamcop.net> wrote:
> I have almost implemented a row level permissions facilitiy for a
> model in my app.
>
> I can change the owner of the record
> Display only their records in admin
> But when logged in as the owner and click Save on the edit screen I
> get the error "Please correct the error below." but no indication of
> what the error is.  If I log in with permissions to change the table
> or as superuser I don't get this error, so I assume there is some
> permissions checking going on somewhere.
>
> In an attempt to find where the problem is I have:
>
> in admin.py
>
> def has_change_permission(self, request, obj=None):
>    return True
>
> def save_model(self, request, obj, form, change):
>                 '''
>                 do nothing
>                 '''
>
> Nothing makes a difference.  Any suggestions as to where to look very
> welcome as am stumped!
--~--~-~--~~~---~--~~
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: Error message in admin - row level permissions

2009-05-09 Thread phoebebright

Is this a clue?

Got this info from forcing an error at the top of the form.
Permissions are correct but seems to think there is a field missing,
but not saying which one.  Tried making sure there is data in every
field but still no change.  Just to confirm, I can save this with a
user with table permissions.

(['admin/town/business/change_form.html', 'admin/town/
change_form.html', 'admin/change_form.html'],
 {'add': False,
'adminform': ,
'app_label': 'town',
'change': True,
'content_type_id': 45L,
'errors': [u'This field is required.'],
'form_url': '',
'has_absolute_url': True,
'has_add_permission': False,
'has_change_permission': True,
'has_delete_permission': False,
'has_file_field': True,
'inline_admin_formsets': [],
'is_popup': False,
'media': '\n\n\n\n\n\n',
'object_id': u'86',
'opts': ,
'ordered_objects': [],
'original': ,
'root_path': u'/admin/',
'save_as': False,
'save_on_top': False,
'title': u'Change Business Directory'})


On May 9, 9:18 am, phoebebright <phoebebri...@spamcop.net> wrote:
> I have almost implemented a row level permissions facilitiy for a
> model in my app.
>
> I can change the owner of the record
> Display only their records in admin
> But when logged in as the owner and click Save on the edit screen I
> get the error "Please correct the error below." but no indication of
> what the error is.  If I log in with permissions to change the table
> or as superuser I don't get this error, so I assume there is some
> permissions checking going on somewhere.
>
> In an attempt to find where the problem is I have:
>
> in admin.py
>
> def has_change_permission(self, request, obj=None):
>    return True
>
> def save_model(self, request, obj, form, change):
>                 '''
>                 do nothing
>                 '''
>
> Nothing makes a difference.  Any suggestions as to where to look very
> welcome as am stumped!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Error message in admin - row level permissions

2009-05-09 Thread phoebebright

I have almost implemented a row level permissions facilitiy for a
model in my app.

I can change the owner of the record
Display only their records in admin
But when logged in as the owner and click Save on the edit screen I
get the error "Please correct the error below." but no indication of
what the error is.  If I log in with permissions to change the table
or as superuser I don't get this error, so I assume there is some
permissions checking going on somewhere.

In an attempt to find where the problem is I have:

in admin.py

def has_change_permission(self, request, obj=None):
   return True

def save_model(self, request, obj, form, change):
'''
do nothing
'''


Nothing makes a difference.  Any suggestions as to where to look very
welcome as am stumped!



--~--~-~--~~~---~--~~
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: Only show field in admin for superuser

2009-04-23 Thread phoebebright

That just what I needed!  Many thanks.
Here is the code that worked for me:

class WhoAdmin(admin.ModelAdmin):

fields = ('name','owner')

def get_fieldsets(self, request, obj=None):

fs = super(WhoAdmin, self).get_fieldsets(request, obj)
# only allow superusers to see/change owner
fields=list(fs[0][1]['fields'])


if not request.user.is_superuser:
fields.remove('owner')

return [(None, {'fields': tuple(fields)})]

def queryset(self, request):
if request.user.is_superuser:
return Who.objects.all()
else:
return Who.objects.filter(owner=request.user)

class Meta:
model = Who

admin.site.register(Who,WhoAdmin)


On Apr 23, 12:06 pm, Zain Memon <z...@inzain.net> wrote:
> In that case, try overriding ModelAdmin.get_fieldsets(); add the owner field
> to self.fieldset if request.user.is_superuser, and then call
> super.get_fieldsets().
> For reference, you can find get_fieldsets() (and other beautiful things you
> can override) in django/contrib/admin/options.py.
>
> On Thu, Apr 23, 2009 at 3:32 AM, phoebebright <phoebebri...@spamcop.net>wrote:
>
>
>
>
>
> > Zain,
>
> > Thanks for responding.
> > I would really prefer not to show the field at all - I don't want
> > ordinary users being able to see a list of all the users on the
> > system!
>
> > Phoebe
>
> > On Apr 23, 9:42 am, Zain Memon <z...@inzain.net> wrote:
> > > You can override the ModelAdmin.save_model() method to check if the
> > current
> > > user has permission to change the owner.
> > > Take a look athttp://www.b-list.org/weblog/2008/dec/24/admin/tosee an
> > > example.
>
> > > On Thu, Apr 23, 2009 at 1:37 AM, phoebebright <phoebebri...@spamcop.net
> > >wrote:
>
> > > > I have a model with an owner field that I only want a superuser to be
> > > > able to change.  I can't change the list of fields in form in admin.py
> > > > because there is not request.user to test at that time.  If I were
> > > > using custom templates I could put it in the template, but would
> > > > rather stick to the standard admin.
>
> > > > If I add the field by default, Is there somewhere I could remove the
> > > > field as it's being loaded if the requesting user is not a superuser?
> > > > Any ideas gratefully received!
>
> > > > THIS DOES NOT WORK:
>
> > > >    if request.user.is_superuser:
> > > >         fieldsets = [
> > > >             (None,   {'fields':
> > > > ['tourism','community','cat','name','is_live','paid','owner']}),
> > > >             ('Contact', {'fields':
> > > > ['phone','mobile','fax','email','web','address']}),
> > > >             ('Details', {'fields':
> > > > ['description','pic1','pic2','pic3','pic4']}),
> > > >         ]
> > > >    else:
> > > >         fieldsets = [
> > > >             (None,   {'fields':
> > > > ['tourism','community','cat','name','is_live','paid','owner']}),
> > > >             ('Contact', {'fields':
> > > > ['phone','mobile','fax','email','web','address']}),
> > > >             ('Details', {'fields':
> > > > ['description','pic1','pic2','pic3','pic4']}),
> > > >         ]
--~--~-~--~~~---~--~~
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: Only show field in admin for superuser

2009-04-23 Thread phoebebright

Zain,

Thanks for responding.
I would really prefer not to show the field at all - I don't want
ordinary users being able to see a list of all the users on the
system!

Phoebe

On Apr 23, 9:42 am, Zain Memon <z...@inzain.net> wrote:
> You can override the ModelAdmin.save_model() method to check if the current
> user has permission to change the owner.
> Take a look athttp://www.b-list.org/weblog/2008/dec/24/admin/to see an
> example.
>
> On Thu, Apr 23, 2009 at 1:37 AM, phoebebright <phoebebri...@spamcop.net>wrote:
>
>
>
>
>
> > I have a model with an owner field that I only want a superuser to be
> > able to change.  I can't change the list of fields in form in admin.py
> > because there is not request.user to test at that time.  If I were
> > using custom templates I could put it in the template, but would
> > rather stick to the standard admin.
>
> > If I add the field by default, Is there somewhere I could remove the
> > field as it's being loaded if the requesting user is not a superuser?
> > Any ideas gratefully received!
>
> > THIS DOES NOT WORK:
>
> >    if request.user.is_superuser:
> >         fieldsets = [
> >             (None,   {'fields':
> > ['tourism','community','cat','name','is_live','paid','owner']}),
> >             ('Contact', {'fields':
> > ['phone','mobile','fax','email','web','address']}),
> >             ('Details', {'fields':
> > ['description','pic1','pic2','pic3','pic4']}),
> >         ]
> >    else:
> >         fieldsets = [
> >             (None,   {'fields':
> > ['tourism','community','cat','name','is_live','paid','owner']}),
> >             ('Contact', {'fields':
> > ['phone','mobile','fax','email','web','address']}),
> >             ('Details', {'fields':
> > ['description','pic1','pic2','pic3','pic4']}),
> >         ]
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Only show field in admin for superuser

2009-04-23 Thread phoebebright

I have a model with an owner field that I only want a superuser to be
able to change.  I can't change the list of fields in form in admin.py
because there is not request.user to test at that time.  If I were
using custom templates I could put it in the template, but would
rather stick to the standard admin.

If I add the field by default, Is there somewhere I could remove the
field as it's being loaded if the requesting user is not a superuser?
Any ideas gratefully received!


THIS DOES NOT WORK:

if request.user.is_superuser:
 fieldsets = [
 (None,   {'fields':
['tourism','community','cat','name','is_live','paid','owner']}),
 ('Contact', {'fields':
['phone','mobile','fax','email','web','address']}),
 ('Details', {'fields':
['description','pic1','pic2','pic3','pic4']}),
 ]
else:
 fieldsets = [
 (None,   {'fields':
['tourism','community','cat','name','is_live','paid','owner']}),
 ('Contact', {'fields':
['phone','mobile','fax','email','web','address']}),
 ('Details', {'fields':
['description','pic1','pic2','pic3','pic4']}),
 ]


--~--~-~--~~~---~--~~
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: pull down form

2009-04-08 Thread phoebebright

I like YUI and that has lots of menu possibilities - 
http://developer.yahoo.com/yui/menu/

On Apr 8, 5:43 pm, nixon66  wrote:
> Anyone have a good example of using a pull down menu in a Django
> template. I've just finished working through search forms, but
> couldn't find any examples of a pull down menu. Thanks in advance.
--~--~-~--~~~---~--~~
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 syncr and picasa - not displaying large images, mostly

2009-04-04 Thread phoebebright

Rajesh,

That make perfect sense.  Thank you so much.

Phoebe.

On Apr 3, 8:18 pm, Rajesh D <rajesh.dha...@gmail.com> wrote:
> On Apr 3, 12:59 pm, phoebebright <phoebebri...@spamcop.net> wrote:
>
> > I implemented syncr (http://code.google.com/p/django-syncr/) quickly
> > and easily but have one strange problem.  I can display thumbnails but
> > not the full size image.  But if I copy the URL in the src tag into
> > the browser, I see the image perfectly!!  How is this possible?
>
> > For example, this is fine:http://dunmanway.pighaswings.com/gallery/3/
>
> > But click on any of the images and you get a 404, image not found.
>
> > But paste this link into the browser and you should see a 
> > church:http://lh6.ggpht.com/_qN3t6LkRhaI/SZM3Weft1dI/AG8/Bzb8roA4lUA...
>
> > Any suggestions very welcome as this is supposed to go live today and
> > I am baffled!!!
>
> It's most likely because the server at ggpht.com forbids these images
> by HTTP_REFERER i.e. it prevents them from being embedded into
> external sites (probably to prevent bandwidth abuse). If you control
> the account at ggpht.com, see if there's a setting that allows linking
> of photos from external sites/blogs, etc.
>
> -Rajesh D
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Creating KML files for use in Google Maps

2009-02-27 Thread phoebebright

Took me a long long time to work out why the .kml file I created in
django would parse as valid in Feedburner but googlemaps said it was
an invalid kml file.  Need to be sending as correct content-type of
course.

In case anyone else is stuck, here is how I did it:

template
---

http://earth.google.com/kml/2.1;>

  
Seed Trial Locations
Where we are


{% for location in locations %}
  
{% if location.name %}{{ location.name }}{% else %}
{{ location }}{% endif %}
{% if location.description %}
{{ location.description }}{% else %}{{ location.name }}{% endif %}

{{location.longt}},{{location.lat}}

  
{% endfor %}






view

def generateKml(request):

locations = Location.objects.all().values('name','lat','longt')

result= render_to_response('locations.kml',{
'locations': locations
})

return HttpResponse(result,mimetype='Content-Type:application/
vnd.google-earth.kml+xml')

--~--~-~--~~~---~--~~
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: WYSIWYG Image upload challenge

2009-02-19 Thread phoebebright

Where do I do the compare though as the headers are not being returned
- the file is being downloaded so I don't get to see what might be
different.  (Using Firefox Firebug NET option - very helpful
otherwise).  It's the browser making the decision about how to handle
the request (Isn't it?).

On Feb 18, 8:23 pm, Colin Bean <ccb...@gmail.com> wrote:
> On Wed, Feb 18, 2009 at 10:50 AM, phoebebright
>
>
>
> <phoebebright...@gmail.com> wrote:
>
> > The javascript makes a call to this view on submitting the form that
> > uploads the image.
>
> > def uploadimage(request):
> >        try:
> >                upload_full_path = settings.CONTENT_IMAGES
>
> >                upload = request.FILES['image']
> >                dest = open(os.path.join(upload_full_path,
> > upload.name), 'wb+')
>
> >                for chunk in upload.chunks():
> >                        dest.write(chunk)
>
> >                dest.close()
>
> >                result='{status:"UPLOADED",image_url:"%s%s"}' %
> > (settings.CONTENT_IMAGES_URL, upload.name)
>
> >                return_data = HttpResponse(result,mimetype='Content-
> > Type: text/
> > html')
>
> >        except Exception, e:
> >                return_data = HttpResponse("Error in uploading image")
>
> >        return_data.flush()
>
> >        return return_data
>
> > In Firefox/Mac it uploads the file and returns
> > "{status:"UPLOADED",image_url:"/site_media/content/
> > dalston_cranes.JPG"}" to javascript which tells javascript all went
> > well.  In IE/Safari the file is uploaded successfully but the above
> > text is downloaded as a file called something like 2s6OP6WO(2).part so
> > control doesn't return to the javascript.  Have applied a similar
> > program in PHP and it works fine. Tried different mime types and tried
> > to trace what is going on but without progress.
>
> > Phoebe
>
> > On Feb 18, 2:33 pm, Almost George <almostgeo...@almostexciting.com>
> > wrote:
> >> On Feb 18, 5:36 am, phoebebright <phoebebright...@gmail.com> wrote:
>
> >> > There is something different about the way django is handling to 
> >> > response to php I think.
>
> >> I use the YUI Rich Editor in admin, and have no problems. I know
> >> debugging isn't as easy in IE as others, but do your best to find out
> >> the exact response (mostly, response headers) that's being sent to the
> >> browser. Also, could you clarify the above "response to PHP"
> >> statement? Perhaps explaining the technical details of what's going on
> >> would be of some help?
>
> Tools like Tamper Data (firefox extension) or WebScarab (standalone
> proxy) let you examine all the header values sent with an HTTP
> request.   You could use this to compare the exact headers returned by
> PHP vs. Django, and fix any differences in the Django response.
>
> Colin
--~--~-~--~~~---~--~~
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 CMS and Tiny_mce - ERROR 'module' object has no attribute 'JS_URL'

2009-02-19 Thread phoebebright

Glad it's sorted!


On Feb 19, 10:58 am, zegerman <plaut...@directbox.com> wrote:
> Thx Phoebe,
>
> but it wasn't the path.
>
> u have to change the admin.py
> from
> widgets.JS_URL,
> to
> widgets.tinymce.settings.JS_URL,
>
> source:http://groups.google.com/group/django-cms/browse_thread/thread/88dfe2...
>
> On 18 Feb., 19:59, Phoebe Bright <phoebebright...@gmail.com> wrote:
>
> > My experience with setting up tinymce was that there were plenty of plenty
> > of opportunities for getting the paths wrong!  To avoid problems I put a
> > dynamic link (ln -s) into the django admin media folder so it could use the
> > defaults.  Hope that helps.
>
> > Phoebe.
>
> > 2009/2/18 zegerman <plaut...@directbox.com>
>
> > > Hello,
>
> > > Im tryin to get Tiny_mce running with Django CMS.
> > > I installed Django CMS and its running fine.
> > > After that I setup django_tinymce and followed these steps:
>
> > >http://django-tinymce.googlecode.com/svn/tags/release-1.5/docs/.build...
>
> > > Thats my tiny_mce configuration in my settings.py
>
> > > TINYMCE_JS_URL = MEDIA_URL + 'js/tiny_mce/tiny_mce_src.js'
> > > TINYMCE_DEFAULT_CONFIG = {
> > >    'theme': "simple",
> > > }
>
> > > When I am activating Tiny_mce in the settings.py via CMS_USE_TINYMCE =
> > > True
> > > I get following error:
>
> > > 'module' object has no attribute 'JS_URL'
> > > Request Method: GET
> > > Request URL:    http://localhost:8000/admin/cms/page/3/
> > > Exception Type: AttributeError
> > > Exception Value:        'module' object has no attribute 'JS_URL'
> > > Exception Location:     D:\python\program\cms\admin.py in page_add_edit,
> > > line 126
>
> > > Does anyone know how what I am missing?
>
> > > Thx,
> > > zegerman
>
>
--~--~-~--~~~---~--~~
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: WYSIWYG Image upload challenge

2009-02-18 Thread phoebebright

That certainly looks like another option!  Thanks.

On Feb 18, 3:00 pm, Brandon Taylor <btaylordes...@gmail.com> wrote:
> FWIW, I have been able to successfully integrate Django Admin 
> Uploadshttp://code.google.com/p/django-admin-uploads/with jQuery. I'm not
> certain as to how difficult this would be to port to YUI. There are a
> couple of JS issues that I've had to fix with this, but otherwise, it
> works very well.
>
> Regards,
> Brandon
>
> On Feb 18, 8:33 am, Almost George <almostgeo...@almostexciting.com>
> wrote:
>
> > On Feb 18, 5:36 am, phoebebright <phoebebright...@gmail.com> wrote:
>
> > > There is something different about the way django is handling to response 
> > > to php I think.
>
> > I use the YUI Rich Editor in admin, and have no problems. I know
> > debugging isn't as easy in IE as others, but do your best to find out
> > the exact response (mostly, response headers) that's being sent to the
> > browser. Also, could you clarify the above "response to PHP"
> > statement? Perhaps explaining the technical details of what's going on
> > would be of some help?
>
>
--~--~-~--~~~---~--~~
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: WYSIWYG Image upload challenge

2009-02-18 Thread phoebebright

The javascript makes a call to this view on submitting the form that
uploads the image.

def uploadimage(request):
try:
upload_full_path = settings.CONTENT_IMAGES

upload = request.FILES['image']
dest = open(os.path.join(upload_full_path,
upload.name), 'wb+')

for chunk in upload.chunks():
dest.write(chunk)

dest.close()

result='{status:"UPLOADED",image_url:"%s%s"}' %
(settings.CONTENT_IMAGES_URL, upload.name)

return_data = HttpResponse(result,mimetype='Content-
Type: text/
html')

except Exception, e:
return_data = HttpResponse("Error in uploading image")

return_data.flush()

return return_data

In Firefox/Mac it uploads the file and returns
"{status:"UPLOADED",image_url:"/site_media/content/
dalston_cranes.JPG"}" to javascript which tells javascript all went
well.  In IE/Safari the file is uploaded successfully but the above
text is downloaded as a file called something like 2s6OP6WO(2).part so
control doesn't return to the javascript.  Have applied a similar
program in PHP and it works fine. Tried different mime types and tried
to trace what is going on but without progress.

Phoebe


On Feb 18, 2:33 pm, Almost George <almostgeo...@almostexciting.com>
wrote:
> On Feb 18, 5:36 am, phoebebright <phoebebright...@gmail.com> wrote:
>
> > There is something different about the way django is handling to response 
> > to php I think.
>
> I use the YUI Rich Editor in admin, and have no problems. I know
> debugging isn't as easy in IE as others, but do your best to find out
> the exact response (mostly, response headers) that's being sent to the
> browser. Also, could you clarify the above "response to PHP"
> statement? Perhaps explaining the technical details of what's going on
> would be of some help?
--~--~-~--~~~---~--~~
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: WYSIWYG Image upload challenge

2009-02-18 Thread phoebebright

Lee,

They are using this part of the app as a CMS so need to be able to put
multiple images in the text.  Given the way apps such as Joomla and
other CMSs work, this is a not unreasonable expectation.

Got hold of a PC and solved one of the problems with filebrowser - the
curse of the trailing ,

IE does not allow this in javascript, any othe browser does

x=alist(one,two,three,)

this is ok

x=alist(one,two,three)

Still a bugette to be solved, but getting there.  Would still really
like to understand why YUI will not work in IE.  There is something
different about the way django is handling to response to php I think.
(see 
http://groups.google.com/group/django-users/browse_thread/thread/6f0fad0c9ce2bffb/72712e1a83ad792a?lnk=gst=yui#72712e1a83ad792a)
but looks like filebrowser is going to be the solutions - phew!



On Feb 18, 10:13 am, Lee Braiden <fallibledra...@gmail.com> wrote:
> 2009/2/18 phoebebright <phoebebright...@gmail.com>:
>
>
>
> > I have now spend 5 solid days trying to get any WYSIWYG editor with an
> > image upload working in django with no success.  Current status:
> > This must be solveable!!!
>
> > Any suggestions very welcome at this stage.
>
> I suggest an image upload field underneath your text field.
>
> --
> Lee
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



WYSIWYG Image upload challenge

2009-02-18 Thread phoebebright

I have now spend 5 solid days trying to get any WYSIWYG editor with an
image upload working in django with no success.  Current status:

YUI - works in Firefox/Mac not in IE.  The image upload is happening
but the response is being interpretted by IE as a download so control
does not return to javascript.  I have tried every possible
combination of mime types and it works fine when called from PHP so my
conclusion is that django is doing something slightly different but it
is beyond me to solve that one.

django-filebrowser - works fine in Firefox/Mac but not in IE.  Refuses
to call the image upload javascript at all and displays and error but
does not condescend to say which script the error is in, making
debugging somewhat difficult especially as I don't have IE!

Are there any other alternatives?

If I can't get this functionality working for the two sites that are
all ready to go live but for this, I am going to have to go back to
PHP as this is an essential requirement for these sites and many
others.

This must be solveable!!!

Any suggestions very welcome at this stage.


--~--~-~--~~~---~--~~
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: Custom widget for images is deleting them

2009-02-11 Thread phoebebright

Alex,

That's the one.  And it works!

Just for once it wasn't my fault - and I can go to bed (it's after
midnight, again).

Thanks so much for that.

Have a good day/evening/morning...

Phoebe.

On Feb 12, 12:04 am, Alex Gaynor <alex.gay...@gmail.com> wrote:
> On Wed, Feb 11, 2009 at 7:02 PM, phoebebright 
> <phoebebright...@gmail.com>wrote:
>
>
>
>
>
> > It sounds like it.  I've tried to get the version 9765 as suggested
> > but I don't think I have the right syntax:
> > [r...@viv site-packages]# svn co
> >http://code.djangoproject.com/svn/django/trunk/
> > 9765
> > [r...@viv site-packages]# svn co
> >http://code.djangoproject.com/svn/django/trunk/
> > r9765 <http://code.djangoproject.com/svn/django/trunk/%0Ar9765>
> > [r...@viv site-packages]# svn checkout
> >http://code.djangoproject.com/svn/django/trunk/
> > 9765
>
> > Don't seem to do the job:
>
> > ...
> > A    9765/examples/hello/urls.py
> > A    9765/examples/views.py
> > A    9765/examples/__init__.py
> > A    9765/examples/settings.py
> > A    9765/examples/urls.py
> > A    9765/setup.cfg
> >  U   9765
> > Checked out revision 9824.
>
> > And dates are Feb 2
>
> > Any suggestions?
>
> > On Feb 11, 11:32 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
> > > On Wed, Feb 11, 2009 at 6:30 PM, phoebebright <phoebebright...@gmail.com
> > >wrote:
>
> > > > I thought I had a custom widget which would allow images to be deleted
> > > > working and was dead chuffed (http://groups.google.com/group/django-
> > > > users/browse_thread/thread/ebf646208fa8880f/c22f87e85b5d78ef?
> > > > lnk=gst=admin+image#c22f87e85b5d78ef<
> >http://groups.google.com/group/django-%0Ausers/browse_thread/thread/e...>)
> > > > but unfortunately it doesn't
> > > > work.  I have spent the whole evening trying to work out what exactly
> > > > is going on and have to admit defeat.
>
> > > > The widget adds a delete checkbox next to each image as well as
> > > > displaying it, then in the save_model() method it checks to see if
> > > > this checkbox was set and clears the field if it is.
>
> > > >  def save_model(self, request, obj, form, change):
>
> > > >            #handle delete checkbox for pics
> > > >            if request.POST.get('delete_pic1','off')=='on':
> > > >                obj.pic1=''
>
> > > > This is what happens:
> > > > 1. create a new record and add an image - OK
> > > > 2. edit the record - image is displayed - make no changes and click
> > > > save - OK
> > > > 3. edit the record again and the image is gone - NOT OK!
>
> > > > This is my thinking so far:
> > > > I wondered if I needed to set the value when assigning the widget to
> > > > the field, but as the image is displayed in step 2, I recon not.
> > > > I tried also saving the value of pic in a hidden field and modifying
> > > > save_model
>
> > > >            if request.POST.get('delete_pic2','off')=='on':
> > > >                obj.pic2=''
> > > >            else:
> > > >                obj.pic2=request.POST.get('old_pic2','')
>
> > > > But it never even gets uploaded in step 1. So I tried:
>
> > > >           try:
> > > >                p=request.FILES.get('pic1')
> > > >            except:
> > > >                if request.POST.get('delete_pic1','off')=='on':
> > > >                    obj.pic1=''
>
> > > > And this goes back to the behaviour in the original step.
>
> > > > I have tried putting in various breaks in the django code in files.py
> > > > to try and understand what is happening but my lack of debugging
> > > > skills are not helping!  The client is expecting to see this tomorrow
> > > > so despite having plagued this list today with my problems, I hope to
> > > > prevail upon you to help me one more time...
>
> > > If you are on trunk it looks like you are experiencinghttp://
> > code.djangoproject.com/ticket/10121.
>
> > > 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
>
> I'm not an svn user, but I think the sytnax is svn co -r  
>
> --
> "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: Documentation for Download?

2009-02-11 Thread phoebebright

If you downloaded using svn then it is in   trunk/docs which is at the
same level as trunk/django not inside it.


On Feb 11, 11:59 pm, Tim Johnson  wrote:
> On Wednesday 11 February 2009, Alex Gaynor wrote:
>
> > Every django tarball or svn checkout includes a docs/ dir that has the full
> > docs, you can build these into HTML, latex, pdf whatever using Sphinx.
>
>  Sorry, but I can't find a docs/dir path. Looking
> under /usr/lib/python2.5/site-packages/django
> thanks
> ti
--~--~-~--~~~---~--~~
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: Custom widget for images is deleting them

2009-02-11 Thread phoebebright

It sounds like it.  I've tried to get the version 9765 as suggested
but I don't think I have the right syntax:
[r...@viv site-packages]# svn co http://code.djangoproject.com/svn/django/trunk/
9765
[r...@viv site-packages]# svn co http://code.djangoproject.com/svn/django/trunk/
r9765
[r...@viv site-packages]# svn checkout 
http://code.djangoproject.com/svn/django/trunk/
9765

Don't seem to do the job:

...
A9765/examples/hello/urls.py
A9765/examples/views.py
A9765/examples/__init__.py
A9765/examples/settings.py
A9765/examples/urls.py
A9765/setup.cfg
 U   9765
Checked out revision 9824.

And dates are Feb 2


Any suggestions?

On Feb 11, 11:32 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
> On Wed, Feb 11, 2009 at 6:30 PM, phoebebright 
> <phoebebright...@gmail.com>wrote:
>
>
>
>
>
> > I thought I had a custom widget which would allow images to be deleted
> > working and was dead chuffed (http://groups.google.com/group/django-
> > users/browse_thread/thread/ebf646208fa8880f/c22f87e85b5d78ef?
> > lnk=gst=admin+image#c22f87e85b5d78ef<http://groups.google.com/group/django-%0Ausers/browse_thread/thread/e...>)
> > but unfortunately it doesn't
> > work.  I have spent the whole evening trying to work out what exactly
> > is going on and have to admit defeat.
>
> > The widget adds a delete checkbox next to each image as well as
> > displaying it, then in the save_model() method it checks to see if
> > this checkbox was set and clears the field if it is.
>
> >  def save_model(self, request, obj, form, change):
>
> >            #handle delete checkbox for pics
> >            if request.POST.get('delete_pic1','off')=='on':
> >                obj.pic1=''
>
> > This is what happens:
> > 1. create a new record and add an image - OK
> > 2. edit the record - image is displayed - make no changes and click
> > save - OK
> > 3. edit the record again and the image is gone - NOT OK!
>
> > This is my thinking so far:
> > I wondered if I needed to set the value when assigning the widget to
> > the field, but as the image is displayed in step 2, I recon not.
> > I tried also saving the value of pic in a hidden field and modifying
> > save_model
>
> >            if request.POST.get('delete_pic2','off')=='on':
> >                obj.pic2=''
> >            else:
> >                obj.pic2=request.POST.get('old_pic2','')
>
> > But it never even gets uploaded in step 1. So I tried:
>
> >           try:
> >                p=request.FILES.get('pic1')
> >            except:
> >                if request.POST.get('delete_pic1','off')=='on':
> >                    obj.pic1=''
>
> > And this goes back to the behaviour in the original step.
>
> > I have tried putting in various breaks in the django code in files.py
> > to try and understand what is happening but my lack of debugging
> > skills are not helping!  The client is expecting to see this tomorrow
> > so despite having plagued this list today with my problems, I hope to
> > prevail upon you to help me one more time...
>
> If you are on trunk it looks like you are 
> experiencinghttp://code.djangoproject.com/ticket/10121.
>
> 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
-~--~~~~--~~--~--~---



Custom widget for images is deleting them

2009-02-11 Thread phoebebright

I thought I had a custom widget which would allow images to be deleted
working and was dead chuffed (http://groups.google.com/group/django-
users/browse_thread/thread/ebf646208fa8880f/c22f87e85b5d78ef?
lnk=gst=admin+image#c22f87e85b5d78ef) but unfortunately it doesn't
work.  I have spent the whole evening trying to work out what exactly
is going on and have to admit defeat.

The widget adds a delete checkbox next to each image as well as
displaying it, then in the save_model() method it checks to see if
this checkbox was set and clears the field if it is.

 def save_model(self, request, obj, form, change):

#handle delete checkbox for pics
if request.POST.get('delete_pic1','off')=='on':
obj.pic1=''


This is what happens:
1. create a new record and add an image - OK
2. edit the record - image is displayed - make no changes and click
save - OK
3. edit the record again and the image is gone - NOT OK!

This is my thinking so far:
I wondered if I needed to set the value when assigning the widget to
the field, but as the image is displayed in step 2, I recon not.
I tried also saving the value of pic in a hidden field and modifying
save_model

if request.POST.get('delete_pic2','off')=='on':
obj.pic2=''
else:
obj.pic2=request.POST.get('old_pic2','')

But it never even gets uploaded in step 1. So I tried:

   try:
p=request.FILES.get('pic1')
except:
if request.POST.get('delete_pic1','off')=='on':
obj.pic1=''

And this goes back to the behaviour in the original step.

I have tried putting in various breaks in the django code in files.py
to try and understand what is happening but my lack of debugging
skills are not helping!  The client is expecting to see this tomorrow
so despite having plagued this list today with my problems, I hope to
prevail upon you to help me one more time...




--~--~-~--~~~---~--~~
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: Parent_link=True causes Cannot assign None: "Business.id" does not allow null values.

2009-02-11 Thread phoebebright

Karen,

Spot on!  Changed field name to directory and all is well.
Thanks so much.

Phoebe.


On Feb 11, 8:57 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Wed, Feb 11, 2009 at 3:19 PM, phoebebright 
> <phoebebright...@gmail.com>wrote:
>
>
>
> > Karen,
>
> > Have done a stripped down version and still getting the error so put
> > the requested code here:http://dpaste.com/119483/and
> >http://dpaste.com/119486/.
>
> > using Django version 1.1 pre-alpha,
>
> > Thanks for your interest!  Have to finish this tonight.
>
> This is just a guess, since I don't really have time to look into this
> closely at the moment, but I'd try using something other than 'id' as the
> name of your OneToOne with parent_link field=True field.
>
> Karen
>
> > Phoebe.
>
> > On Feb 11, 7:30 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> > > On Wed, Feb 11, 2009 at 1:36 PM, phoebebright <phoebebright...@gmail.com
> > >wrote:
>
> > > > I am following the instructions at the bottom of this page
>
> > > >http://docs.djangoproject.com/en/dev/topics/db/models/#inheritance-an.
> > ..
> > > > and here
> > > >http://docs.djangoproject.com/en/dev/ref/models/fields/#onetoonefield
>
> > > > I have a parent class Directory and a child classes Business, Tourism
> > > > and Community.  The child classes have a subcategory that I want to be
> > > > able to access from a listing of Directory.  My reading of the
> > > > documentation was that by defining a onetoone field with
> > > > parent_link=True I could do this, but on going into Admin and trying
> > > > to add a new entry to Business I immediately get the error Cannot
> > > > assign None: "Business.id" does not allow null values.
>
> > > > Where is my error (again..):
>
> > > I cannot recreate any error using my own models based on the snippets
> > you've
> > > provided, so it seems you've left out some key part of your config that
> > is
> > > causing what you are seeing.  Perhaps post your models.py and admin.py
> > files
> > > on someplace like dpaste?  Also please state exactly what level of Django
> > > you are using?
>
> > > 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: YUI Image Uploader - OK on Firefox/Mac but not elsewhere

2009-02-11 Thread phoebebright

You were right - all the paths were right except one.  When the upload
dialog loads it looks for /media/tinymce_2/jscripts/tiny_mce/
tiny_mce_popup.js and I had tiny_mce installed straight off media.
Phew.  All working on Mac, awaiting the news on PC.

Never got YUI working - it uploads the files ok but something about
the returning httpresponse is not being handled correctly by most
browsers.  I know it is a django problem because the I can call the
same plugin with a php script to handle the upload and it works ok.
Tried to get some info using drlog middleware to output response
codes, but for some reason it is not called in this case. May return
to this problem when I am more experienced with django...



On Feb 10, 7:10 pm, phoebebright <phoebebright...@gmail.com> wrote:
> I'm pretty sure I have all the paths correct because the TinyMCE/
> Filebrowser works ok on firefox mac, just not on any other browser.
> The only setting I changed was FILEBROWSER_URL_WWW = '/site_media/
> uploads/'.  At this stage I am trying to get the upload to happen in
> PHP as I can get that to work, but it seems silly to have to do
> that.   I will use any solution so if yours is working on multiple
> browsers, maybe I should give it another go.  But not sure where to
> start in fixing it!!!
>
> Phoebe.
>
> On Feb 10, 4:49 pm, "esatterwh...@wi.rr.com" <esatterwh...@wi.rr.com>
> wrote:
>
> > I found the TinyMCE & filebrowser insanely easy to impliment. I would
> > say 9 out of the 10 issued I had was simply a matter of defining the
> > right paths.
>
> > I also found that creating a symlink for the admin media folder and
> > calling it 'media/' solved most of the path name issues. that way you
> > can leave most of the default paths in the settings.py file and it
> > just works out of the box.
>
> > On Feb 9, 4:39 pm, phoebebright <phoebebright...@gmail.com> wrote:
>
> > > Have been trying to get a RTE plugin working that will allow upload of
> > > images.  TheYUIverion is almost there but will not play well with
> > > browsers.
>
> > > The plugin from 
> > > herehttp://allmybrain.com/2008/11/06/example-yui-image-upload-with-yui-260/
> > > I modified to get Javascript to make an asynchronous call to this
> > > function in the view:
>
> > > def uploadimage(request):
> > >         try:
> > >                 upload_full_path = settings.CONTENT_IMAGES
>
> > >                 upload = request.FILES['image']
> > >                 dest = open(os.path.join(upload_full_path, upload.name), 
> > > 'wb+')
>
> > >                 for chunk in upload.chunks():
> > >                         dest.write(chunk)
>
> > >                 dest.close()
>
> > >                 result='{status:"UPLOADED",image_url:"%s%s"}' %
> > > (settings.CONTENT_IMAGES_URL, upload.name)
>
> > >                 return_data = HttpResponse(result,mimetype='Content-Type: 
> > > text/
> > > html')
>
> > >         except Exception, e:
> > >                 return_data = HttpResponse("Error in uploading image")
>
> > >         return_data.flush()
>
> > >         return return_data
>
> > > The plugin was written for turbon gears/php and there is a tg example
> > > here:
>
> > >http://allmybrain.com/2007/10/22/yui-image-uploader-example-with-turb...
>
> > > Firefox/Mac works perfectly.  Safari downloads the image instead.  No
> > > version on PC appears to do anything, (but only have Mac for local
> > > testing.)
> > > Have tried every possible permutation of the content-type, Content-
> > > Type and text/html definitely is the way to go.  Various threads on
> > > python refer to the need to open the file for reading as rb to make
> > > sure windows knows it is binary, but not sure how to do that as the
> > > response data is already in memory.
>
> > > In desperation I have also tried to implement image upload in TinyMCE
> > > - can't get FileBrowser working on PC.  and FCKeditor no modifiable
> > > image upload that I could find.  So I am back withYUIand hoping
> > > someone can suggest something to try
>
>
--~--~-~--~~~---~--~~
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: Really dumb question re output variable for debugging

2009-02-11 Thread phoebebright

Got Pdb working (though still want to get django_extensions going) and
here is my problem again - how do I display an object.  It's fine if I
know what the attribute are, but how do I tell??

> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/fields/files.py(187)pre_save()
-> file = super(FileField, self).pre_save(model_instance, add)
(Pdb) add
False
(Pdb) self

(Pdb) self.name
'pic1'
(Pdb) model_instance

(Pdb) import pprint
(Pdb) pprint.pprint(model_instance)

(Pdb) model_instance.pic1

(Pdb)

What else is model_instance holding - I really need to know to try and
work out why my custom widget isn't working, otherwise I'm going to
have to post yet another problem to this user groups, and I'm getting
a bit emabarresed at the number of posts I'm making :~)

On Feb 11, 9:22 pm, phoebebright <phoebebright...@gmail.com> wrote:
> OK.  Installed django extentions and can see the extra commands when I
> type python manage.py help but there seems no difference in the
> traceback screen?  Have tried putting both django_extensions and just
> extensions in the INSTALLED_APPS area, and installed Werkzeug and
> watched Eric's excellant Intro.   Have I missed something?
>
> Phoebe.
>
> On Feb 11, 8:45 pm, Lee Braiden <fallibledra...@gmail.com> wrote:
>
> > 2009/2/11 Karen Tracey <kmtra...@gmail.com>:
>
> > > On Wed, Feb 11, 2009 at 3:01 PM, phoebebright <phoebebright...@gmail.com>
> > > wrote:
>
> > >> I need to see the contents of some objects that are passed as
> > >> parameters into a function.  I can stop the function (assert false)
> > >> and look at the traceback, but it doesn't tell me the contents of the
> > >> objects.  I have tried print statemnts, pickle and pprint.  I don't
> > >> want to stray into the methods of debugging as in this thread
>
> > >>http://groups.google.com/group/django-users/browse_thread/thread/7ba4...
> > >> - deadline is tight.  I just want to output the contents of an
> > >> object!
>
> > Install django_extensions (along with werkzeug), and it'll give you an
> > interactive debugger, right in your browser.  You'll then be able to
> > assert, and examine everything just by typing its name.  Technically,
> > it's debugging, but you won't be able to tell that really :)
>
>
--~--~-~--~~~---~--~~
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: Really dumb question re output variable for debugging

2009-02-11 Thread phoebebright

OK.  Installed django extentions and can see the extra commands when I
type python manage.py help but there seems no difference in the
traceback screen?  Have tried putting both django_extensions and just
extensions in the INSTALLED_APPS area, and installed Werkzeug and
watched Eric's excellant Intro.   Have I missed something?

Phoebe.

On Feb 11, 8:45 pm, Lee Braiden <fallibledra...@gmail.com> wrote:
> 2009/2/11 Karen Tracey <kmtra...@gmail.com>:
>
> > On Wed, Feb 11, 2009 at 3:01 PM, phoebebright <phoebebright...@gmail.com>
> > wrote:
>
> >> I need to see the contents of some objects that are passed as
> >> parameters into a function.  I can stop the function (assert false)
> >> and look at the traceback, but it doesn't tell me the contents of the
> >> objects.  I have tried print statemnts, pickle and pprint.  I don't
> >> want to stray into the methods of debugging as in this thread
>
> >>http://groups.google.com/group/django-users/browse_thread/thread/7ba4...
> >> - deadline is tight.  I just want to output the contents of an
> >> object!
>
> Install django_extensions (along with werkzeug), and it'll give you an
> interactive debugger, right in your browser.  You'll then be able to
> assert, and examine everything just by typing its name.  Technically,
> it's debugging, but you won't be able to tell that really :)
--~--~-~--~~~---~--~~
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: Parent_link=True causes Cannot assign None: "Business.id" does not allow null values.

2009-02-11 Thread phoebebright

Karen,

Have done a stripped down version and still getting the error so put
the requested code here: http://dpaste.com/119483/ and 
http://dpaste.com/119486/.

using Django version 1.1 pre-alpha,

Thanks for your interest!  Have to finish this tonight.

Phoebe.

On Feb 11, 7:30 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Wed, Feb 11, 2009 at 1:36 PM, phoebebright 
> <phoebebright...@gmail.com>wrote:
>
>
>
>
>
> > I am following the instructions at the bottom of this page
>
> >http://docs.djangoproject.com/en/dev/topics/db/models/#inheritance-an...
> > and here
> >http://docs.djangoproject.com/en/dev/ref/models/fields/#onetoonefield
>
> > I have a parent class Directory and a child classes Business, Tourism
> > and Community.  The child classes have a subcategory that I want to be
> > able to access from a listing of Directory.  My reading of the
> > documentation was that by defining a onetoone field with
> > parent_link=True I could do this, but on going into Admin and trying
> > to add a new entry to Business I immediately get the error Cannot
> > assign None: "Business.id" does not allow null values.
>
> > Where is my error (again..):
>
> I cannot recreate any error using my own models based on the snippets you've
> provided, so it seems you've left out some key part of your config that is
> causing what you are seeing.  Perhaps post your models.py and admin.py files
> on someplace like dpaste?  Also please state exactly what level of Django
> you are using?
>
> 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
-~--~~~~--~~--~--~---



Really dumb question re output variable for debugging

2009-02-11 Thread phoebebright

I need to see the contents of some objects that are passed as
parameters into a function.  I can stop the function (assert false)
and look at the traceback, but it doesn't tell me the contents of the
objects.  I have tried print statemnts, pickle and pprint.  I don't
want to stray into the methods of debugging as in this thread
http://groups.google.com/group/django-users/browse_thread/thread/7ba442f5f5b1f04f/541eab57736537c5?hl=en=gst=debugging#541eab57736537c5
- deadline is tight.  I just want to output the contents of an
object!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Parent_link=True causes Cannot assign None: "Business.id" does not allow null values.

2009-02-11 Thread phoebebright

I am following the instructions at the bottom of this page
http://docs.djangoproject.com/en/dev/topics/db/models/#inheritance-and-reverse-relations
and here http://docs.djangoproject.com/en/dev/ref/models/fields/#onetoonefield

I have a parent class Directory and a child classes Business, Tourism
and Community.  The child classes have a subcategory that I want to be
able to access from a listing of Directory.  My reading of the
documentation was that by defining a onetoone field with
parent_link=True I could do this, but on going into Admin and trying
to add a new entry to Business I immediately get the error Cannot
assign None: "Business.id" does not allow null values.

Where is my error (again..):

class Directory(models.Model):
name = models.CharField(max_length=60)
...

class Business(Directory):
id = models.OneToOneField(Directory, parent_link=True,
related_name="entries")
cat = models.ForeignKey(Subcategory, limit_choices_to =
{'category__exact': 2})


And the SQL table it created, which looks correct to me:

CREATE TABLE `town_business` (
  `id_id` int(11) NOT NULL,
  `cat_id` int(11) NOT NULL,
  PRIMARY KEY  (`id_id`),
  KEY `town_business_cat_id` (`cat_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Or am I trying to be too clever all together?  This is the query that
does everything except pull in the cat from the subclass.

 entries = Directory.objects.filter(is_live=True).select_related
().distinct()





--~--~-~--~~~---~--~~
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: YUI Image Uploader - OK on Firefox/Mac but not elsewhere

2009-02-10 Thread phoebebright

I'm pretty sure I have all the paths correct because the TinyMCE/
Filebrowser works ok on firefox mac, just not on any other browser.
The only setting I changed was FILEBROWSER_URL_WWW = '/site_media/
uploads/'.  At this stage I am trying to get the upload to happen in
PHP as I can get that to work, but it seems silly to have to do
that.   I will use any solution so if yours is working on multiple
browsers, maybe I should give it another go.  But not sure where to
start in fixing it!!!

Phoebe.

On Feb 10, 4:49 pm, "esatterwh...@wi.rr.com" <esatterwh...@wi.rr.com>
wrote:
> I found the TinyMCE & filebrowser insanely easy to impliment. I would
> say 9 out of the 10 issued I had was simply a matter of defining the
> right paths.
>
> I also found that creating a symlink for the admin media folder and
> calling it 'media/' solved most of the path name issues. that way you
> can leave most of the default paths in the settings.py file and it
> just works out of the box.
>
> On Feb 9, 4:39 pm, phoebebright <phoebebright...@gmail.com> wrote:
>
> > Have been trying to get a RTE plugin working that will allow upload of
> > images.  The YUI verion is almost there but will not play well with
> > browsers.
>
> > The plugin from 
> > herehttp://allmybrain.com/2008/11/06/example-yui-image-upload-with-yui-260/
> > I modified to get Javascript to make an asynchronous call to this
> > function in the view:
>
> > def uploadimage(request):
> >         try:
> >                 upload_full_path = settings.CONTENT_IMAGES
>
> >                 upload = request.FILES['image']
> >                 dest = open(os.path.join(upload_full_path, upload.name), 
> > 'wb+')
>
> >                 for chunk in upload.chunks():
> >                         dest.write(chunk)
>
> >                 dest.close()
>
> >                 result='{status:"UPLOADED",image_url:"%s%s"}' %
> > (settings.CONTENT_IMAGES_URL, upload.name)
>
> >                 return_data = HttpResponse(result,mimetype='Content-Type: 
> > text/
> > html')
>
> >         except Exception, e:
> >                 return_data = HttpResponse("Error in uploading image")
>
> >         return_data.flush()
>
> >         return return_data
>
> > The plugin was written for turbon gears/php and there is a tg example
> > here:
>
> >http://allmybrain.com/2007/10/22/yui-image-uploader-example-with-turb...
>
> > Firefox/Mac works perfectly.  Safari downloads the image instead.  No
> > version on PC appears to do anything, (but only have Mac for local
> > testing.)
> > Have tried every possible permutation of the content-type, Content-
> > Type and text/html definitely is the way to go.  Various threads on
> > python refer to the need to open the file for reading as rb to make
> > sure windows knows it is binary, but not sure how to do that as the
> > response data is already in memory.
>
> > In desperation I have also tried to implement image upload in TinyMCE
> > - can't get FileBrowser working on PC.  and FCKeditor no modifiable
> > image upload that I could find.  So I am back with YUI and hoping
> > someone can suggest something to try
>
>
--~--~-~--~~~---~--~~
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: Subclass conflict with admin widgets

2009-02-10 Thread phoebebright

That makes sense.  I'll just create a different admin for each model.

Thanks.

On Feb 10, 4:36 am, Karen Tracey <kmtra...@gmail.com> wrote:
> On Mon, Feb 9, 2009 at 5:18 PM, phoebebright <phoebebright...@gmail.com>wrote:
>
>
>
>
>
> > Yes I see that, it's just if I don't put the custom form in it works
> > fine:
>
> > class DirectoryAdmin(admin.ModelAdmin):
>
> >    fieldsets = [
> >        (None,   {'fields': ['cat','name','is_live']}),    <
> > CAT FIELD STILL HERE AN OK
> >         ('Contact', {'fields':
> > ['phone','mobile','fax','email','web','address']}),
> >        ('Details', {'fields':
> > ['description','pic1','pic2','pic3','pic4']}),
> >    ]
>
> > admin.site.register(Business,DirectoryAdmin)
>
> I've not looked at the admin code here to determine when it does what,
> exactly, but just looking at the defs I can see what I expect is going on,
> and it makes sense,  For this case, your DirectoryAdmin isn't tied a a
> particular model until the admin.site.register, where you tie it to the
> Business model, which has the cat field, so all in OK.  In your other case,
> you had a custom form with a class Meta specifying model=Directory, which
> does not have a cat field.  So your custom form does not have the field you
> are trying to list in fieldsets.
>
> There is no error in this case here because you don't do anything to tie
> DirectoryAdmin to the Directory model instead of the Business model, whereas
> in the error case you tie DirectoryAdmin to the Directory model, which does
> not have the cat field, so you get an error.
>
> 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
-~--~~~~--~~--~--~---



YUI Image Uploader - OK on Firefox/Mac but not elsewhere

2009-02-09 Thread phoebebright

Have been trying to get a RTE plugin working that will allow upload of
images.  The YUI verion is almost there but will not play well with
browsers.

The plugin from here 
http://allmybrain.com/2008/11/06/example-yui-image-upload-with-yui-260/
I modified to get Javascript to make an asynchronous call to this
function in the view:

def uploadimage(request):
try:
upload_full_path = settings.CONTENT_IMAGES

upload = request.FILES['image']
dest = open(os.path.join(upload_full_path, upload.name), 'wb+')

for chunk in upload.chunks():
dest.write(chunk)

dest.close()

result='{status:"UPLOADED",image_url:"%s%s"}' %
(settings.CONTENT_IMAGES_URL, upload.name)

return_data = HttpResponse(result,mimetype='Content-Type: text/
html')

except Exception, e:
return_data = HttpResponse("Error in uploading image")

return_data.flush()

return return_data

The plugin was written for turbon gears/php and there is a tg example
here:

http://allmybrain.com/2007/10/22/yui-image-uploader-example-with-turbogears/

Firefox/Mac works perfectly.  Safari downloads the image instead.  No
version on PC appears to do anything, (but only have Mac for local
testing.)
Have tried every possible permutation of the content-type, Content-
Type and text/html definitely is the way to go.  Various threads on
python refer to the need to open the file for reading as rb to make
sure windows knows it is binary, but not sure how to do that as the
response data is already in memory.

In desperation I have also tried to implement image upload in TinyMCE
- can't get FileBrowser working on PC.  and FCKeditor no modifiable
image upload that I could find.  So I am back with YUI and hoping
someone can suggest something to try
--~--~-~--~~~---~--~~
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: Subclass conflict with admin widgets

2009-02-09 Thread phoebebright

Yes I see that, it's just if I don't put the custom form in it works
fine:

class DirectoryAdmin(admin.ModelAdmin):


fieldsets = [
(None,   {'fields': ['cat','name','is_live']}),<
CAT FIELD STILL HERE AN OK
('Contact', {'fields':
['phone','mobile','fax','email','web','address']}),
('Details', {'fields':
['description','pic1','pic2','pic3','pic4']}),
]

admin.site.register(Business,DirectoryAdmin)

 It suggest to me there is something in the admin code which normally
allows for this 'error' to pass.  It's not a big deal, I just wondered
if it was somthing django should allow for and the design of the two
examples is inherantly the same.


On Feb 9, 8:52 pm, Daniel Roseman <roseman.dan...@googlemail.com>
wrote:
> On Feb 9, 7:28 pm, phoebebright <phoebebright...@gmail.com> wrote:
>
>
>
> > I have implemented this solution successfully with a standard model,
> > but when I try to use it on one which is subclassed I get an error
> > because it is trying to validate the model before it knows about the
> > subclass.  I can work around this by defining an Admin class for each
> > of the subclasses, but it seems to me this should work?
>
> > Model.py
>
> > class Directory(models.Model):
> >     name = models.CharField(max_length=60)
> >     pic1 = models.ImageField(upload_to='pics', blank=True,
> > null=True)
>
> > class Business(Directory):
> >     cat = models.ForeignKey(Subcategory)
>
> > Admin.py
>
> > AdminImageWidget defined 
>
> > class DirectoryAdminForm(forms.ModelForm):
> >     pic1 = forms.ImageField(widget=AdminImageWidget())
>
> >     class Meta:
> >         model = Directory
>
> > class DirectoryAdmin(admin.ModelAdmin):
>
> >     form = DirectoryAdminForm
>
> >     fieldsets = [
> >         (None,   {'fields': ['cat','name','is_live']}),    <
> > CAT FIELD IS PART OF BUSINESS NOT DIRECTORY SO CAUSES ERROR
> >         ('Contact', {'fields':
> > ['phone','mobile','fax','email','web','address']}),
> >         ('Details', {'fields':
> > ['description','pic1','pic2','pic3','pic4']}),
> >     ]
>
> > admin.site.register(Business,DirectoryAdmin)
>
> > Error
>
> > ImproperlyConfigured at /admin/town/business/14/
>
> > 'DirectoryAdmin.fieldsets[2][1]['fields']' refers to field 'cat' that
> > is missing from the form.
>
> The error message tells you what is going on. Your form definition has
> model=Directory in its Meta class, so it only contains fields from the
> Directory model. If you want it to contain the fields from the
> subclassed Business model, you'll need to change that Meta
> declaration.
> --
> 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
-~--~~~~--~~--~--~---



Admin Image Handling - ability to display thumb and delete an image - one solution

2009-02-09 Thread phoebebright

In case this helps anyone, here is one implementation  I have 4
pictures attached to each record but would work the same if only one.

Uses sorl-thumbnails and based on snippet here: 
http://www.djangosnippets.org/snippets/934/
written by baumer1122

In models.py
-
used standard models.ImageField


class Car(models.Model):
short_desc = models.CharField(max_length=40)
...
pic1 = models.ImageField("Picture 1", blank=True,
upload_to='pics')
pic2 = models.ImageField("Picture 2", blank=True,
upload_to='pics')
pic3 = models.ImageField("Picture 3", blank=True,
upload_to='pics')
pic4 = models.ImageField("Picture 4", blank=True,
upload_to='pics')

In admin.py
---
from django.contrib.admin.widgets import AdminFileWidget
from django.utils.translation import ugettext as _
from django.utils.safestring import mark_safe
from django.conf import settings
from PIL import Image
import os

from sorl.thumbnail.main import DjangoThumbnail

try:
from sorl.thumbnail.main import DjangoThumbnail
def thumbnail(image_path):
t = DjangoThumbnail(relative_source=image_path, requested_size=
(200,200))
return u'' % (t.absolute_url,
image_path)
except ImportError:
def thumbnail(image_path):
absolute_url = os.path.join(settings.MEDIA_ROOT, image_path)
return u'' % (absolute_url,
image_path)

class AdminImageWidget(AdminFileWidget):
"""
A FileField Widget that displays an image instead of a file path
if the current file is an image.
"""
def render(self, name, value, attrs=None):
output = []
file_name = str(value)
if file_name:
file_path = '%s%s' % (settings.MEDIA_URL, file_name)
try:# is image
Image.open(os.path.join(settings.MEDIA_ROOT,
file_name))
output.append('%s %s%s%s' % \
(file_path, thumbnail(file_name), file_path,
file_name,_('Delete:'), name, _('Change:')))
except IOError: # not image
output.append('%s %s
%s ' % \
(_('Currently:'), file_path, file_name, _
('Change:')))

output.append(super(AdminFileWidget, self).render(name, value,
attrs))
return mark_safe(u''.join(output))


class CarAdminForm(forms.ModelForm):
pic1 = forms.ImageField(widget=AdminImageWidget())
pic2 = forms.ImageField(widget=AdminImageWidget())
pic3 = forms.ImageField(widget=AdminImageWidget())
pic4 = forms.ImageField(widget=AdminImageWidget())

class Meta:
model = Car



class CarAdmin(admin.ModelAdmin):

form = CarAdminForm

def save_model(self, request, obj, form, change):

#handle delete checkbox for pics
if request.POST.get('delete_pic1','off')=='on':
obj.pic1=''

if request.POST.get('delete_pic2','off')=='on':
obj.pic2=''

if request.POST.get('delete_pic3','off')=='on':
obj.pic3=''

if request.POST.get('delete_pic4','off')=='on':
obj.pic4=''

obj.save()



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Subclass conflict with admin widgets

2009-02-09 Thread phoebebright

I have implemented this solution successfully with a standard model,
but when I try to use it on one which is subclassed I get an error
because it is trying to validate the model before it knows about the
subclass.  I can work around this by defining an Admin class for each
of the subclasses, but it seems to me this should work?

Model.py

class Directory(models.Model):
name = models.CharField(max_length=60)
pic1 = models.ImageField(upload_to='pics', blank=True,
null=True)

class Business(Directory):
cat = models.ForeignKey(Subcategory)


Admin.py

AdminImageWidget defined 

class DirectoryAdminForm(forms.ModelForm):
pic1 = forms.ImageField(widget=AdminImageWidget())

class Meta:
model = Directory

class DirectoryAdmin(admin.ModelAdmin):

form = DirectoryAdminForm

fieldsets = [
(None,   {'fields': ['cat','name','is_live']}),<
CAT FIELD IS PART OF BUSINESS NOT DIRECTORY SO CAUSES ERROR
('Contact', {'fields':
['phone','mobile','fax','email','web','address']}),
('Details', {'fields':
['description','pic1','pic2','pic3','pic4']}),
]

admin.site.register(Business,DirectoryAdmin)


Error

ImproperlyConfigured at /admin/town/business/14/

'DirectoryAdmin.fieldsets[2][1]['fields']' refers to field 'cat' that
is missing from the form.

Request Method: POST
Request URL:http://dunmanway.pighaswings.com/admin/town/business/14/
Exception Type: ImproperlyConfigured
Exception Value:

'DirectoryAdmin.fieldsets[2][1]['fields']' refers to field 'cat' that
is missing from the form.

Exception Location: /usr/lib/python2.4/site-packages/django/contrib/
admin/validation.py in check_formfield, line 255



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Changing Image in admin deletes the rest - expected behaviour?

2009-02-09 Thread phoebebright

Model:

class Car(models.Model):
   ... lots of fields ...
pic1 = models.ImageField(blank=True, upload_to='pics')
pic2 = models.ImageField(blank=True, upload_to='pics')
pic3 = models.ImageField(blank=True, upload_to='pics')
pic4 = models.ImageField(blank=True, upload_to='pics')


In admin, if I change the content of one pic it blanks the rest.  Is
this expected behaviour?

Be great to add a bit more file handling to the admin side.  The
ability to delete a pic for example.  When I get more skills I will
try writing a custom field class for where there is only one file/
image per database entry and in this case it will handle automatic
deletion of files when the record is deleted or changed.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Subclass/Inline Problem - should I be able to do this?

2009-02-06 Thread phoebebright

Here is my model:

class Directory(models.Model):
name = models.CharField(max_length=60)

class Business(Directory):
anyfield = models.CharField(max_length=60)

class Gallery(models.Model):
directory = models.ForeignKey(Directory),
pic =  models.ImageField(upload_to='pics')


This is admin.py

class Galleries(admin.TabularInline):
model = Gallery

class DirectoryAdmin(admin.ModelAdmin):

inlines = [
Galleries,
]

admin.site.register(Business,DirectoryAdmin)


This is the error I get in admin.

Request Method: GET
Request URL:http://127.0.0.1:8000/admin/town/business/add/
Exception Type: Exception
Exception Value:

 has no ForeignKey to 

If I take out the inlines bit in admin.py and just have

admin.site.register(Business)
admin.site.register(Gallery)

Then it works as expected.




--~--~-~--~~~---~--~~
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: Can I control contents of SELECT in queryset?

2009-02-02 Thread phoebebright

After replicating you test and it still failing and various other
experiments I downloaded the latest django trunk and it works fine!
Always check the version first Phoebe!

Sorry for the run around.

For the record here are the two queries - correct one first, the
difference is in the SELECT part of subquery, SELECT U1.`cat_id`
instead of SELECT U0.`id`

SELECT `town_subcategory`.`name` FROM `town_subcategory` WHERE NOT
(`town_subcategory`.`id` IN (SELECT U0.`id` FROM `town_subcategory`
U0 LEFT OUTER JOIN `town_business` U1 ON (U0.`id` = U1.`cat_id`) WHERE
U1.`directory_ptr_id` IS NULL))

SELECT `town_subcategory`.`name` FROM `town_subcategory` WHERE NOT
(`town_subcategory`.`id` IN (SELECT U1.`cat_id` FROM
`town_subcategory` U0 LEFT OUTER JOIN `town_business` U1 ON (U0.`id` =
U1.`cat_id`) WHERE U1.`directory_ptr_id` IS NULL))



On Jan 31, 1:50 am, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:
> On Fri, 2009-01-30 at 07:46 -0800, phoebebright wrote:
> > Using your suggestion returns no values:
>
> Then there is something else going on in your code that is important and
> you haven't mentioned yet.
>
> If I use exactly the models you give:
>
>
>
> > class Category(models.Model):
> >     name = models.CharField(max_length=12, unique=True)
> >     description = models.TextField()
>
> > class Subcategory(models.Model):
> >     category = models.ForeignKey(Category)
> >     name =  models.CharField(max_length=30, unique=True)
>
> > class Directory(models.Model):
> >     name = models.CharField(max_length=60)
> >     phone = models.CharField(max_length=15)
>
> > class Business(Directory):
> >     cat = models.ForeignKey(Subcategory, limit_choices_to =
> > {'category__exact': 2})
>
> And I create a couple of categories, a few subcategories and a couple of
> businesses linked to some (but not all) of the subcategories, then the
> queryset I gave:
>
>         Subcategory.objects.values('name').exclude(business=None)
>
> returns exactly the right information (a non-empty collection of the
> subcategories related to businesses).
>
> To work out what is different in your situation, I suggest you start
> from that point, too. Copy and paste exactly what is above, create a few
> objects and try the queryset. Make sure you get back results (or we have
> to work out why you don't). Then work out what is different between that
> simpler example and your real code.
>
> For reference, the SQL query that is being generated for the above
> queryset is this:
>
> In [5]:
> models.Subcategory.objects.values('name').exclude(business=None).query.as_sql()
>
> Out[5]:
> ('SELECT`phoebe_subcategory`.`name` FROM `phoebe_subcategory` WHERE NOT
> (`phoebe_subcategory`.`id` IN (SELECTU0.`id` FROM `phoebe_subcategory`
> U0 LEFT OUTER JOIN `phoebe_business` U1 ON (U0.`id` = U1.`cat_id`) WHERE
> U1.`directory_ptr_id` IS NULL))',
>  ())
>
> (I happen to be using MySQL there, so the quoting of names will vary
> slightly on other databases, but it's the same query in all cases).
>
> 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: Can I control contents of SELECT in queryset?

2009-01-30 Thread phoebebright

Using your suggestion returns no values:

In [9]: Subcategory.objects.values('name').exclude(business=None)
Out[9]: []

And there are subcategories:

In [10]: Subcategory.objects.values('name')
Out[10]: [{'name': u'Agricultural'}, {'name': u'Auctioneers & Estate
Agents'}, {'name': u'Construction & Maintenance'}, {'name': u'Dining &
Bars'}, {'name': u'Education & Childcare'}, {'name':
u'Entertainment'}, {'name': u'Financial & Business Services'},
{'name': u'Financial Banking  '}, {'name': u'Health & Beauty'},
{'name': u'Home & Garden'}, {'name': u'Hospitality'}, {'name':
u'Legal'}, {'name': u'Leisure'}, {'name': u'Manufacturing'}, {'name':
u'Miscellaneous'}, {'name': u'Motoring & Repairs'}, {'name':
u'Services'}, {'name': u'Shopping/Retail '}, {'name': u'Transport &
Logistics'}, {'name': u'Education '}, {'name': u'Transport'}, {'name':
u'Horse Riding'}, {'name': u'Walking'}]


And there are business objects with subcategories (naming here is
confusing!)

Business.objects.values('cat__name')
Out[7]: [{'cat__name': u'Agricultural'}, {'cat__name':
u'Agricultural'}, {'cat__name': u'Agricultural'}, {'cat__name':
u'Agricultural'}, {'cat__name': u'Agricultural'}, {'cat__name':
u'Agricultural'}, {'cat__name': u'Legal'}, {'cat__name': u'Shopping/
Retail '}, {'cat__name': u'Financial Banking  '}, {'cat__name':
u'Shopping/Retail '}, {'cat__name': u'Agricultural'}]

Also tried:
Subcategory.objects.values('name').exclude(directory=None)
FieldError: Cannot resolve keyword 'directory' into field. Choices
are: business, category, community, id, name, tourism



The problem could be that I have an additional level in that Business
is subcalssed to Directory like this:


class Category(models.Model):
name = models.CharField(max_length=12, unique=True)
description = models.TextField()


class Subcategory(models.Model):
category = models.ForeignKey(Category)
name =  models.CharField(max_length=30, unique=True)


class Directory(models.Model):
name = models.CharField(max_length=60)
phone = models.CharField(max_length=15)
...

class Business(Directory):
cat = models.ForeignKey(Subcategory, limit_choices_to =
{'category__exact': 2})

Any help much appreciated.  This is my second website in Django and
starting to become slightly competant, with much support from this
users group.  Thanks.

Phoebe.


On Jan 30, 2:23 am, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:
> On Thu, 2009-01-29 at 06:44 -0800, phoebebright wrote:
> > I want a distinct list of all the 'cat__names' that exist in
> > Subcategory and have at least one entry in Business (Business is a
> > subclass of model Directory which might be the problem)
>
> > dir_query = Business.objects.all().select_related().distinct()
> > ...
> > subcats = dir_query.values('cat__name','cat').select_related().distinct
> > ()
>
> > But the SQL this generates has an additional field in theSELECT
> > statement which means the DISTINCT does not have the effect I want and
> > selects all entries.
>
> >SELECTDISTINCT `town_subcategory`.`name`, `town_business`.`cat_id`,
> > `town_directory`.`name`
> > FROM `town_business`
> > INNER JOIN `town_subcategory` ON (`town_business`.`cat_id` =
> > `town_subcategory`.`id`)
> > INNER JOIN `town_directory` ON (`town_business`.`directory_ptr_id` =
> > `town_directory`.`id`)
> > ORDER BY `town_directory`.`name` ASC
>
> > Is there some way of forcing the fields in theselectstatement
> > without having to write the whole SQL in raw format?  Or another way
> > of writing the query?
>
> Even if you could do what you wanted here, it wouldn't solve your
> problem. You're implicitly using theselectfields and the inner join to
> enforce the "a name exists" constraint. Django won't just add an
> arbitrary table in via an extra inner join if it's not required.
>
> There's a better solution to your problem, though. It's a little hard to
> tell what the exact queryset will look like, since I don't understand
> your models entirely, but this should be close. Firstly, you want
> subcategory names, so that's the model to filter on. the constraint
> "must have at least one business" is a filter on the business related
> attribute being not-None:
>
>         SubCategory.objects.values('name').exclude(business=None)
>
> 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: Custom Template Tag - Passing variable for use in tag processing

2009-01-29 Thread phoebebright

This is the final code which works in case it helps anyone else.
Thanks again.

In the template:

{% page_links category %}



In templatetags file

@register.tag(name="page_links")
def get_page_links(parser,token):

tag_name, category = token.contents.split()

return PageLink(category)


class PageLink(template.Node):

def __init__(self, category):

self.category = template.Variable(category)

def render(self, context):
cat = self.category.resolve(context)

if cat=='business':
pages=BusinessPage.objects.filter
(is_live=True).select_related().order_by('order')
elif cat=='community':
pages=CommunityPage.objects.filter
(is_live=True).select_related().order_by('order')
elif cat=='tourism':
pages=TourismPage.objects.filter
(is_live=True).select_related().order_by('order')

else:
pages = False


context['pages'] = pages

return ''



On Jan 29, 3:22 pm, phoebebright <phoebebright...@gmail.com> wrote:
> You understood perfectly.  It was just another case of my not
> understanding the documentation.  Your explanation makes perfect
> sense.
>
> Many thanks.
>
> On Jan 27, 6:45 pm, Eric Abrahamsen <gir...@gmail.com> wrote:
>
> > On Jan 28, 2009, at 1:52 AM, phoebebright wrote:
>
> > > I have duplicated as best I can the processing for handling variables
> > > incustomtemplatetagsmentioned in an earlier post but it's not
> > > working for me as I need the value of the variable before I parse it.
> > > Is there another way of making the variable available?
>
> > > The tag is being called from the tempalte with:
>
> > > {% page_links "category"  %}
>
> > > Where category is being passed into thetemplatefrom a view.  (also
> > > tried "{{category}}" and {{category}} and category)
>
> > > I want to use the value of category to determine which list of pages
> > > to return.
>
> > > I KNOW THIS DOESN"T WORK:
>
> > > @register.tag(name="page_links")
> > > def get_page_links(parser,token):
> > >    tag_name, cat = token.contents.split()
> > >    return PageLink(cat[1:-1])
>
> > > class PageLink(template.Node):
>
> > >    def __init__(self, cat):
>
> > >        cat=template.Variable(cat)
> > >        print cat   <-  outputs category
> > >        if cat=='business':
> > >            pages=BusinessPage.objects.filter
> > > (is_live=True).select_related().order_by('order')
> > >        elif cat=='community':
> > >            pages=CommunityPage.objects.filter
> > > (is_live=True).select_related().order_by('order')
> > >        elif cat=='tourism':
> > >            pages=TourismPage.objects.filter
> > > (is_live=True).select_related().order_by('order')
>
> > >        else:
> > >            pages = False
>
> > >            self.pages = pages
>
> > >    def render(self, context):
> > >        context['pages'] = self.pages
>
> > >        return ''
>
> > I might be missing something you're trying to do here, but the usual  
> > method for resolving a variable in acustomtemplatetag is to first  
> > put it into the tag (without quotes) like so:
> > {% page_links category %}
>
> > Then attach that to your PageLink node in its __init__ method as a  
> > Variable:
> > self.cat =template.Variable(cat)
>
> > Then inside the render method first resolve it:
> > category = self.cat.resolve(context)
>
> > and then check the value of category against your various models. That  
> > all has to be done in render, not __init__, because context is only  
> > available in render.
>
> > This is all straight out of the 
> > docs:http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#pass...
>
> > Apologies in advance if I've misunderstood what you're trying to do...
>
> > Eric
>
> > > This code works fine as long as I call it like this:
>
> > > {% page_links "business" %}
>
> > > @register.tag(name="page_links")
> > > def get_page_links(parser,token):
>
> > >        tag_name, cat = token.contents.split()
> > >        cat = cat[1:-1]
>
> > >        if cat=='business':
> > >            pages=BusinessPage.objects.filter
> > > (is_live=True).select_related().order_by('order')
> > >        elif cat=='community':
> > >            pages=CommunityPage.objects.filter
> > > (is_live=True).select_related().orde

Re: Can I control contents of SELECT in queryset?

2009-01-29 Thread phoebebright

That's an interesting post but I havn't managed to get it to solve my
problem because I'm looking for a list of all categories and that
method using FOO_set only seems to work on a single object (get).

Also tried the raw sql method but I get an SQL error

(1064, "You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near ''business' td, town_subcategory sc WHERE td.cat_id = sc.id' at
line 1")

Even though if I run the sql manually it is fine.

from django.db import connection
cursor = connection.cursor()
cursor.execute("SELECT DISTINCT sc.name, sc.id FROM  town_%s td,
town_subcategory sc WHERE td.cat_id = sc.id", [for_cat])
subcats = cursor.fetchall()

Any further thoughts most welcome!

On Jan 29, 3:48 pm, Almost George <almostgeo...@almostexciting.com>
wrote:
> On Jan 29, 8:44 am, phoebebright <phoebebright...@gmail.com> wrote:
>
>
>
> > I want a distinct list of all the 'cat__names' that exist in
> > Subcategory and have at least one entry in Business (Business is a
> > subclass of model Directory which might be the problem)
>
> > dir_query = Business.objects.all().select_related().distinct()
> > ...
> > subcats = dir_query.values('cat__name','cat').select_related().distinct
> > ()
>
> > But the SQL this generates has an additional field in theSELECT
> > statement which means the DISTINCT does not have the effect I want and
> > selects all entries.
>
> >SELECTDISTINCT `town_subcategory`.`name`, `town_business`.`cat_id`,
> > `town_directory`.`name`
> > FROM `town_business`
> > INNER JOIN `town_subcategory` ON (`town_business`.`cat_id` =
> > `town_subcategory`.`id`)
> > INNER JOIN `town_directory` ON (`town_business`.`directory_ptr_id` =
> > `town_directory`.`id`)
> > ORDER BY `town_directory`.`name` ASC
>
> > Is there some way of forcing the fields in theselectstatement
> > without having to write the whole SQL in raw format?  Or another way
> > of writing the query?
>
> Have you tried any of the methods listed in this 
> article?http://thisweekindjango.com/articles/2007/dec/21/retrieving-selective...
> ( Retrieving Selective Fields with Django )
--~--~-~--~~~---~--~~
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: Custom Template Tag - Passing variable for use in tag processing

2009-01-29 Thread phoebebright

You understood perfectly.  It was just another case of my not
understanding the documentation.  Your explanation makes perfect
sense.

Many thanks.

On Jan 27, 6:45 pm, Eric Abrahamsen <gir...@gmail.com> wrote:
> On Jan 28, 2009, at 1:52 AM, phoebebright wrote:
>
>
>
>
>
> > I have duplicated as best I can the processing for handling variables
> > incustomtemplatetagsmentioned in an earlier post but it's not
> > working for me as I need the value of the variable before I parse it.
> > Is there another way of making the variable available?
>
> > The tag is being called from the tempalte with:
>
> > {% page_links "category"  %}
>
> > Where category is being passed into thetemplatefrom a view.  (also
> > tried "{{category}}" and {{category}} and category)
>
> > I want to use the value of category to determine which list of pages
> > to return.
>
> > I KNOW THIS DOESN"T WORK:
>
> > @register.tag(name="page_links")
> > def get_page_links(parser,token):
> >    tag_name, cat = token.contents.split()
> >    return PageLink(cat[1:-1])
>
> > class PageLink(template.Node):
>
> >    def __init__(self, cat):
>
> >        cat=template.Variable(cat)
> >        print cat   <-  outputs category
> >        if cat=='business':
> >            pages=BusinessPage.objects.filter
> > (is_live=True).select_related().order_by('order')
> >        elif cat=='community':
> >            pages=CommunityPage.objects.filter
> > (is_live=True).select_related().order_by('order')
> >        elif cat=='tourism':
> >            pages=TourismPage.objects.filter
> > (is_live=True).select_related().order_by('order')
>
> >        else:
> >            pages = False
>
> >            self.pages = pages
>
> >    def render(self, context):
> >        context['pages'] = self.pages
>
> >        return ''
>
> I might be missing something you're trying to do here, but the usual  
> method for resolving a variable in acustomtemplatetag is to first  
> put it into the tag (without quotes) like so:
> {% page_links category %}
>
> Then attach that to your PageLink node in its __init__ method as a  
> Variable:
> self.cat =template.Variable(cat)
>
> Then inside the render method first resolve it:
> category = self.cat.resolve(context)
>
> and then check the value of category against your various models. That  
> all has to be done in render, not __init__, because context is only  
> available in render.
>
> This is all straight out of the 
> docs:http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#pass...
>
> Apologies in advance if I've misunderstood what you're trying to do...
>
> Eric
>
>
>
> > This code works fine as long as I call it like this:
>
> > {% page_links "business" %}
>
> > @register.tag(name="page_links")
> > def get_page_links(parser,token):
>
> >        tag_name, cat = token.contents.split()
> >        cat = cat[1:-1]
>
> >        if cat=='business':
> >            pages=BusinessPage.objects.filter
> > (is_live=True).select_related().order_by('order')
> >        elif cat=='community':
> >            pages=CommunityPage.objects.filter
> > (is_live=True).select_related().order_by('order')
> >        elif cat=='tourism':
> >            pages=TourismPage.objects.filter
> > (is_live=True).select_related().order_by('order')
> >        else:
> >            pages = False
>
> >        return PageLink(pages)
>
> > class PageLink(template.Node):
>
> >    def __init__(self, pages):
> >        self.pages = pages
>
> >    def render(self, context):
> >        context['pages'] = self.pages
>
> >        return ''
>
>
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Can I control contents of SELECT in queryset?

2009-01-29 Thread phoebebright

I want a distinct list of all the 'cat__names' that exist in
Subcategory and have at least one entry in Business (Business is a
subclass of model Directory which might be the problem)

dir_query = Business.objects.all().select_related().distinct()
...
subcats = dir_query.values('cat__name','cat').select_related().distinct
()

But the SQL this generates has an additional field in the SELECT
statement which means the DISTINCT does not have the effect I want and
selects all entries.

SELECT DISTINCT `town_subcategory`.`name`, `town_business`.`cat_id`,
`town_directory`.`name`
FROM `town_business`
INNER JOIN `town_subcategory` ON (`town_business`.`cat_id` =
`town_subcategory`.`id`)
INNER JOIN `town_directory` ON (`town_business`.`directory_ptr_id` =
`town_directory`.`id`)
ORDER BY `town_directory`.`name` ASC


Is there some way of forcing the fields in the select statement
without having to write the whole SQL in raw format?  Or another way
of writing the query?
--~--~-~--~~~---~--~~
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 imagefield at development server

2009-01-27 Thread phoebebright

You might also check,
You have DEBUG = True in settings.py
And have permissions set on the photo directory
And have something in urls.py file to point to the photo directory

On Jan 27, 1:58 pm, Akhmat Safrudin  wrote:
> dear list,
> i am a noob,
> i just starting a project, then create app and add some models,
> in the model there is an ImageField,
> at the admin area i can't insert record, the browser status is "waiting for 
> localhost"
> is django development server can upload file/image ?
> i have completely read model documentation and django managing file but 
> didn't get it solved.
>
> my models and settings look like this :
>
> class person(models.Model):
>     name = models.CharField(max_length=30)
>     address = models.CharField(max_length=50)
>     photo = models.ImageField(upload_to='photo')
>
> settings.py :
> MEDIA_ROOT = '/home/somat/project/media/'
>
> MEDIA_URL = '/media/'
>
> thank's
>
> somat.
>
> --
> Stay Hungry Stay Foolishhttp://somat.wordpress.com
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Custom Template Tag - Passing variable for use in tag processing

2009-01-27 Thread phoebebright

I have duplicated as best I can the processing for handling variables
in custom template tags mentioned in an earlier post but it's not
working for me as I need the value of the variable before I parse it.
Is there another way of making the variable available?

The tag is being called from the tempalte with:

{% page_links "category"  %}

Where category is being passed into the template from a view.  (also
tried "{{category}}" and {{category}} and category)

I want to use the value of category to determine which list of pages
to return.

I KNOW THIS DOESN"T WORK:

@register.tag(name="page_links")
def get_page_links(parser,token):
tag_name, cat = token.contents.split()
return PageLink(cat[1:-1])

class PageLink(template.Node):

def __init__(self, cat):

cat= template.Variable(cat)
print cat   <-  outputs category
if cat=='business':
pages=BusinessPage.objects.filter
(is_live=True).select_related().order_by('order')
elif cat=='community':
pages=CommunityPage.objects.filter
(is_live=True).select_related().order_by('order')
elif cat=='tourism':
pages=TourismPage.objects.filter
(is_live=True).select_related().order_by('order')

else:
pages = False

self.pages = pages

def render(self, context):
context['pages'] = self.pages

return ''


This code works fine as long as I call it like this:

{% page_links "business" %}

@register.tag(name="page_links")
def get_page_links(parser,token):

tag_name, cat = token.contents.split()
cat = cat[1:-1]

if cat=='business':
pages=BusinessPage.objects.filter
(is_live=True).select_related().order_by('order')
elif cat=='community':
pages=CommunityPage.objects.filter
(is_live=True).select_related().order_by('order')
elif cat=='tourism':
pages=TourismPage.objects.filter
(is_live=True).select_related().order_by('order')
else:
pages = False

return PageLink(pages)

class PageLink(template.Node):

def __init__(self, pages):
self.pages = pages

def render(self, context):
context['pages'] = self.pages

return ''
--~--~-~--~~~---~--~~
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: Model fails in shell but not in runserver - IndexError: list index out of range

2009-01-26 Thread phoebebright

Karen,

Yes have models in same directory as settings - bad girl!

Thanks.

Phoebe.

On Jan 26, 1:37 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Mon, Jan 26, 2009 at 8:03 AM, phoebebright 
> <phoebebright...@gmail.com>wrote:
>
>
>
>
>
> > Am I blind?
>
> > I am getting this error in the shell, but no obvious errors when using
> > the browser interface.
>
> > >>> from models import Business
> > Traceback (most recent call last):
> >  File "", line 1, in ?
> >  File "/home/django/towns/models.py", line 8, in ?
> >    class Category(models.Model):
> >  File "/usr/lib/python2.4/site-packages/django/db/models/base.py",
> > line 51, in __new__
> >    kwargs = {"app_label": model_module.__name__.split('.')[-2]}
> > IndexError: list index out of range
>
> Normally I'd expect "from models import Whatever" from manage.py shell to to
> give me an "ImportError: No module named models".  The fact that yours
> doesn't implies you've either got a models.py file in the same directory as
> your settings.py or you've put an individual app directory on your
> PYTHONPATH.  Neither seems like a particularly good idea.  Instead use:
>
> >>> from appname.models import Business
>
> (where 'appname' is replaced with your actual app name) and then you won't
> get an error when Django tries to figure out the app label associated with
> the model.
>
> 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
-~--~~~~--~~--~--~---



Model fails in shell but not in runserver - IndexError: list index out of range

2009-01-26 Thread phoebebright

Am I blind?

I am getting this error in the shell, but no obvious errors when using
the browser interface.

>>> from models import Business
Traceback (most recent call last):
  File "", line 1, in ?
  File "/home/django/towns/models.py", line 8, in ?
class Category(models.Model):
  File "/usr/lib/python2.4/site-packages/django/db/models/base.py",
line 51, in __new__
kwargs = {"app_label": model_module.__name__.split('.')[-2]}
IndexError: list index out of range

I can try and import any class from the model and I get the same
error.
Running syncdb generates no errors and tried re-generating the whole
database.

Here is the start of a model

from django.db import models
from django.forms import ModelForm
from django import  forms
from richtext.fields import AdminRichTextField
from tinymce import models as tinymce_models
from thumbs import ImageWithThumbsField

class Category(models.Model):
name = models.CharField(max_length=12, unique=True)
description = models.TextField()


def __unicode__(self):
return self.name

class Meta:
ordering = ["name"]
verbose_name_plural = "Categories"

class Subcategory(models.Model):
category = models.ForeignKey(Category)
name =  models.CharField(max_length=30, unique=True)


def __unicode__(self):
return self.name


class Meta:
ordering = ["category","name"]
verbose_name_plural = "Sub-Categories"

..

I can change the name Category to Junk and I get the same error but if
I remove the Category class then I don't get an error until the second
line of SubCategory where it can't link to category.

Tried stripping gremlins and converting to ASCII in bbedit.
Tried deleting and retyping
Tried copying and pasting the Subcategory definition and renaming as
requried.

Nothing makes a difference.
--~--~-~--~~~---~--~~
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: Refresh Queryset - I know the answer is there somewhere

2009-01-23 Thread phoebebright

My hero - that worked for time!

Many many thanks.


On Jan 23, 12:37 pm, Alex Koshelev <daeva...@gmail.com> wrote:
> Your query executes in module import time and it happens only one time. So
> you cannot reevaluate it using choices field param like that.
>
> Solution - redefine form `__init__` and manually reassign choices to given
> field every time form is created.
>
> def __init__(self, *args, **kwargs):
>    super(MyForm, self).__init__(*args, **kwargs)
>    self.fields['carmake'].choices = Carmake.get_makelist()
>
> On Fri, Jan 23, 2009 at 3:20 PM, phoebebright 
> <phoebebright...@gmail.com>wrote:
>
>
>
> > Have been reluctant to post on this one as have come across many many
> > discussion during the 3 days of lack of success on resolving this
> > issue, but none has left me with a solution.
>
> > I have a form with a dropdown generated from a query.
>
> > This is in the form:
> >    carmake = forms.ChoiceField(choices=Carmake.get_makelist(),
> > label='Make')
>
> > This is in the model:
>
> > class Carmake(models.Model):
> >    name = models.CharField('Make', max_length=20)
>
> >    def __unicode__(self):
> >        return self.name
>
> >   �...@classmethod
> >    def get_makelist(a):
>
> >         return [('Any', 'Any Make')] + [(item, item) for item in
> > Car.objects.all().values_list('model__make__name',
> > flat=True).select_related().distinct()]
>
> > Predictably, the dropdown doesn't update when new makes are added
> > unless I restart the apache server.  I have tried everything suggested
> > by other posts and the example above is a close as I can get to the
> > example in the documentation that suggests these two queries will both
> > be evaluated.
> > >>> print [e.headline for e in Entry.objects.all()]
> > >>> print [e.pub_date for e in Entry.objects.all()]
>
> > I understand this has been discussed to death, but can someone please
> > enlighten me on a solution which will ALWAYS re-evaluate this query??
>
>
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Refresh Queryset - I know the answer is there somewhere

2009-01-23 Thread phoebebright

Have been reluctant to post on this one as have come across many many
discussion during the 3 days of lack of success on resolving this
issue, but none has left me with a solution.

I have a form with a dropdown generated from a query.

This is in the form:
carmake = forms.ChoiceField(choices=Carmake.get_makelist(),
label='Make')

This is in the model:

class Carmake(models.Model):
name = models.CharField('Make', max_length=20)

def __unicode__(self):
return self.name

@classmethod
def get_makelist(a):

 return [('Any', 'Any Make')] + [(item, item) for item in
Car.objects.all().values_list('model__make__name',
flat=True).select_related().distinct()]


Predictably, the dropdown doesn't update when new makes are added
unless I restart the apache server.  I have tried everything suggested
by other posts and the example above is a close as I can get to the
example in the documentation that suggests these two queries will both
be evaluated.
>>> print [e.headline for e in Entry.objects.all()]
>>> print [e.pub_date for e in Entry.objects.all()]

I understand this has been discussed to death, but can someone please
enlighten me on a solution which will ALWAYS re-evaluate this query??

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Confused by error messages

2009-01-22 Thread phoebebright

I managed to set debug to false and spend an hour trying to understand
this error:


  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/template/defaulttags.py", line 880, in
load
(taglib, e))

TemplateSyntaxError: 'openid_tags' is not a valid tag library: Could
not load template library from django.templatetags.openid_tags, No
module named openid_tags

But I'm not using openid_tags and no reference to openid anywhere in
my code! Then discovered what I'd done and set Debug to true.  Now the
error is:

DoesNotExist at /
Category matching query does not exist.
Request Method: GET
Request URL:http://127.0.0.1:8000/
Exception Type: DoesNotExist
Exception Value:
Category matching query does not exist.

Now that makes sense, but why the difference??

--~--~-~--~~~---~--~~
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: Recommendation on understanding CSS

2009-01-22 Thread phoebebright

If you have a Mac I recommend CSSEdit which allows you to analyse the
css that applies to each element on a page (locally or online) and
changes show immediately.


On Jan 21, 8:52 am, Gath  wrote:
> Guys,
>
> Its seems the best way to do templates in Django is via plain html and
> css, but am having a problem in understanding css easily, can someone
> recommend some nice material/site on css i can read, i mean step by
> step till complex stuff.
>
> Paul

--~--~-~--~~~---~--~~
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: Odd problem with date based generic views

2009-01-19 Thread phoebebright

Just going to transfer the view into a real table.  Will let you know
if that doesn't solve the problem!

On Jan 19, 12:57 pm, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:
> On Mon, 2009-01-19 at 04:38 -0800, phoebebright wrote:
> > Generic view - year_archive, is not working for me.  There are no
> > errors displayed and no data either.  On investigation, there seems to
> > be a mysql error that is causing the problem and it could be related
> > to the my using a view instead of a table as the source for the mode.
> > The original date field is not a date but is converted to a date in
> > the view and maybe this is the problem.
>
> [...]
>
> > If I run the query manually in mysql and add quotes around the range
> > values,
>
> > BETWEEN '2007-01-01 00:00:00' and '2007-12-31 23:59:59.99'
>
> > it works fine but not without the quotes.
>
> > This may be a red herring - the toolbar might be stripping quotes from
> > the query.
>
> Yes, that is a red herring. It's not the debug toolbar, but a limitation
> of the Python DB wrappers. There's no public API to ask them how they
> are about to quote parameters. So the strings you get from
> django.db.connection.queries (which is what the debug toolbar is showing
> you) are the query strings with the parameter values substituted in for
> the "%s" placeholders. It's actually the raw_sql string that is passed
> to the DB wrapper (MySQLdb in your case), along with a couple of Python
> objects for the parameters. It takes care of quoting things correctly
> and feeding the resulting string to the database correctly.
>
> Everything you've written looks right. So I'd be suspicious of your
> database view, as you are.
>
> As you deduce, if we broke archive_year at any point, I suspect it would
> take about 23 seconds before somebody reported the bug. Generic views
> tend to get used a lot. :-)
>
> 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
-~--~~~~--~~--~--~---



  1   2   >