Re: Is it really this hard?

2007-05-15 Thread anders conbere

further there is the great save_instance function that when coupled
with using the __dict__ attribute makes doing custom form to model
manipulation really easy.

save_instance(form_instance, model_instance)

will update the model instance with the form data

~ Anders

On 5/15/07, John Matthew <[EMAIL PROTECTED]> wrote:
> Ah Ha, now we're getting somewhere!
>
> Let me start searching for that, thank you!!
>
> John
>
>
> On 5/15/07, James Bennett < [EMAIL PROTECTED]> wrote:
> >
> > On 5/15/07, John M < [EMAIL PROTECTED]> wrote:
> > > I wish the custom form option would allow me to bind to a data object,
> > > based on field names being the same, that way I could have fields in
> > > the form that aren't bound and ones that are, without a lot of hassle.
> >
> > To do that you want to get a dictionary out of the object, which means
> > using the '__dict__' attribute. For example:
> >
> > my_obj = MyModel.objects.get(pk=1)
> > form = MyForm(my_obj.__dict__)
> >
> > The form is smart enough to take a dictionary-like object and pull out
> > the values it wants; that's how it works with request.POST, for
> > example.
> >
> > --
> > "Bureaucrat Conrad, you are technically correct -- the best kind of
> correct."
> >
> >
>
>
>  >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is it really this hard?

2007-05-15 Thread John Matthew
Ah Ha, now we're getting somewhere!

Let me start searching for that, thank you!!

John

On 5/15/07, James Bennett <[EMAIL PROTECTED]> wrote:
>
>
> On 5/15/07, John M <[EMAIL PROTECTED]> wrote:
> > I wish the custom form option would allow me to bind to a data object,
> > based on field names being the same, that way I could have fields in
> > the form that aren't bound and ones that are, without a lot of hassle.
>
> To do that you want to get a dictionary out of the object, which means
> using the '__dict__' attribute. For example:
>
> my_obj = MyModel.objects.get(pk=1)
> form = MyForm(my_obj.__dict__)
>
> The form is smart enough to take a dictionary-like object and pull out
> the values it wants; that's how it works with request.POST, for
> example.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of
> correct."
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is it really this hard?

2007-05-15 Thread James Bennett

On 5/15/07, John M <[EMAIL PROTECTED]> wrote:
> I wish the custom form option would allow me to bind to a data object,
> based on field names being the same, that way I could have fields in
> the form that aren't bound and ones that are, without a lot of hassle.

To do that you want to get a dictionary out of the object, which means
using the '__dict__' attribute. For example:

my_obj = MyModel.objects.get(pk=1)
form = MyForm(my_obj.__dict__)

The form is smart enough to take a dictionary-like object and pull out
the values it wants; that's how it works with request.POST, for
example.

-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is it really this hard?

2007-05-15 Thread John M

Anders,

Thanks for the info, but it still seems rather cumbersome to remove
fields from the Form.

I wish the custom form option would allow me to bind to a data object,
based on field names being the same, that way I could have fields in
the form that aren't bound and ones that are, without a lot of hassle.

John

On May 15, 6:56 pm, "anders conbere" <[EMAIL PROTECTED]> wrote:
> As far as I know the officially recommended way of accomplishing this
> while still using the form_for_* helper functions is through the use
> of a formfield_callback, a function that takes field instances and
> mucks with them.
>
> def form_callback(field, **kwargs):
> if field.name == "field_name":
> return None
>
> my_instance = MyClass.objects.get(pk=x)
> form = form_for_instance(instance, formfield_callback= form_callback)
>
> will remove the field named "field_name" from the form
>
> ~ Anders
>
> On 5/15/07, John Matthew <[EMAIL PROTECTED]> wrote:
>
> > James, thanks for the quick reply!
>
> > Ok, I like what you have there, but it doesn't solve the problem of when I
> > want to edit an existing record, how do I use the customform?  I guess I'm
> > just missing something super simple here, no?
>
> > I would think code like
>
> > instance = objects.get(id=1)
> > form = OrderForm(
> > instance)
> > does this get me the form filled with the data from instance?
>
> > Thanks
>
> > On 5/15/07, James Bennett <[EMAIL PROTECTED]> wrote:
>
> > > On 5/15/07, John M <[EMAIL PROTECTED]> wrote:
> > > > When I put up the form for order, I don't want the Customer (foreign
> > > > key) to appear.  I've not seen anything on the forum that shows you
> > > > can easily eliminate a field from the form?
>
> > > In general, form_for_model and form_for_instance are for when you just
> > > want "form for this thing" and don't care about fine-grained control
> > > of the fields. When you do want fine-grained control of the fields, a
> > > custom form is the way to go.
>
> > > > Unless I'm missing how to create a custom form, bind it to the DB's
> > > > data and use it like I can form_for_instance() and form_for_model().
>
> > > Something like this is what you're looking for, I think:
>
> > >http://dpaste.com/10396/
>
> > > --
> > > "Bureaucrat Conrad, you are technically correct -- the best kind of
> > correct."


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is it really this hard?

2007-05-15 Thread Russell Keith-Magee

On 5/16/07, anders conbere <[EMAIL PROTECTED]> wrote:
>
> As far as I know the officially recommended way of accomplishing this
> while still using the form_for_* helper functions is through the use
> of a formfield_callback, a function that takes field instances and
> mucks with them.
>
> def form_callback(field, **kwargs):
> if field.name == "field_name":
> return None
>
> my_instance = MyClass.objects.get(pk=x)
> form = form_for_instance(instance, formfield_callback= form_callback)
>
> will remove the field named "field_name" from the form

Alternatively, you can use the recently added 'fields' attribute:

Form = form_for_instance(instance, fields=('field1','field2'))
myform = Form()

will produce a form for 'instance' that contains only the fields
'field1' and 'field2', populated with initial data from the instance.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Adding myself as a django friendly hoster

2007-05-15 Thread Kenneth Gonsalves


On 16-May-07, at 7:00 AM, Josh Trutwin wrote:

> Hi - I would like to add my hosting company as a django-friendly web
> host - is there a process to go through or should I just edit this
> wiki page:
>
> http://code.djangoproject.com/wiki/DjangoFriendlyWebHosts

edit it

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is it really this hard?

2007-05-15 Thread anders conbere

As far as I know the officially recommended way of accomplishing this
while still using the form_for_* helper functions is through the use
of a formfield_callback, a function that takes field instances and
mucks with them.

def form_callback(field, **kwargs):
if field.name == "field_name":
return None

my_instance = MyClass.objects.get(pk=x)
form = form_for_instance(instance, formfield_callback= form_callback)

will remove the field named "field_name" from the form

~ Anders

On 5/15/07, John Matthew <[EMAIL PROTECTED]> wrote:
> James, thanks for the quick reply!
>
> Ok, I like what you have there, but it doesn't solve the problem of when I
> want to edit an existing record, how do I use the customform?  I guess I'm
> just missing something super simple here, no?
>
> I would think code like
>
> instance = objects.get(id=1)
> form = OrderForm(
> instance)
> does this get me the form filled with the data from instance?
>
> Thanks
>
>
> On 5/15/07, James Bennett <[EMAIL PROTECTED]> wrote:
> >
> > On 5/15/07, John M <[EMAIL PROTECTED]> wrote:
> > > When I put up the form for order, I don't want the Customer (foreign
> > > key) to appear.  I've not seen anything on the forum that shows you
> > > can easily eliminate a field from the form?
> >
> > In general, form_for_model and form_for_instance are for when you just
> > want "form for this thing" and don't care about fine-grained control
> > of the fields. When you do want fine-grained control of the fields, a
> > custom form is the way to go.
> >
> > > Unless I'm missing how to create a custom form, bind it to the DB's
> > > data and use it like I can form_for_instance() and form_for_model().
> >
> > Something like this is what you're looking for, I think:
> >
> > http://dpaste.com/10396/
> >
> > --
> > "Bureaucrat Conrad, you are technically correct -- the best kind of
> correct."
> >
> >
>
>
>  >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Adding myself as a django friendly hoster

2007-05-15 Thread Josh Trutwin

Hi - I would like to add my hosting company as a django-friendly web
host - is there a process to go through or should I just edit this
wiki page:

http://code.djangoproject.com/wiki/DjangoFriendlyWebHosts

Josh

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django vps hosting

2007-05-15 Thread Kenneth Gonsalves


On 16-May-07, at 6:41 AM, scadink wrote:

> WebFaction just makes deployment easy (no admin headaches) while still
> giving you all of the meaningful stuff (your own Apache, mod_python,
> PostgreSQL and MySQL, etc.).  But that's just my opinion.

a client of mine has taken a webfaction django account - and so far  
everything is looking very good. Not in production yet, but i dont  
thing i will have much problem. They have done everything very neatly.

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is it really this hard?

2007-05-15 Thread John Matthew
James, thanks for the quick reply!

Ok, I like what you have there, but it doesn't solve the problem of when I
want to edit an existing record, how do I use the customform?  I guess I'm
just missing something super simple here, no?

I would think code like

instance = objects.get(id=1)
form = OrderForm(instance)

does this get me the form filled with the data from instance?

Thanks

On 5/15/07, James Bennett <[EMAIL PROTECTED]> wrote:
>
>
> On 5/15/07, John M <[EMAIL PROTECTED]> wrote:
> > When I put up the form for order, I don't want the Customer (foreign
> > key) to appear.  I've not seen anything on the forum that shows you
> > can easily eliminate a field from the form?
>
> In general, form_for_model and form_for_instance are for when you just
> want "form for this thing" and don't care about fine-grained control
> of the fields. When you do want fine-grained control of the fields, a
> custom form is the way to go.
>
> > Unless I'm missing how to create a custom form, bind it to the DB's
> > data and use it like I can form_for_instance() and form_for_model().
>
> Something like this is what you're looking for, I think:
>
> http://dpaste.com/10396/
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of
> correct."
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is it really this hard?

2007-05-15 Thread John M

Ok, what if I make the FK just not editable and assign a value at
runtime?

Will that work?

On May 15, 5:56 pm, John M <[EMAIL PROTECTED]> wrote:
> I have checked the forum, and still can't believe I can't find a
> solution to what I perceive as a simple problem:
>
> I have two models:
>
> Customer
>Name
>phone
>
> Order
>Customer (foreign key to Customer)
>date
>product
>
> When I put up the form for order, I don't want the Customer (foreign
> key) to appear.  I've not seen anything on the forum that shows you
> can easily eliminate a field from the form?
>
> Unless I'm missing how to create a custom form, bind it to the DB's
> data and use it like I can form_for_instance() and form_for_model().
>
> using FFI with a customer form, it doesn't seem to bind any data to
> the fields, unless I'm missing something big, cause that would be
> perfect, no?
>
> Hoping someone can 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is it really this hard?

2007-05-15 Thread James Bennett

On 5/15/07, John M <[EMAIL PROTECTED]> wrote:
> When I put up the form for order, I don't want the Customer (foreign
> key) to appear.  I've not seen anything on the forum that shows you
> can easily eliminate a field from the form?

In general, form_for_model and form_for_instance are for when you just
want "form for this thing" and don't care about fine-grained control
of the fields. When you do want fine-grained control of the fields, a
custom form is the way to go.

> Unless I'm missing how to create a custom form, bind it to the DB's
> data and use it like I can form_for_instance() and form_for_model().

Something like this is what you're looking for, I think:

http://dpaste.com/10396/

-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django vps hosting

2007-05-15 Thread scadink

I have three web hosts at the moment: SliceHost, WebFaction and
DreamHost.

If you are looking to deploy a nice, low-traffic (below 25k per day)
site, I would probably recommend WebFaction.  I was enamored by
SliceHost when I first signed up because you do get a nice, dedicated
256MB piece of RAM, but that goes to things like the MySQL daemon,
base OS, and the like as well as your Apache instances.  You also then
have to be the person who worries about security issues and tuning and
stuff.  If you're one person, a VPS probably isn't the best way to go
because you'll have to be both programmer and sysadmin.

WebFaction's shared hosting is a little more than shared hosting.
They provide you with your own Apache instance which is really nice.
This way, you can run Django under mod_python and have all the
goodness you'd want if you had set everything up yourself.  They also
used to be Python-Hosting from back when Zope/Plone was Python on the
web.  They know what they're doing.  Going the WebFaction route means
that you don't have to worry about security issues on the server like
you would with a VPS, yet they still give you enough RAM on their
$7.50 to have your site run and run well.

DreamHost only supports FastCGI and I wouldn't recommend it as much as
the other two unless you want a really awesome email account with more
storage than you could ever use.

WebFaction just makes deployment easy (no admin headaches) while still
giving you all of the meaningful stuff (your own Apache, mod_python,
PostgreSQL and MySQL, etc.).  But that's just my opinion.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django [was "vps"] hosting

2007-05-15 Thread Chris Moffitt


>
> Does anyone on the list have positive or negative experiences 
> with either Site5.com or ThinkHost.com you'd be willing to share?
>   
I have used Thinkhost and actually did the write-up on the Django site 
of how to setup thinkhost with Django.  As a provider, Thinkhost is just 
fine but I wouldn't recommend it for use with Django.  I had a real hard 
time figuring out how to restart the fcgi processes after making 
changes.  Nothing I tried seemed to have any affect.  I'd have to make a 
change then wait 30 minutes or so for the new processes to spawn - a 
real pain when developing.

Right now I'm using www.grokthis.net with a VPS but they also have a 
shared and advanced offerings too.  I've been happy so far.

Good luck,
Chris

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Is it really this hard?

2007-05-15 Thread John M

I have checked the forum, and still can't believe I can't find a
solution to what I perceive as a simple problem:

I have two models:

Customer
   Name
   phone

Order
   Customer (foreign key to Customer)
   date
   product

When I put up the form for order, I don't want the Customer (foreign
key) to appear.  I've not seen anything on the forum that shows you
can easily eliminate a field from the form?

Unless I'm missing how to create a custom form, bind it to the DB's
data and use it like I can form_for_instance() and form_for_model().

using FFI with a customer form, it doesn't seem to bind any data to
the fields, unless I'm missing something big, cause that would be
perfect, no?

Hoping someone can 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Newform and Minimal File Upload Example

2007-05-15 Thread Michael Lake

Hi

I'm still trying to find a minimal example.
This http://www.djangosnippets.org/snippets/103/ is very specific to a zip file 
type.
A search of the Django Users Group using 'newforms upload' gives a few posts:
 newforms and FileInput
 Newform and File Upload problem
 "'BoundField' object is unsubscriptable " error when trying to upload file
 validating using newforms
and many of these deal with problems in trying to either do or validate image 
uploads. All seem to have problems and use very different methods.

I'd like to get a min example up and running and then add some validation (like 
checking that it is an image and say checking its size) after I have a small 
test 
working fine.

Michael Lake wrote:
> Hi all
> 
> Guillaume wrote in May "Newform and File Upload problem" 
> 
> 
>>Well, my message was maybe a little long. I still have not found answers
>>to my problem. To make it short, Is there anywhere a short example of file
>>upload using newform ?
>>The most simple thing with a model with 1 FileField, the smallest
>>template and form associated and the handling code.
>>That would be great, and probably useful for some other django beginers.
> 
> 
> I'm also struggling with newforms to upload an image file(s). I have seen 
> that there
> are a few posts that deal with zipfiles and images but all are sufficiently 
> different
> that I'm more confused.
> 
> It would be really appreciated by myself and probably a few others if a 
> minimal but
> full working example could be posted for a general file upload using newforms.
> I realise there are two cases here: upload file to a subdirectory of 
> MEDIA_ROOT and
> upload to a database field. The latter is what I want to do with images.
> 
> MINIMAL MODEL:
> 
> class Test(models.Model):
>  name = models.CharField(maxlength=255)
>  image = models.ImageField(upload_to='images', blank=True, null=True)
>  # What to do if you wish to upload to the image field itself and not to a
>  # directory images/ ?
> 
>  # def save(): # Do we need a save here?
> 
> The data in this model might be something like:
> 
> ++--+--+
> | id | name | image|
> | 1  | A| some_binary_data | <-- binary data if image is in database
> | 2  | B|  | otherwise text data of an image filename.
> ++--+--+
> 
> Here we want a form that allows us to select a row and upload an image say 
> into that 
> row's image field.
> 
> VIEW:
> 
> def test_fileupload(request):
>  ''' This is used for testing file upload. '''
> 
>  class UploadForm(forms.Form):
>  ''' A Django newforms class that handles uploading files. '''
> 
>  choices = []
>  for test in Test.objects.all():
>  choices.append((test.id, test.name))
> 
>  # The variable choices is now something like: [(1,'A'),(2,'B')]
>  choice = forms.CharField(widget=forms.Select(choices=choices))
>  uploadFile = forms.Field(widget=forms.FileInput)
> 
>  def check_file(self):
>  # Check if the file is an image file.
>  # If it's not do something.
>  pass
> 
>  def save(self):
>  pass
> 
>  form = UploadForm()
> 
>  if (request.POST):
>  # The request.POST does not contain file upload data.
>  # Access instead request.FILES
>  id = request.POST['choice']
>  #filename = request.POST['upload']
>  file_name = request.POST['uploadFile']   # <-- does not work
> 
>  if (request.FILES):
>  file_data = request.FILES['uploadFile']
> 
>  if form.is_valid():
>  form.save()
>  else:
>  form = UploadForm()
> 
>  data = { 'form': form,
>  }
>  return render_to_response('app/test_fileupload.html', data)
> 
> 
> MINIMAL TEMPLATE:
> 
> 
> Select row:  {{ form.choice }}
> Select File: {{ form.uploadFile }} and press Upload.
> 
> 
> 
> Looks like this:
> 
> Select row:  [   ] <-- drop down list to select the row
> Select file: [   ] [Browse] and press upload [Upload]
> 


-- 
Michael Lake
Computational Research Support Unit
Science Faculty, UTS
Ph: 9514 2238




--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Developer needed for hosted client Screening & Client management system

2007-05-15 Thread Lee Dreams

Were an adult Service company looking for someone to develop a hosted
client Screening and Client management system.

The details:

* allows simple "branding" of the site to match the hosting customer's
existing look and feel
* allows selective sharing of information between hosting customers
* uses screen/form-scraping to pull date in from subscription services
   [people finder, Net detective, Any who Etc...]
* Security is an obvious concern
* Will need to be able to access client info  on Web enables cell
phones
* Will need to retain our existing client data
* Down the road the system will need to store data from client psych
tests and other tests
* Possible interface with an IVR sysytem in future versions
* Photo data as well for each client.
* From start to finish we want to project done in 60 days

Now we have an existing app currently in Django which was never
finished and we've out grown
plus we'll need some maintenance done on it in the meantime.

This is a hosted service and we are building out.

We would prefer someone in the USA thank you very much and if you live
in KY, TN, IN or OH hey ever better. But competency and integrity is
what matters to us.
This is a Flat fee project.

Contact me off list please at
[EMAIL PROTECTED] or
[EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Issue with MySQL wrapper

2007-05-15 Thread Gerard M

Hi guys I have a big problem with this wrapper im using Ubuntu 7.04
and I want to install python-MySQLdb, I used synaptics and it is
installed, but when I try to do
>>> import MySQLdb
and  I get this error:

Traceback (most recent call last):
  File "", line 1, in 
  File "MySQLdb/__init__.py", line 19, in 
import _mysql
ImportError: No module named _mysql

so I tried to download it from the site and install it from the .tar
file but I failed because when I run

#~/Desktop/MySQL-python-1.2.2$ python setup.py install

I get this output:

This script requires setuptools version 0.6c5 to run (even to display
help).  I will attempt to download it for you (from
http://cheeseshop.python.org/packages/2.5/s/setuptools/), but
you may need to enable firewall access for this script first.
I will start the download in 15 seconds.

(Note: if this machine does not have network access, please obtain the
file

   
http://cheeseshop.python.org/packages/2.5/s/setuptools/setuptools-0.6c5-py2.5.egg

and place it in this directory before rerunning this script.)
---
Downloading 
http://cheeseshop.python.org/packages/2.5/s/setuptools/setuptools-0.6c5-py2.5.egg
Traceback (most recent call last):
  File "setup.py", line 5, in 
import ez_setup; ez_setup.use_setuptools()
  File "/home/gerardo/Desktop/MySQL-python-1.2.2/ez_setup.py", line
85, in use_setuptools
import setuptools; setuptools.bootstrap_install_from = egg
zipimport.ZipImportError: can't decompress data; zlib not available

I dont know whats that zlib, I installed some libraries with zlib
using synaptics, but still no luck :(, thanks for your 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: MySQLdb Error

2007-05-15 Thread Bryan Veloso

It looks like you're using version 1.2.2. Try using 1.2.1_p2 and see
if that works, I had a problem similiar to yours and downgrading to
that version fixed my problem.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: MySQLdb Error

2007-05-15 Thread Steve

As far as I know. I could have screwed something up, but everything
related to django and apache is owned by root:wheel

It's only a test environment anyway... so it's not that big of a deal
if I need to delete the caches before doing things...

On May 15, 3:18 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> On 5/15/07, Steve <[EMAIL PROTECTED]> wrote:
>
>
>
> > Apparently there is a difference between the cache created by apache
> > and the one created by django that makes them incompatible. In order
> > for me to run syncdb I had to delete the cache, and before apache
> > could create a new cache, run syncdb... however this caused apache to
> > start throwing the same error, which required the same fix... deleting
> > the cache so that it could be recreated by apache.
>
> Are you sure that apache and you are running with compatible
> permissions, python versions, and sys.path's?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Reminder: if you're using an SVN checkout, watch for changes

2007-05-15 Thread James Bennett

Howdy, folks!

Since a recent change in Django's development trunk caught a few
people unawares (see the thread today on 'clean_data' versus
'cleaned_data' in newforms), I thought I'd take this opportunity to
put on my release-manager hat and remind everybody that if you're
working from a Subversion checkout of Django and updating it
regularly, you'll want to keep an eye on the following page, which
details any backwards-incompatible changes in Django's development
version as they happen:

http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges

A helpful user of Django (whose full name I don't know, or else I'd
give him full credit for this) has also used Yahoo Pipes to create a
feed you can subscribe to, if you'd prefer that route:

http://pipes.yahoo.com/pipes/pipe.info?_id=HsTZGAkD3BG7VhBkl7okhQ

We always try to maintain backwards compatibility between versions of
Django, but as features are introduced and stabilized it's sometimes
necessary to change things in ways that require your code to change as
well. There will be a couple more such changes before the next
official release of Django (the big one will be the merge of the
newforms-admin branch), so please do keep an eye on that changes page
if you're running an SVN checkout.

If you're sticking with the Django 0.96 release instead of running a
Subversion checkout,  the next official release will, as always,
include detailed notes on any changes you'll need to make when you
upgrade.

We now return you to your regularly-scheduled discussion, and thank
you for flying Django :)


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using Django Models outside of Django

2007-05-15 Thread Malcolm Tredinnick

On Tue, 2007-05-15 at 15:18 -0700, johnny wrote:
> Doing the following:
> 
> from os import environ
> environ['DJANGO_SETTINGS_MODULE'] = 'settings'
> from settings import *
> 
> Only works at the parent folder level.  What if you have script in sub
> folder level?  I tried it at sub folder level and got error:
> 
> from os import environ
> environ['DJANGO_SETTINGS_MODULE'] = '../settings'

This has to be a Python import path, not a file path. So the settings
file needs to be somewhere on your Python path. It always works when it
is in the current directory, because the current directory is always
implicitly on your Python path.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: MySQLdb Error

2007-05-15 Thread Jeremy Dunck

On 5/15/07, Steve <[EMAIL PROTECTED]> wrote:
>
> Apparently there is a difference between the cache created by apache
> and the one created by django that makes them incompatible. In order
> for me to run syncdb I had to delete the cache, and before apache
> could create a new cache, run syncdb... however this caused apache to
> start throwing the same error, which required the same fix... deleting
> the cache so that it could be recreated by apache.

Are you sure that apache and you are running with compatible
permissions, python versions, and sys.path's?

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using Django Models outside of Django

2007-05-15 Thread johnny

Doing the following:

from os import environ
environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from settings import *

Only works at the parent folder level.  What if you have script in sub
folder level?  I tried it at sub folder level and got error:

from os import environ
environ['DJANGO_SETTINGS_MODULE'] = '../settings'
from settings import *
>>> from apps.mail.models import Email
Traceback (most recent call last):
  File "", line 1, in ?
ImportError: No module named apps.mail.models
>>>


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Pickle model fields

2007-05-15 Thread Malcolm Tredinnick

On Tue, 2007-05-15 at 17:11 -0500, Jeremy Dunck wrote:
> On 5/15/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> > One day I'll have the infinite spare time I've been asking Santa Claus
> > for and maybe get around to adding the missing pieces and documentation.
> > Or somebody will beat me to it (even better).
> 
> I certainly wasn't intending to prod you or anyone else.  I'm sure
> you've contributed more than me, and I thank you for it.

I realise that, don't worry. This is actually something I *want* to do,
but it's lower priorities than the other things we should get done
first.

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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: MySQLdb Error

2007-05-15 Thread Steve

Apparently there is a difference between the cache created by apache
and the one created by django that makes them incompatible. In order
for me to run syncdb I had to delete the cache, and before apache
could create a new cache, run syncdb... however this caused apache to
start throwing the same error, which required the same fix... deleting
the cache so that it could be recreated by apache.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Pickle model fields

2007-05-15 Thread Jeremy Dunck

On 5/15/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> One day I'll have the infinite spare time I've been asking Santa Claus
> for and maybe get around to adding the missing pieces and documentation.
> Or somebody will beat me to it (even better).

I certainly wasn't intending to prod you or anyone else.  I'm sure
you've contributed more than me, and I thank you for it.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Pickle model fields

2007-05-15 Thread Malcolm Tredinnick

On Tue, 2007-05-15 at 17:01 -0500, Jeremy Dunck wrote:
> On 5/15/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> > One  solution would be that the model field only stores the pickled
> > value.
> 
> I think it's not well understood that model fields can be created by
> subclassing django.db.models.fields.Field.

True, although I wasn't actually suggesting a Field subclass (I'm aware
that's not well documented yet, but that's partly because it's missing
some machinery to make it truly useful).

I was suggesting adding a property to the Model class that acted as a
proxy for the CharField or whatever is being used to store the pickled
value.

> Lucki, have a look at the docstrings in that class (in file
> django/db/models/fields/__init__.py).  They're pretty descriptive;
> look at FileField for an example of a field that does a fair bit of
> non-vanilla customization.

Creating a Field sub-class is certainly another option, you're right.

One day I'll have the infinite spare time I've been asking Santa Claus
for and maybe get around to adding the missing pieces and documentation.
Or somebody will beat me to it (even better).

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Pickle model fields

2007-05-15 Thread Jeremy Dunck

On 5/15/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> One  solution would be that the model field only stores the pickled
> value.

I think it's not well understood that model fields can be created by
subclassing django.db.models.fields.Field.

Lucki, have a look at the docstrings in that class (in file
django/db/models/fields/__init__.py).  They're pretty descriptive;
look at FileField for an example of a field that does a fair bit of
non-vanilla customization.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms.clean_data vs. newforms.cleanED_data

2007-05-15 Thread Malcolm Tredinnick

On Tue, 2007-05-15 at 16:58 -0500, Joseph Kocherhans wrote:
> On 5/15/07, canen <[EMAIL PROTECTED]> wrote:
> >
> > This changed was committed yesterday.  See here
> > http://groups.google.com/group/django-developers/browse_thread/thread/c87a893a4d7c50a0/32f777bafd3cdb35#32f777bafd3cdb35
> > for the discussion that lead to the change.
> >
> > On May 15, 10:43 pm, cornelius bolten <[EMAIL PROTECTED]> wrote:
> > > hi,
> > >
> > > i just tried to click through my new website (django 0.97) after
> > > developing it on my localhost (django latest stable).
> > >
> > > all my websites' forms (newforms) worked well on my localhost.. but
> > > online i got lot's of errors.
> > >
> > > after some searching, i found out that newforms.clean_data changed to
> > > newforms.cleaned_data. when did this change happen, and why? a lot of my
> > > apps stopped working now..
> 
> Also, if you don't have time to follow the django-developers list, or
> at least check http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges
> before running svn up, you really shouldn't follow svn trunk for
> awhile. 

It's probably more important to check the web page than follow the
developers' list, I would say. It's a bug if we don't update the webpage
after a real incompatible change.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms.clean_data vs. newforms.cleanED_data

2007-05-15 Thread Joseph Kocherhans

On 5/15/07, canen <[EMAIL PROTECTED]> wrote:
>
> This changed was committed yesterday.  See here
> http://groups.google.com/group/django-developers/browse_thread/thread/c87a893a4d7c50a0/32f777bafd3cdb35#32f777bafd3cdb35
> for the discussion that lead to the change.
>
> On May 15, 10:43 pm, cornelius bolten <[EMAIL PROTECTED]> wrote:
> > hi,
> >
> > i just tried to click through my new website (django 0.97) after
> > developing it on my localhost (django latest stable).
> >
> > all my websites' forms (newforms) worked well on my localhost.. but
> > online i got lot's of errors.
> >
> > after some searching, i found out that newforms.clean_data changed to
> > newforms.cleaned_data. when did this change happen, and why? a lot of my
> > apps stopped working now..

Also, if you don't have time to follow the django-developers list, or
at least check http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges
before running svn up, you really shouldn't follow svn trunk for
awhile. There are going to be a lot of backwards incompatible changes
before the next release. If there is a spot on the django site that
led you to think otherwise, please let us know so we can warn others
:)

Joseph

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms.clean_data vs. newforms.cleanED_data

2007-05-15 Thread Malcolm Tredinnick

On Tue, 2007-05-15 at 23:43 -0400, cornelius bolten wrote:
> hi,
> 
> i just tried to click through my new website (django 0.97) after 
> developing it on my localhost (django latest stable).
> 
> all my websites' forms (newforms) worked well on my localhost.. but 
> online i got lot's of errors.
> 
> after some searching, i found out that newforms.clean_data changed to 
> newforms.cleaned_data. when did this change happen, and why? a lot of my 
> apps stopped working now..

Maybe you want to read this thread on this mailing list (from less than
two days ago):

http://groups.google.com/group/django-users/browse_thread/thread/d681ddf8c7b57f4b/fc7a25e2648a504b#fc7a25e2648a504b

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms.clean_data vs. newforms.cleanED_data

2007-05-15 Thread cornelius bolten

alright! makes sense..

canen schrieb:
> This changed was committed yesterday.  See here
> http://groups.google.com/group/django-developers/browse_thread/thread/c87a893a4d7c50a0/32f777bafd3cdb35#32f777bafd3cdb35
> for the discussion that lead to the change.
> 
> On May 15, 10:43 pm, cornelius bolten <[EMAIL PROTECTED]> wrote:
>> hi,
>>
>> i just tried to click through my new website (django 0.97) after
>> developing it on my localhost (django latest stable).
>>
>> all my websites' forms (newforms) worked well on my localhost.. but
>> online i got lot's of errors.
>>
>> after some searching, i found out that newforms.clean_data changed to
>> newforms.cleaned_data. when did this change happen, and why? a lot of my
>> apps stopped working now..
>>
>> cornelius
> 
> 
> > 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms.clean_data vs. newforms.cleanED_data

2007-05-15 Thread canen

This changed was committed yesterday.  See here
http://groups.google.com/group/django-developers/browse_thread/thread/c87a893a4d7c50a0/32f777bafd3cdb35#32f777bafd3cdb35
for the discussion that lead to the change.

On May 15, 10:43 pm, cornelius bolten <[EMAIL PROTECTED]> wrote:
> hi,
>
> i just tried to click through my new website (django 0.97) after
> developing it on my localhost (django latest stable).
>
> all my websites' forms (newforms) worked well on my localhost.. but
> online i got lot's of errors.
>
> after some searching, i found out that newforms.clean_data changed to
> newforms.cleaned_data. when did this change happen, and why? a lot of my
> apps stopped working now..
>
> cornelius


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: MySQLdb Error

2007-05-15 Thread Steve

I forgot to mention...

Syncdb was working yesterday when I first ran it. I have added some
django.contrib applications to my settings.py, which I have since
removed in an effort to try to figure out if that was causing the
problem. Sadly, it didn't fix the problem, and that's the only thing
that's changed since my last successful run of syncdb.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



MySQLdb Error

2007-05-15 Thread Steve

When trying to perform a syncdb I get the following error:

Traceback (most recent call last):
  File "./manage.py", line 11, in 
execute_manager(settings)
  File "/usr/local/lib/python2.5/site-packages/django/core/
management.py", line 1674, in execute_manager
execute_from_command_line(action_mapping, argv)
  File "/usr/local/lib/python2.5/site-packages/django/core/
management.py", line 1573, in execute_from_command_line
action_mapping[action](int(options.verbosity),
options.interactive)
  File "/usr/local/lib/python2.5/site-packages/django/core/
management.py", line 468, in syncdb
from django.db import connection, transaction, models,
get_creation_module
  File "/usr/local/lib/python2.5/site-packages/django/db/__init__.py",
line 11, in 
backend = __import__('django.db.backends.%s.base' %
settings.DATABASE_ENGINE, {}, {}, [''])
  File "/usr/local/lib/python2.5/site-packages/django/db/backends/
mysql/base.py", line 12, in 
raise ImproperlyConfigured, "Error loading MySQLdb module: %s" % e
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
module: dlopen(/tmp/.egg-cache/MySQL_python-1.2.2-py2.5-macosx-10.3-
i386.egg-tmp/_mysql.so, 2): image not found


Any ideas on what to do?


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



Re: More info in Django server logs

2007-05-15 Thread Kostadin Cholakov

Hi

We are using the development server only! Can you give me some
reference for the necessary changes in the code? Thanks!

On 5/15/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
> On Tue, 2007-05-15 at 19:14 +, Kostadin Cholakov wrote:
> > Hello,
> >
> > We are currently using Django for access to a linguistic database
> > where people can validate certain entries by checking certain
> > checkboxes! We have the problem that the users are not in our
> > departament and they are connected to Internet through a different
> > proxy server. When the annotators check boxes and go to the next page
> > and then again go back, the boxes are not checked anymore. We tried to
> > reproduce this error with different browsers but we were not able to
> > do this! So, we susspect that their server caches some pages and when
> > the annotators go back to a previous page, it doesn't invoke GET to
> > get a fresh page with the updated entries and checkboxes but rather
> > their server takes the original cached page! We would like to see
> > which machine exactly accesses our database and see what kind of
> > request it makes... But the log files just show the URL which is being
> > used, the time and POST or GET... Is there any way that one could
> > retrieve more information like IP for example? I am new to Django and
> > I was not able to find something on this issue! Thanks!
>
> It depends on what web server you are using. Every web server has ways
> to configure what information is logged.
>
> If you are just using the development server, then you're out of luck
> without changing the code.
>
> Regards,
> Malcolm
>
>
>
> >
>


-- 
Kostadin Cholakov, B.A.
Software developer
DFKI GmbH, Language Technology Lab,
Stuhlsatzenhausweg 3,
D-66123 Saarbruecken, Germany

---

Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Strasse 122, D-67663 Kaiserslautern

Geschaeftsfuehrung:
Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster (Vorsitzender)
Dr. Walter Olthoff

Vorsitzender des Aufsichtsrats:
Prof. Dr. h.c. Hans A. Aukes

Amtsgericht Kaiserslautern, HRB 2313

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: dictionary lookup in template within regroup tag

2007-05-15 Thread Malcolm Tredinnick

On Tue, 2007-05-15 at 20:40 +, cesco wrote:
> Hi,
> 
> I'm trying to render a template using a generic view of the
> list_detail type. The list of objects I'm trying to render in the
> template (which are offers) have an original_price and a
> discounted_price and I'd like to display also the relative discount
> (that is: (original_price-discounted_price)/original_price). For this
> I'm passing a dictionary to the extra_context dictionary of the
> generic view with offer.id as key and the relative discount as value.
> 
> Now in the template I have the following code where I'd like to access
> the relative discount which is in the offers_discount dictionary. The
> problem is due to the grouping I cannot use the for loop to iterate
> over the dictionary. The way I'd like to do it would be as shown below
> {{ offers_discount.{{offer.id}} }} but of course it doesn't work.

I can't see how to resuscitate this approach, but a simpler solution
would be to put a get_discount() method on the model that returns the
computed value. Then it's just an attribute access in the template.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: More info in Django server logs

2007-05-15 Thread Malcolm Tredinnick

On Tue, 2007-05-15 at 19:14 +, Kostadin Cholakov wrote:
> Hello,
> 
> We are currently using Django for access to a linguistic database
> where people can validate certain entries by checking certain
> checkboxes! We have the problem that the users are not in our
> departament and they are connected to Internet through a different
> proxy server. When the annotators check boxes and go to the next page
> and then again go back, the boxes are not checked anymore. We tried to
> reproduce this error with different browsers but we were not able to
> do this! So, we susspect that their server caches some pages and when
> the annotators go back to a previous page, it doesn't invoke GET to
> get a fresh page with the updated entries and checkboxes but rather
> their server takes the original cached page! We would like to see
> which machine exactly accesses our database and see what kind of
> request it makes... But the log files just show the URL which is being
> used, the time and POST or GET... Is there any way that one could
> retrieve more information like IP for example? I am new to Django and
> I was not able to find something on this issue! Thanks!

It depends on what web server you are using. Every web server has ways
to configure what information is logged.

If you are just using the development server, then you're out of luck
without changing the code.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Pickle model fields

2007-05-15 Thread Malcolm Tredinnick

On Tue, 2007-05-15 at 13:59 -0700, [EMAIL PROTECTED] wrote:
> Someone /has/ to be doing this. I've got a dictionary, that I want to
> pickle and store in a field in one of my Model classes. What is the
> optimal solution for this situation? All the solutions I can think of
> equate to jiggery-hacky and having to know if the field is in the
> pickled or unpickled state.

One  solution would be that the model field only stores the pickled
value. Then you have a property or method on the model that returns the
unpickled value (since properties can have getters and setters, you can
use this to store new values as well). You wouldn't have to unpickle the
value every time it's accessed, either: you could store the unpickled
value in a cache attribute on the model and invalidate or update it
every time the setter changes the field value.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



More info in Django server logs

2007-05-15 Thread Kostadin Cholakov

Hello

We are currently using Django to annotate linguistic data. The
annotators can reject oder conferm a certain entry by checking the
corresponding checkbox. The problem is that when they do this for a
certain page and go to the next one and then again go back, the
checkboxes are no longer checked!!! The entries themselves are
correctly updated in the data base... After logout/login the
annotators are able to see the changes they made, so the boxes are
checked correctly... We tried to reproduce this error in different
browsers but we were not able to do it- for us everything worked
correctly! The annotators are from another departament and they
conntect to Internet via their own proxy server. So, we susspect that
somehow their server caches pages and when they change something and
go forward and backward, intstead of sending a new request and showing
the changed page, the server just takes the original page from the
cache... We want to do some experiments to check this... I would like
to ask you how one can see more info in the log files- now there is
information about the pages being accessed, the time and whether  GET
or POST was used... Is there some say to include information about the
IP which accessed the data base for example? I am new to Django and I
was not able to find anything in the documentation! 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django [was "vps"] hosting

2007-05-15 Thread Tim Chase

As folks are giving their opinions regarding Django-hosting, I'm 
in the market for some fairly inexpensive hosting service. 
Django-friendliness is a big plus.  I spent a weekend recently 
doing a bit of research on the providers listed at

http://code.djangoproject.com/wiki/DjangoFriendlyWebHosts

and currently have site5.com and thinkhost.com at the top of my 
list (in that order, as site5 is about $1/mo cheaper).

I really just want basic SSH access, Django (and static-files), 
some DB (don't care whether PostgreSQL, MySQL, or even just 
sqlite, as long as it works with Django) and IMAP/SMTP.  Access 
to svn/hg and rsync would be handy.

I don't need a full VPS.  And don't expect high volumes of 
traffic (mostly for personal development projects and for a 
collaboration point with friends and family)

Does anyone on the list have positive or negative experiences 
with either Site5.com or ThinkHost.com you'd be willing to share?

Thanks,

-tim






--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Pickle model fields

2007-05-15 Thread [EMAIL PROTECTED]

Someone /has/ to be doing this. I've got a dictionary, that I want to
pickle and store in a field in one of my Model classes. What is the
optimal solution for this situation? All the solutions I can think of
equate to jiggery-hacky and having to know if the field is in the
pickled or unpickled state.

Any thoughts out there?

--Lucki


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



More info in Django server logs

2007-05-15 Thread Kostadin Cholakov

Hello,

We are currently using Django for access to a linguistic database
where people can validate certain entries by checking certain
checkboxes! We have the problem that the users are not in our
departament and they are connected to Internet through a different
proxy server. When the annotators check boxes and go to the next page
and then again go back, the boxes are not checked anymore. We tried to
reproduce this error with different browsers but we were not able to
do this! So, we susspect that their server caches some pages and when
the annotators go back to a previous page, it doesn't invoke GET to
get a fresh page with the updated entries and checkboxes but rather
their server takes the original cached page! We would like to see
which machine exactly accesses our database and see what kind of
request it makes... But the log files just show the URL which is being
used, the time and POST or GET... Is there any way that one could
retrieve more information like IP for example? I am new to Django and
I was not able to find something on this issue! 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



dictionary lookup in template within regroup tag

2007-05-15 Thread cesco

Hi,

I'm trying to render a template using a generic view of the
list_detail type. The list of objects I'm trying to render in the
template (which are offers) have an original_price and a
discounted_price and I'd like to display also the relative discount
(that is: (original_price-discounted_price)/original_price). For this
I'm passing a dictionary to the extra_context dictionary of the
generic view with offer.id as key and the relative discount as value.

Now in the template I have the following code where I'd like to access
the relative discount which is in the offers_discount dictionary. The
problem is due to the grouping I cannot use the for loop to iterate
over the dictionary. The way I'd like to do it would be as shown below
{{ offers_discount.{{offer.id}} }} but of course it doesn't work.

{% regroup offers_list by category as grouped %}

{% for group in grouped %}
{{ group.grouper }}

{% for offer in group.list %}


offer name: {{ offer.name }} | offer discount:
{{ offers_discount.{{offer.id}} }}.


{% endfor %}


{% endfor %}


The other related discussions on this newsgroup (dictionary lookup in
templates) don't consider the case of grouping where we can't iterate
over the dictionary in the classical way.

Do you have any suggestion on how to solve this problem?

Thanks a lot
Francesco


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



databrowse + admin

2007-05-15 Thread wildg

The new databrowse application is pretty slick.  Obviously still a
work in progress, but already useful.

About a month ago there was a feature request for adding a new 'view'
permission to the default 'add', 'change', and 'delete' permissions in
admin.  The response was don't use admin to view data, use databrowse.

Is there any plan to integrate databrowse into admin and add an
additional default 'view' permission?

admin allows for very easy editing, but doesn't crawl through the data
very well, whereas databrowse crawls through the data well, but
doesn't allow editing.  It would be great to have their strengths
combined into one browsing / editing application.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Quick Query Question

2007-05-15 Thread Jeremy Dunck

On 5/15/07, Collin Anderson <[EMAIL PROTECTED]> wrote:
> class Laptop(models.Model):
> def laptops_out_on(date):
> 'get a list of laptops out on a given day'
> result = Laptop.objects.none()
> for x in Rental.objects.filter(checkout__lte=date,
> checkin__gte=date):
> result = result | x.laptops.all()
> return result
> laptops_out_on = staticmethod(laptops_out_on)

Why not get the list of active rentals (1 query) then get the list of
laptops associated with those rentals?

Also, make it a manager method rather than a static method.

class LaptopManager(models.Manager):
   def checked_out(self, date=None):
  if date is None:
 import datetime
 date = datetime.date.today()
  active_rental_ids = [rental['id'] for rental in
Rental.objects.filter(checkout__gte=date,
checkin_lte=date).values('id')]
  qs = super(LaptopManager, self).get_query_set().
  return qs.filter(rental__id__in=active_rental_ids)

class Laptops(models.Model):
  objects = LaptopManager()


#get all checked out laptops today:
Laptops.objects.checked_out()

...Code not tested since I can't sandbox a project and DB quickly just now.

More:
http://www.djangoproject.com/documentation/db-api/#lookups-that-span-relationships

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django vps hosting

2007-05-15 Thread Brian Luft

I've been using WebFaction and have been happy with it so far.  The
plan I'm using is actually a shared hosting plan.  While you do share
an OS instance with others, you still get shell access.  They have a
slick control panel that makes it easy to drop in various frameworks
and applications (eg. Django, Rails, Wordpress, SVN, Trac...).  If you
need full control over your environment it probably won't be for you.
I like focusing on actual application development so I think they
provide an excellent playground if you just want to get something up
and running w/o worrying about configuring all the usual services.

On May 15, 10:21 am, Doug Van Horn <[EMAIL PROTECTED]> wrote:
> I use rimuhosting.com.  I'm pretty sure they have a Data Center in
> London, so that might be the right up your alley.
>
> I'm in St. Louis, where Slicehost is located, but they have a
> ridiculous waiting list.  So I can't even try them out.
>
> I've been happy with Rimu, though.
>
> doug.
>
> On May 15, 10:12 am, urielka <[EMAIL PROTECTED]> wrote:
>
> > I am running two django sites with vpsland(good support) for the last
> > 7 days, but since i having problems with their ssh(running really
> > slow) i thinking about switching to other host.
>
> > Is there any good vps hosting? it probably be better if it is in
> > Europe for lower latency.
>
> > thx,
> > Uriel


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Maintainance Middleware

2007-05-15 Thread Jeremy Dunck

On 5/15/07, Christian M Hoeppner <[EMAIL PROTECTED]> wrote:
...
> Of course, this would work, but it also prevents users not logged in from
> logging in. Is there a way to check if the user is accessing the login view,
> in order to let him access his account and the site being under maintenance?

You're more likely to get working code if all the requirements are stated.  :)

Set these settings:
LOGIN_REDIRECT_URL
LOGIN_URL
LOGOUT_URL

Then the middleware would be:

class MaintenanceMiddleware(object):
 def process_request(self, request):
   from django.conf import settings
   from django.http import HttpResponseRedirect


   is_login = request.path in (
 settings.LOGIN_REDIRECT_URL,
 settings.LOGIN_URL,
 settings.LOGOUT_URL)
   if ((not is_login) and
   settings.MAINTENANCE and
   (not request.user.is_authenticated())):
  return HttpResponseRedirect("/maintenance/")
   return None

More:
http://www.djangoproject.com/documentation/request_response/#attributes
http://www.djangoproject.com/documentation/settings/#login-redirect-url

Note that those settings are new in the Django dev version (after
0.96).  Of course you could add them to your own settings file, same
as MAINTENANCE.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django vps hosting

2007-05-15 Thread urielka

yeha i really liked SliceHost they have the best prices but the
waiting list is more than ridiculous,if they have such a big waiting
list i would expect from them to make their data center bigger.
i am staying right now with vpsland,they are really great and the ssh
turn out to be a problem with my isp,which still isn`t fixed but using
other connection i get really fast access.

i can recommend vpsland to anybody,even that the problem was mine they
tried everything to fix it,even changed my server to other network and
answer in a matter of minutes.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Quick Query Question

2007-05-15 Thread Collin Anderson

I am working with a laptop rental program, and I was wondering if
there is a better way to do this lookup. This works fine, but it seems
like it could be better.

from django.db import models

class Laptop(models.Model):
def laptops_out_on(date):
'get a list of laptops out on a given day'
result = Laptop.objects.none()
for x in Rental.objects.filter(checkout__lte=date,
checkin__gte=date):
result = result | x.laptops.all()
return result
laptops_out_on = staticmethod(laptops_out_on)

class Rental(models.Model):
checkout = models.DateField(blank=True)
checkin = models.DateField(blank=True)
laptops = models.ManyToManyField(Laptop, blank=True)

Thanks,
Collin


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: OR lookups across related tables

2007-05-15 Thread Jiri Barton

That is actually the same :-) However neither

Author.objects.filter( Q(name='Jiri Barton') |
Q(article__title__icontains='revealed'))

works. :-(


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: SQLite - unsupported file format

2007-05-15 Thread Panos Laganakos

I haven't installed any pysqlite versions since I moved to 2.5 (from
OS X's default 2.3) Python, as sqlite3 is included in the lib module
by default.

I uploaded the db on the production server though, and sqlite3 client:
3.3.5 seems to open the file just fine. So as you mentioned it must be
a type mismatch? I'll if I can an updated binary of SQLite3 > 3.1.3
for OS X.

On May 15, 1:47 pm, Lars Stavholm <[EMAIL PROTECTED]> wrote:
> Panos Laganakos wrote:
> > OS: Mac OS X - 10.4
> > SQLite: 3.1.3
> > Django: 0.96
> > Python: 2.5
>
> > I've set the DATABASE_ENGINE to 'sqlite3', and the db gets created
> > when I call
>
> > $manage.py syncdb
>
> > And the project/apps all work fine.
>
> > When I try to connect to it from the commandline 'sqlite3' tool, or
> > pipe manage.py clearsql [appname], etc. I get an 'error: unsupported
> > file format', when I try to execute any statement or view tables etc.
>
> > Same thing happens if I try to pipe output into sqlite3, ie:
>
> > $manage.py sqlclear [appname] | sqlite3 my.db
>
> > Can't figure out what seems to be the problem here.
>
> Version mismatch maybe? Try sqlite/sqlite2 on the created db.
> If that works, the db is sqlite version 2.
> What version of python sqlite bindings are you using?
> I have the following and it works just great:
>
> SuSE Linux 10.2
> sqlite 3.3.8
> Django from SVN a week ago.
> Python 2.5
> pysqlite 2.3.2
>
> Cheers
> /Lars


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: where to "listen" for backwards incompatible changes in trunk?

2007-05-15 Thread waylan



On May 14, 2:18 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> You should be keeping an eye on this wiki page if you are using the
> absolutely latest subversion 
> code:http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges
>
> There is no RSS feed on a per-page level in the wiki, but if you wanted
> that you could subscribe to a feed for just the wiki page changes on the
> timeline page (you can configure which changes you want to receive from
> the timeline page) and then use something like Yahoo pipes to extract
> out the information you wanted from that feed.
>

For anyone who is interested, I built a pipe for this. You can find it
here:
http://pipes.yahoo.com/pipes/pipe.info?_id=HsTZGAkD3BG7VhBkl7okhQ

I could create a few more if other's think they'll be used. Just tell
me what pages you think are important to follow.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Maintainance Middleware

2007-05-15 Thread Christian M Hoeppner

> Something like this (i didn't check if this code works):
>
> from django.conf import settings
> from django.http import HttpResponseRedirect
>
> class MaintenanceMiddleware(object):
>  def process_request(self, request):
>  if settings.MAINTENANCE:
>  if not request.user.is_authenticated():
>  return HttpResponseRedirect('/maintenance/')
>  return None
>
> Put this middleware after AuthenticationMiddleware in the settings.py

Of course, this would work, but it also prevents users not logged in from 
logging in. Is there a way to check if the user is accessing the login view, 
in order to let him access his account and the site being under maintenance?

Thanks,
Chris Hoeppner
www.pixware.org

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django vps hosting

2007-05-15 Thread Doug Van Horn

I use rimuhosting.com.  I'm pretty sure they have a Data Center in
London, so that might be the right up your alley.

I'm in St. Louis, where Slicehost is located, but they have a
ridiculous waiting list.  So I can't even try them out.

I've been happy with Rimu, though.


doug.


On May 15, 10:12 am, urielka <[EMAIL PROTECTED]> wrote:
> I am running two django sites with vpsland(good support) for the last
> 7 days, but since i having problems with their ssh(running really
> slow) i thinking about switching to other host.
>
> Is there any good vps hosting? it probably be better if it is in
> Europe for lower latency.
>
> thx,
> Uriel


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Maintainance Middleware

2007-05-15 Thread [EMAIL PROTECTED]

> Hi there!
> 
> How would one handle the following tasks in a middleware?
> 
> If a settings called "MAINTENANCE" is true, check if the user is logged in. 
> If 
> he is, let him view the requested page normally. If not, redirect to 
> maintenance page.
> 
> If setting is false, show page normally despite user logged in or not.
> 
> It's a way to show unauthorised users an "under construction" page while the 
> maintenance settings is set to true.
> 
> Can anyone give me some advice, or perhaps point me to someone who already 
> solved this task?
> 
Something like this (i didn't check if this code works):

from django.conf import settings
from django.http import HttpResponseRedirect

class MaintenanceMiddleware(object):
 def process_request(self, request):
 if settings.MAINTENANCE:
 if not request.user.is_authenticated():
 return HttpResponseRedirect('/maintenance/')
 return None

Put this middleware after AuthenticationMiddleware in the settings.py

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to change the encoding from UTF-8 to something else ?

2007-05-15 Thread [EMAIL PROTECTED]


Yes Atilla, the setting's variable must be :

DEFAULT_CHARSET = 'UTF-8'


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: OR lookups across related tables

2007-05-15 Thread Wolfram Kriesing

just quickly skimming over, did you mean?

Author.objects.filter( Q(name='Jiri Barton') |
Q(article__title__icontains='revealed'))

On 5/15/07, Jiri Barton <[EMAIL PROTECTED]> wrote:
>
> Hi, why does not the following work?
>
> My simple model:
>
> class Author(models.Model):
> name = models.CharField(maxlength=255)
>
> def __str__(self):
> return self.name
>
> class Article(models.Model):
> author = models.ForeignKey(Author)
> title = models.CharField(maxlength=255)
>
> def __str__(self):
> return self.name
>
> Now, onto the action:
>
> --
>
> In [10]: Author.objects.create(name='Jiri Barton')
>
> In [11]: Author.objects.filter(name='Jiri Barton')
> Out[11]: []
>
> In [12]: Author.objects.filter(name='Jiri Barton') |
> Author.objects.filter(article__title__icontains='revealed')
> Out[12]: []
>
> -
>
> The database contains one row in the Author table. That's it.
>
> One would believe that Out[12] should be the same as Out[11]. This is
> very confusing. Adding an OR condition should never shrink the set.
>
> BTW, here is the SQL behind the scenes:
>
> SELECT `press_author`.`id`,`press_author`.`name` FROM `press_author`
> INNER JOIN `press_article` AS `press_author__article` ON
> `press_author`.`id` = `press_author__article`.`author_id` WHERE
> ((`press_author`.`name` = 'Jiri Barton') OR
> (`press_author__article`.`title` LIKE '%revealed%'))
>
> Is there another way I can phrase the query?
> TIA,
> Jiri
>
>
> >
>


-- 
cu

Wolfram

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Tricky context question

2007-05-15 Thread Aidas Bendoraitis

This should help you to solve almost all your multilingual problems:
http://www.djangosnippets.org/snippets/51/

Regards,
Aidas Bendoraitis aka Archatas


On 5/15/07, Wolfram Kriesing <[EMAIL PROTECTED]> wrote:
>
> I have a bi-language (english and german) site. I try to hide the
> multi language part as best as I can from the programmer, by
> encapsulating it as best as I can in the model.
> An example:
>
> class Tag(models.Model):
>name_en = models.SlugField()
>name_de = models.SlugField()
>
>@property
>def name(self):
>"Return the name depending on the users language"
>if user_language=="en": # how can i get user_language?
>return self.name_en
>else:
>return self.name_de
>
> This would allow me to use the Tag-model anywhere without knowing the
> user's language, by accessing the property "name" and it handles the
> language stuff.
> This is a very much simplified example of what I actually need.
> It shows that inside a template I could simply write:
> {{ tag.name }}
> and get the proper translation.
>
> The problem:
> Here is the problem I don't get "user_language" without having access
> to the request! :-(
>
>
> The simple example above would solve small translation tasks, but I
> have another model, that has some more complex translation logic. I
> constructed this by using DB-views, and creating models that map
> directly to appropriate view.
> To demonstrate this:
> class DataEnglish(models.Model):
>  id = 
>  title = 
>  abstract = .
>  class Meta:
>  db_table = "core_dataenglishview"
>
> class DataGerman(models.Model):
>  id = 
>  title = 
>  abstract = .
>  class Meta:
>  db_table = "core_datagermanview"
>
> To abstract the language stuff, I would like to only access a model
> called "Data" which in turn maps to "DataGerman" for a german user and
> to "DataEnglish" to an english user. Unfortunately I only have access
> to the language via django.utils.translation.get_language_from_request
> when I have the request available.
> But I would like to use:
>  Data.objects.all()
>  Data.objects.filter()
> inside my code, without worrying about the language setting in the
> place where I read from the objects (of course for updating the
> objects I have to use DataGerman or DataEnglish explicitly, and I do).
>
> How can I achieve this in a clean way, without passsing the request
> around every time?
>
>
> My hacky solution:
> Write a middleware, that sets some "global" variable i.e. in
> settings.current_language and use this as language. That would work
> since every request has its thread/process that is running in apache,
> but that seems quite dirty.
>
> Any ideas? Or have my thoughts been going a completely wrong way?
>
> --
> cu
>
> Wolfram
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Maintainance Middleware

2007-05-15 Thread Jeremy Dunck

On 5/15/07, Christian M Hoeppner <[EMAIL PROTECTED]> wrote:
>
> Hi there!
>
> How would one handle the following tasks in a middleware?

Put this somewhere in your app:
==
class MaintenanceMiddleware(object):
  def process_request(self, request):
from django.conf import settings
from django.http import HttpResponseRedirect

if settings.MAINTENANCE and not request.user.is_authenticated()
   return HttpResponseRedirect("/maintenance/")
return None

===

Then add that to your MIDDLEWARE_CLASSES list; make sure it's after
AuthenticationMiddleware so that request.user exists.

Request middleware short-circuits the request cycle if it returns a
HttpResponse instance.

More:
http://www.djangoproject.com/documentation/middleware/#process-request

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



formulaic row-permissions + django

2007-05-15 Thread Bram - Smartelectronix

hey guys,


I was wondering if anyone has ever does a formulaic permissions thing in 
django.

something where you can define user permissions for certain actions, 
depending on the various attributes of an object. Think something like:

def can_view(user):

if self.is_private and self.owner.preferences.friends_can_see_private:
return True
else:
if user in self.owner.blacklist:
return False

etc etc etc. But this in a generic way for multiple actions (view, edit, 
comment, favorite, ...). The idea being that with many users it's 
impossible to store this kind of information in the database.

If anyone has *any* hints (as vague as u like) on how to do this, help 
would be greatly appreciated.


  - bram

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django-l10n-Portuguese

2007-05-15 Thread Alexandre Klostermann
I would like to announce a Brazilian initiative on creating a task force
(read: Brazilian Django Community [1]) to translate django's documentation
to portuguese in a official manner.*

To do it we created the django-l10n-portuguese group in google.groups [2],
and linked all portuguese translations in [3] to our site on google groups
to concentrate the translations.

The question is, what should we do to make this activity official in
Django?

By the way, this email is also to let Django users and developers to know
our intentions.

Thanks.

Please reply just to me, do not reply to the group.

[1] - http://groups.google.com/group/django-brasil
[2] - http://groups.google.com/group/django-l10n-portuguese
[3] - http://code.djangoproject.com/wiki/TranslateDocumentation

-- 
Alexandre Martins Klostermann
--
[EMAIL PROTECTED]
http://xaeroworld.org - My World
http://imotion-info.com/projects - Imotion-Info Projects
Linux User: 436047

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Maintainance Middleware

2007-05-15 Thread Christian M Hoeppner

Hi there!

How would one handle the following tasks in a middleware?

If a settings called "MAINTENANCE" is true, check if the user is logged in. If 
he is, let him view the requested page normally. If not, redirect to 
maintenance page.

If setting is false, show page normally despite user logged in or not.

It's a way to show unauthorised users an "under construction" page while the 
maintenance settings is set to true.

Can anyone give me some advice, or perhaps point me to someone who already 
solved this task?

Thanks,
Chris Hoeppner
www.pixware.org

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to change the encoding from UTF-8 to something else ?

2007-05-15 Thread Atilla

On 15/05/07, Martin Tomov <[EMAIL PROTECTED]> wrote:
>
> http://code.djangoproject.com/ticket/72
>
> About this tichet. The last question is mine.
>
> How to change the encoding, sent by the HTTP headers to something
> else, but UTF-8 ? The meta thing in the html is useless.
>
> Thanks

This ticket is 2 years old and was marked as fixed.

What version are you using and have you set the encoding variable in
your settings file correctly ? The HTTP headers that are sent in my
applications are correct and do include the correct encoding in the
Content-Type header. I am running with code checked out from SVN
around a month ago.

The meta tag in the actual HTML is not useless, but it's
interpretation is dependant on the browser. Generally, when no
encoding information is specified for the document the browser will
either "guess" it (IE) or assume a default value. If it encounters the
correct meta tag, it will re-parse the document using the encoding
specified in there. This is the behavior for every reasonable browser,
but the "correct" thing to do is to always have a proper HTTP header,
specifying the encoding.

Also - what is wrong with UTF-8 and why do you want to change it ?

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Can't connect to MySQL

2007-05-15 Thread Mark Phillips


On May 14, 2007, at 10:37 AM, badger17 wrote:

> Are the port and host settings correct in
> settings.py ?

In settings.py I had the host as "127.0.0.1". I changed that to an  
empty string, and the connection succeeded.

Thanks,

  - Mark

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to change the encoding from UTF-8 to something else ?

2007-05-15 Thread Martin Tomov

http://code.djangoproject.com/ticket/72

About this tichet. The last question is mine.

How to change the encoding, sent by the HTTP headers to something
else, but UTF-8 ? The meta thing in the html is useless.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



OR lookups across related tables

2007-05-15 Thread Jiri Barton

Hi, why does not the following work?

My simple model:

class Author(models.Model):
name = models.CharField(maxlength=255)

def __str__(self):
return self.name

class Article(models.Model):
author = models.ForeignKey(Author)
title = models.CharField(maxlength=255)

def __str__(self):
return self.name

Now, onto the action:

--

In [10]: Author.objects.create(name='Jiri Barton')

In [11]: Author.objects.filter(name='Jiri Barton')
Out[11]: []

In [12]: Author.objects.filter(name='Jiri Barton') |
Author.objects.filter(article__title__icontains='revealed')
Out[12]: []

-

The database contains one row in the Author table. That's it.

One would believe that Out[12] should be the same as Out[11]. This is
very confusing. Adding an OR condition should never shrink the set.

BTW, here is the SQL behind the scenes:

SELECT `press_author`.`id`,`press_author`.`name` FROM `press_author`
INNER JOIN `press_article` AS `press_author__article` ON
`press_author`.`id` = `press_author__article`.`author_id` WHERE
((`press_author`.`name` = 'Jiri Barton') OR
(`press_author__article`.`title` LIKE '%revealed%'))

Is there another way I can phrase the query?
TIA,
Jiri


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Tricky context question

2007-05-15 Thread Wolfram Kriesing

I have a bi-language (english and german) site. I try to hide the
multi language part as best as I can from the programmer, by
encapsulating it as best as I can in the model.
An example:

class Tag(models.Model):
   name_en = models.SlugField()
   name_de = models.SlugField()

   @property
   def name(self):
   "Return the name depending on the users language"
   if user_language=="en": # how can i get user_language?
   return self.name_en
   else:
   return self.name_de

This would allow me to use the Tag-model anywhere without knowing the
user's language, by accessing the property "name" and it handles the
language stuff.
This is a very much simplified example of what I actually need.
It shows that inside a template I could simply write:
{{ tag.name }}
and get the proper translation.

The problem:
Here is the problem I don't get "user_language" without having access
to the request! :-(


The simple example above would solve small translation tasks, but I
have another model, that has some more complex translation logic. I
constructed this by using DB-views, and creating models that map
directly to appropriate view.
To demonstrate this:
class DataEnglish(models.Model):
 id = 
 title = 
 abstract = .
 class Meta:
 db_table = "core_dataenglishview"

class DataGerman(models.Model):
 id = 
 title = 
 abstract = .
 class Meta:
 db_table = "core_datagermanview"

To abstract the language stuff, I would like to only access a model
called "Data" which in turn maps to "DataGerman" for a german user and
to "DataEnglish" to an english user. Unfortunately I only have access
to the language via django.utils.translation.get_language_from_request
when I have the request available.
But I would like to use:
 Data.objects.all()
 Data.objects.filter()
inside my code, without worrying about the language setting in the
place where I read from the objects (of course for updating the
objects I have to use DataGerman or DataEnglish explicitly, and I do).

How can I achieve this in a clean way, without passsing the request
around every time?


My hacky solution:
Write a middleware, that sets some "global" variable i.e. in
settings.current_language and use this as language. That would work
since every request has its thread/process that is running in apache,
but that seems quite dirty.

Any ideas? Or have my thoughts been going a completely wrong way?

-- 
cu

Wolfram

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Fwd: COOl Summer - Thumbnails to large image

2007-05-15 Thread Kooooool forwords
  [image: COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

[image:
COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

[image:
COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

*cool-summer-vacation13*
1600 X 1200
*cool-summer-vacation14*
1600 X 1200
*cool-summer-vacation15*
1600 X 1200
 [image: COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

[image:
COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

[image:
COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

*cool-summer-vacation16*
1600 X 1200
*cool-summer-vacation17*
1600 X 1200
*cool-summer-vacation18*
1600 X 1200

 [image: COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

[image:
COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

[image:
COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

*cool-summer-vacation1*
1600 X 1200
*cool-summer-vacation10*
1600 X 1200
*cool-summer-vacation100*
1600 X 1200
 [image: COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

[image:
COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

[image:
COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

*cool-summer-vacation101*
1600 X 1200
*cool-summer-vacation102*
1600 X 1200
*cool-summer-vacation103*
1600 X 1200
 [image: COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

[image:
COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

[image:
COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

*cool-summer-vacation104*
1600 X 1200
*cool-summer-vacation105*
1600 X 1200
*cool-summer-vacation106*
1600 X 1200
 [image: COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

[image:
COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

[image:
COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

*cool-summer-vacation107*
1600 X 1200
*cool-summer-vacation108*
1600 X 1200
*cool-summer-vacation109*
1600 X 1200

 [image: COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

[image:
COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

[image:
COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

*cool-summer-vacation11*
1600 X 1200
*cool-summer-vacation110*
1600 X 1200
*cool-summer-vacation111*
1600 X 1200
 [image: COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

[image:
COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

[image:
COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

*cool-summer-vacation112*
1600 X 1200
*cool-summer-vacation113*
1600 X 1200
*cool-summer-vacation114*
1600 X 1200
 [image: COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

[image:
COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

[image:
COOL STUFF , BE COOL , WATER GARDEN , WATER PARK]

*cool-summer-vacation115*
1600 X 1200

Re: django vps hosting

2007-05-15 Thread Adam Fast
I've been pleased with SliceHost.


On 5/15/07, urielka <[EMAIL PROTECTED]> wrote:
>
>
> I am running two django sites with vpsland(good support) for the last
> 7 days, but since i having problems with their ssh(running really
> slow) i thinking about switching to other host.
>
> Is there any good vps hosting? it probably be better if it is in
> Europe for lower latency.
>
> thx,
> Uriel
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django vps hosting

2007-05-15 Thread david

It's not in Europe, but I've been using RimuHosting since December or so, and 
they've been great.  The connection is fast, downtime is minimal, and their 
responses to support questions are always prompt.

On Tue, 15 May 2007 15:12:24 -, urielka <[EMAIL PROTECTED]> wrote:
> 
> I am running two django sites with vpsland(good support) for the last
> 7 days, but since i having problems with their ssh(running really
> slow) i thinking about switching to other host.
> 
> Is there any good vps hosting? it probably be better if it is in
> Europe for lower latency.
> 
> thx,
> Uriel
> 
> 
> 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django vps hosting

2007-05-15 Thread urielka

I am running two django sites with vpsland(good support) for the last
7 days, but since i having problems with their ssh(running really
slow) i thinking about switching to other host.

Is there any good vps hosting? it probably be better if it is in
Europe for lower latency.

thx,
Uriel


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ImportError: No module named mysite.settings

2007-05-15 Thread Mark Phillips


On May 14, 2007, at 7:41 AM, ilDave wrote:

> Check the permissions of the directory where your app lives, it has to
> be readable by the webserver.

Good suggestion. I think it is root:wheel 755 but I will check.

  - Mark

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Can't connect to MySQL

2007-05-15 Thread Mark Phillips

On May 14, 2007, at 10:37 AM, badger17 wrote:
> It looks as if python is not even able to connect to the database. Is
> MySQL definately running? Are the port and host settings correct in
> settings.py ?

Yes, I agree. Python cannot connect to the database.

MySQL is running, I can access it via command line and phpMyAdmin. I  
believe the settings are correct but I will double check the  
settings.py when the coffee begins its wonderful task in my grey matter.

Mark



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: problem with file download?

2007-05-15 Thread Bob Dively

On May 14, 5:16 pm, Bob Dively <[EMAIL PROTECTED]> wrote:

> The file is sent to the browser (Firefox), which understands the
> mimetype correctly and hands the file off to Excel. However, Excel
> says that the file is in an unrecognized format. When I open the file
> with Excel, it's garbled. The text file is a known good file. Any
> ideas?

The problem turned out to be Windows' differentiation between binary
and text files. Once I explicitly opened the file in binary mode,
everything worked fine:

fullpath = os.path.join('C:/', 'text.xls')
handle = file(fullpath, 'rb')
filecontents = handle.read()
handle.close()
response = HttpResponse(filecontents, mimetype='application/
vnd.ms-excel')
response['Content-disposition'] = 'Attachment; filename=extract.xls'
return response


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Style with newforms

2007-05-15 Thread Tipan

Thanks James, that worked a treat.

I did have a go at the CSS method before, but clearly couldn't do it
at the lowest level. Moving up to the form tag did the trick.
Simple really.
Tim


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Model subclassing

2007-05-15 Thread anders conbere

On 5/15/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
> On Mon, 2007-05-14 at 16:13 -0700, Joe wrote:
> > I was wondering what the status of this is? I know that it broke a
> > while back with the introduction of magic object removal, and has been
> > in the pipeline since. I just tested it out on my recent SVN checkout,
> > and it seemed to create the tables in the database in the way that one
> > would expect. However I am scared to start using it in case something
> > goes awry with the model managers or some other eventuality.
> > Is it safe to use?
>
> It completely doesn't work. You will end with the wrong managers on the
> sub-classed models. Please be patient a little longer and use one-to-one
> relations in the interim.

Are one-to-one's recommend again now? (last time I looked they were
recommending foreignkeys with unique=True instead)

~ Anders

>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Summon specific filter on related object from Django template

2007-05-15 Thread Vertigo

Bureaucrat James Bennett, you are technically correct -- the best kind
of correct! :-)
Thanks for bringing me this new approach. I like it that way.

As for guidelines, I tend to follow them even when I do not grasp the
good reason behind. Following guidelines would have avoided my
department to live on a trapped PHP spaghetti website that I am trying
to revive 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Style with newforms

2007-05-15 Thread James Bennett

On 5/15/07, Tipan <[EMAIL PROTECTED]> wrote:
> When rendered to the template, it produces a bullet point alongside
> each radio button.

In your template -- not in Python code -- add an HTML 'id' to your
form, and then put a rule like this in your site's stylesheet:

#my_form_id ul li {
list-style-type: none;
}

This has the advantage of keeping your style information separated out.

-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Summon specific filter on related object from Django template

2007-05-15 Thread Vertigo

Hi,

Here is my problem, summarized by this web page:
I would like to display only the public documents of a given project
(not the private ones).
Class Document has a ForeignKey field on class Project, and a
BooleanField (is_public).

My condition is: I just pass the Project object to my template.
Now how can I display only the public documents in that template?

I could build a custom method (get_public_documents) on model Project.
But the documentation suggests that model methods are 'row-level'
oriented.
Custom manager methods would be more appropriate, I guess, but I do
not know where to start, and how to call it in my web page.

Can you please give me clues about the most Django-esque way to do
this?
Truth is, I am going to reuse that filter many times.

Thanks for your enlightment!


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Style with newforms

2007-05-15 Thread Tipan

I've a form containing a field with radio buttons that accept a Yes/No
response from the user, the field definition is:

disp_resp = forms.ChoiceField(choices=[(True,'Yes'),
(False,'No')],widget=forms.RadioSelect(), initial=False)

When rendered to the template, it produces a bullet point alongside
each radio button.

I'm having some difficulty removing this. The field is called in the
template as: {{ form.disp_resp }}

I've seen in the regression tests some use of attr={} to the widget,
but I'm not clear on what I should pass to this.

Can anyone suggest how I can pass a style parameter to the form
sub_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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: order of fields in a newform

2007-05-15 Thread Bram - Smartelectronix

Malcolm Tredinnick wrote:
>> Is there any way to explicitly order fields?
> 
> This is one of those cases where reading the newforms source is going to
> be the best way to work out the answers. It shouldn't be too hard for
> anybody who wants this kind of depth to trace through what is going on.
> 
> If you have a look in newforms.forms.Form, you can see it uses
> DeclarativeFieldsMetaclass.__new__ to set up the fields (in the
> base_field attribute) and that is a SortedDict. Then BaseForm.__init__
> makes a copy of base_fields for you to modify if you wish and it is
> iterated over a dictionary in other places.
> 
> So you would need to make the fields attribute be a new copy of a
> SortedDict with the fields in the order you want, probably using
> fields.items() and then SortedDictFromList.

Aha! Thanks... I've made a snippet :-)
http://www.djangosnippets.org/snippets/237/


class ContactForm(forms.Form):
 to = forms.ModelChoiceField(ContactEmail.objects.all())
 message = forms.CharField(widget=forms.Textarea(attrs={'rows': 10, 
'cols': 50}))

 def __init__(self, user, *args, **kwargs):
 super(ContactForm, self).__init__(*args, **kwargs)

 # user isn't logged in, so ask him for an email
 from_field = forms.EmailField()

 if not user.is_anonymous():
 from_field.widget = forms.HiddenInput
 from_field.initial = user.email

 # insert the field at the start of the fields
 new_fields = self.fields.items()
 new_fields.insert(0, ('from', from_field))
 self.fields = SortedDictFromList(new_fields)


  - bram

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: order of fields in a newform

2007-05-15 Thread Malcolm Tredinnick

On Tue, 2007-05-15 at 13:18 +0200, Bram - Smartelectronix wrote:
> Hey everyone,
> 
> 
> How do I change the order of the fields in a newform:
> 
> class ContactForm(forms.Form):
>to = forms.ModelChoiceField(ContactEmail.objects.all())
>message = forms.CharField(widget=forms.Textarea())
> 
>def __init__(self, user, *args, **kwargs):
>  super(ContactForm, self).__init__(*args, **kwargs)
> 
>  # user isn't logged in, ask him for his email!
>  if user.is_anonymous():
>self.fields['from'] = forms.EmailField()
>  else:
>self.fields['from'] = forms.EmailField(widget=forms.HiddenInput, 
> initial=user.email)
> 
> Cool, but I would like to see this as:
> 
> From:
> To:
> Message:
> 
> Is there any way to explicitly order fields?

This is one of those cases where reading the newforms source is going to
be the best way to work out the answers. It shouldn't be too hard for
anybody who wants this kind of depth to trace through what is going on.

If you have a look in newforms.forms.Form, you can see it uses
DeclarativeFieldsMetaclass.__new__ to set up the fields (in the
base_field attribute) and that is a SortedDict. Then BaseForm.__init__
makes a copy of base_fields for you to modify if you wish and it is
iterated over a dictionary in other places.

So you would need to make the fields attribute be a new copy of a
SortedDict with the fields in the order you want, probably using
fields.items() and then SortedDictFromList.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



order of fields in a newform

2007-05-15 Thread Bram - Smartelectronix

Hey everyone,


How do I change the order of the fields in a newform:

class ContactForm(forms.Form):
   to = forms.ModelChoiceField(ContactEmail.objects.all())
   message = forms.CharField(widget=forms.Textarea())

   def __init__(self, user, *args, **kwargs):
 super(ContactForm, self).__init__(*args, **kwargs)

 # user isn't logged in, ask him for his email!
 if user.is_anonymous():
   self.fields['from'] = forms.EmailField()
 else:
   self.fields['from'] = forms.EmailField(widget=forms.HiddenInput, 
initial=user.email)

Cool, but I would like to see this as:

From:
To:
Message:

Is there any way to explicitly order fields?


  - bram

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: SQLite - unsupported file format

2007-05-15 Thread Lars Stavholm

Panos Laganakos wrote:
> OS: Mac OS X - 10.4
> SQLite: 3.1.3
> Django: 0.96
> Python: 2.5
> 
> I've set the DATABASE_ENGINE to 'sqlite3', and the db gets created
> when I call
> 
> $manage.py syncdb
> 
> And the project/apps all work fine.
> 
> When I try to connect to it from the commandline 'sqlite3' tool, or
> pipe manage.py clearsql [appname], etc. I get an 'error: unsupported
> file format', when I try to execute any statement or view tables etc.
> 
> Same thing happens if I try to pipe output into sqlite3, ie:
> 
> $manage.py sqlclear [appname] | sqlite3 my.db
> 
> 
> Can't figure out what seems to be the problem here.

Version mismatch maybe? Try sqlite/sqlite2 on the created db.
If that works, the db is sqlite version 2.
What version of python sqlite bindings are you using?
I have the following and it works just great:

SuSE Linux 10.2
sqlite 3.3.8
Django from SVN a week ago.
Python 2.5
pysqlite 2.3.2

Cheers
/Lars

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django users in London want to meet up for beers?

2007-05-15 Thread IT Recruiter

Ideally looking for Django, but
as work involves python can train Django if strong in programming.

Thanks


On 15 May, 09:54, Nic James Ferrier <[EMAIL PROTECTED]>
wrote:
> To talk django and python?
>
> Anyone?
>
> --
> Nic Ferrierhttp://www.tapsellferrier.co.uk 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



SQLite - unsupported file format

2007-05-15 Thread Panos Laganakos

OS: Mac OS X - 10.4
SQLite: 3.1.3
Django: 0.96
Python: 2.5

I've set the DATABASE_ENGINE to 'sqlite3', and the db gets created
when I call

$manage.py syncdb

And the project/apps all work fine.

When I try to connect to it from the commandline 'sqlite3' tool, or
pipe manage.py clearsql [appname], etc. I get an 'error: unsupported
file format', when I try to execute any statement or view tables etc.

Same thing happens if I try to pipe output into sqlite3, ie:

$manage.py sqlclear [appname] | sqlite3 my.db


Can't figure out what seems to be the problem here.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: assertRedirects

2007-05-15 Thread Jiri Barton

> Redirecting to a GET with data is a fairly eclectic edge case, and I
> can't say I'm a huge fan of an assertion statement modifying the
> variables it is asserting.

I have but to agree with both statements. Let's leave it the way it
is.

> I'm inclined to put this in the 'not a common use case' basket. If you
> need to test this sort of thing, you can always write your own
> modified redirect assertion that suits your purposes.

I won't do that because I feel now too, my URL pattern space is poor
in this aspect.

Thank you for discussing this!
Jiri


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Model subclassing

2007-05-15 Thread Malcolm Tredinnick

On Mon, 2007-05-14 at 16:13 -0700, Joe wrote:
> I was wondering what the status of this is? I know that it broke a
> while back with the introduction of magic object removal, and has been
> in the pipeline since. I just tested it out on my recent SVN checkout,
> and it seemed to create the tables in the database in the way that one
> would expect. However I am scared to start using it in case something
> goes awry with the model managers or some other eventuality.
> Is it safe to use?

It completely doesn't work. You will end with the wrong managers on the
sub-classed models. Please be patient a little longer and use one-to-one
relations in the interim.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Cannot resolve keyword '___' into field

2007-05-15 Thread Malcolm Tredinnick

On Tue, 2007-05-15 at 16:54 +1000, Mark Jarecki wrote:
> The temporary fix that I've employed at the moment is e.g.:
> 
> 
> Instead of 
> 
> 
> > > osIcons =
> > > product.productOSIcons.filter(isPublished=True).order_by('osIconName')
> 
> 
> I've got:
> 
> 
> icons = ProductOSIcons.objects.filter(isPublished=True)
> osIcons2 = []
> for icon in icons:
> if Products.objects.filter(id=product.id, productOSIcons=icon,
> isPublished=True):
> osIcons2.append(icon)
> 
> 
> Which is a REALLY ugly solution, but hopefully I wont have to use it
> for too long.

As the ticket you found suggests, we're aware of the problem and I think
we understand the latest reason it's not working (middleware is
introducing an extra curve-ball for some reason). Fixing it is very hard
because the problem is so non-reproducible. It's quite likely that
somebody running your exact code on a different machine or with a
different version of Python will not be able to reproduce the problem. 

At the moment, I'm probably the most likely person to end up fixing
this. However all my free time for Django is taken at the moment on some
other items, so all I can encourage people who find these problems to do
is try to shuffle things around a little, as you've done, in the hope of
finding a workaround.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



***great chance to earn money!***

2007-05-15 Thread James

My name is James Cai from China.And I would like to say I've find some
good ways to make business ( trade related ).If you are
interested,please offer your email address,so that I can send a plan
of it to you.Hope you will be my partner!!
My E-mail:[EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: FLV Video Uploader in Django

2007-05-15 Thread Pythoni

Can you please let us know more about the traffic?
I understand that you can upload one file of 100Mb +  at one time but
do you have experience with heavy uploads?
L.



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django users in London want to meet up for beers?

2007-05-15 Thread Nic James Ferrier

To talk django and python?

Anyone?

-- 
Nic Ferrier
http://www.tapsellferrier.co.uk   

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Free django hosting

2007-05-15 Thread Seamus

Is there any free webhosts out there which support 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



View this page "Urgently looking for Python with Django Developers - London"

2007-05-15 Thread IT Recruiter



Click on 
http://groups.google.co.uk/group/django-users/web/urgently-looking-for-python-with-django-developers---london?hl=en
- or copy & paste it into your browser's address bar if that doesn't
work.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Discussion on urgently-looking-for-python-with-django-developers---london

2007-05-15 Thread IT Recruiter

At this momentum its permanent position.

Thanks for your interest, Cheers srini


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Help with limit_choices_to

2007-05-15 Thread xgdlm

> At the moment, the easiest way I see to to that is to include a JS
> file that will catch the current member_id, then call an external page
> that will return a JSON string  of
> "Folder.objects.filter(member=member) " query_set and then build the
> wished multiselected box .. I'll try that way :p
>

FYI I did implement this limit choice to with ajax and javascript and
this is working well.

Item Folder Many-to-Many relationship is now define as (wich shown
coma separated id if no JS)

Folder = models.ManyToManyField(Folder,raw_id_admin=True,blank=True)

then I use a JS file and 2 ajax request to rebuild a multiselect
box :)

xav


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Broken pipes with HttpResponseRedirect and Firefox / Trouble in paradise

2007-05-15 Thread veged

So, in my case the problem was in extension WebDeveloperToolbar and
his setting "Disable cache". When caches disabled firefox really
brokes pipe.

On May 14, 11:35 pm, veged <[EMAIL PROTECTED]> wrote:
> I have same problem with broken pipe and Firefox 2.0 (on MacOSX). But
> i have it in very simple project without HttpResponseRedirect.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Admin custom widget

2007-05-15 Thread Jens Werner

Hi everybody,

I'm creating a new widget/template for my admin interface
(image_with_thumbnail.html for
nesh.thumbnail.field.ImageWithThumbnailField).
For the moment it works fine, if I put the image_with_thumbnail.html
in django/contrib/admin/templates/widget, but I don't want patch the
django-package.
How can I integrate a customed/new widget in my own project(-path)
(simular the admin-templates)?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



  1   2   >