Use django's models without running web server

2007-05-07 Thread hoamon

Because i can't find related post here, so i post this example. maybe
someone else need.

Some times, you just want to use the useful models of django without
thinking any sql statement.
Maybe you want to run a script to know which user's birthday in your
database is today,
this little job should not run in the view.py.  It should run in the
cron table of linux os every day,
so that your users can receive birthday card from your system.

this example is so easy, all you know is loading the settings.py
correctly.
Your script must place in your project's directory.

script example:

#!/usr/bin/env python
# -*- coding: utf8 -*-

import settings
from django.core.management import setup_environ
setup_environ(settings)
# before do something else,
# the three lines above here is your first operation.

from django.db.models import get_model
from datetime import date

if __name__ == '__main__':

# the 'tmp' is your project's name,
# and this script must place in the 'tmp' directory.
# the 'person' is your model's name.
Person = get_model('tmp', 'person')

# when you get the model,
# you can use it just like you use it in the view.py
P = Person(name='hoamon', birth=date(1977, 10, 18))
P.save()

for p in Person.objects.all():
if p.birth == date(1977, 10, 18):
print p.name

for p in Person.objects.filter(birth=date(1977, 10, 18)):
print p.name

now you can put /somepath/tmp/birthday.py in the cron table.


--~--~-~--~~~---~--~~
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 specify name for ForeignKey field?

2007-05-07 Thread Russell Keith-Magee

On 5/8/07, Suraj <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I am trying to use a legacy database in Django. The application
> has read only access to this database. This database contains
> ForeignKey fields which don't fit Django's format of _id.
> Is there any way to specify the ForeignKey fields name?

Yes: use the db_column attribute on your ForeignKey definition. For example:

   myref = models.ForeignKey(OtherModel, db_column='foo')

will use 'foo', rather than 'myref_id' as the column name

> Will same problem occur for ManyToMany fields? I have not started
> creating models of those tables yet. But the database has it's own
> naming convention for relationship tables used for holding ManyToMany
> fields.

The same problem will exist, but at present, there is only a partial solution.

You can specify an alternate name for the m2m table using the db_table
argument; however, the column names on this table cannot currently be
modified.

If you're feeling enthusiastic, a fix to overcome this limitation
would be accepted, and shouldn't be too difficult to write. Look at
django.db.models.field.related.ManyToManyField, follow the lead of the
_get_m2m_db_table(), and modify the _get_m2m_column_name() and
_get_m2m_reverse_name() methods. Don't forget to include plenty of
unit tests to validate your behaviour :-)

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: How to specify name for ForeignKey field?

2007-05-07 Thread Kenneth Gonsalves


On 08-May-07, at 11:45 AM, Suraj wrote:

>I am trying to use a legacy database in Django. The application
> has read only access to this database. This database contains
> ForeignKey fields which don't fit Django's format of _id.
> Is there any way to specify the ForeignKey fields name?

if you specify your own primary key in a table, django uses that and  
doesnt generate an id field. And it is this field that is referred to  
by the foreign key and m2m references

-- 

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



How to specify name for ForeignKey field?

2007-05-07 Thread Suraj

Hi,
I am trying to use a legacy database in Django. The application
has read only access to this database. This database contains
ForeignKey fields which don't fit Django's format of _id.
Is there any way to specify the ForeignKey fields name?
Will same problem occur for ManyToMany fields? I have not started
creating models of those tables yet. But the database has it's own
naming convention for relationship tables used for holding ManyToMany
fields.
Thanks & Regards,
Suraj


--~--~-~--~~~---~--~~
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: In Admininterface: Error: variable not passed into template?

2007-05-07 Thread Michael Lake

Hi all

A while ago I had a problem as described below. I found the solution so am 
posting it 
here in case others have the same prob in future.

The "Error: variable not passed into template?" was appearing where the 
headings for 
the table showing the contents of the Data model should have been - but there 
were no 
headings. So it was the headings i.e. the field names of the model that were 
not 
being passed into the template.
(The text of "Error: variable not passed into template?" comes from 
TEMPLATE_STRING_IF_INVALID in my settings file.)

Notice in my Class I had experiment_id and node_id, particularly they have _id 
at the 
end. This is what caused the problem. If instead of this:
   Class Admin:
   pass

I have:

   Class Admin:
   list_display('id', 'experiment_id', 'node_id', 'content')

Then in admin the Data table show the correct headings and there is no errors.
 ID  Experiment id   Node id   Content

Hence it appears that in a model that if one has fields with _id in their name 
there 
are problems.

Michael Lake wrote:
> Hi all
> 
> In the Admin interface I'm getting the folloing error for a model:
> Error: variable not passed into template?>Data
> 
> class Data(models.Model):
>   experiment_id = models.CharField(maxlength=10)
>   node_id   = models.CharField(maxlength=10)
>   content = models.TextField(blank=True)
> 
>   class Meta:
>   verbose_name_plural = 'Data'
> 
>   class Admin:
>   pass
> 
> The Admin interface is not showing the columns of the table but just a list 
> like this:
>   Data object
>   Data object ...
> 
> I can add a row or delete a row and I can edit the rows using the admin 
> interface.
> I can't see whats wrong with this particular model.
> manage syncdb runs with no errors and manage.py validate says 0 errors.
> In models.py the other models display fine in the Admin interface.
> 
> Mike


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



Images being overridden

2007-05-07 Thread robo

Hi everyone,

I've encountered a problem where, in my admin, when I upload an image,
I get another slot to upload, but once I upload, the new image
replaces the original image I created. I tried searching for a
solution to this, but to no avail. Can someone explain to me why this
happens and how I can fix this?

My model is:

class Project(models.Model):
  pict = models.ImageField(upload_to='images/')
  title = models.CharField(maxlength=50)
  overview = models.TextField()

  class Admin:
list_display = ('title', 'overview',)

class Picture(models.Model):
  project = models.ForeignKey(Project, edit_inline=models.TABULAR)
  picture = models.ImageField(upload_to='images/')
  caption = models.CharField(maxlength=50)

Also, it would be great if you guys could show me a more efficient way
to do this: for each project, I would like to more than 10 pictures
and a caption associated with each picture. Then I want to display it
2 by 2. I passed to my template the context proj
(get_object_or_404(Project, id=object_id)) and pict
(get_object_or_404(Picture, id=object_id)). In my template, I wrote a
for loop that'd display images like so:


  
{% for picture in proj.picture_set.all %}
  

{{pict.caption}}
  
  {% ifequal forloop.counter 2 %}

  {% endifequal %}
{% endfor %}
  


As you can see, I want to end the table row everytime the
forloop.counter is even, but I cannot write code for this is a .html
template file, so I have to temporarily settle for this fix. That's 1
problem, the other is that only one caption gets displayed for all
images shown, and I can see why because pict.caption never iterates.
How can I display images along with their distinct caption?

Thank you in advance,

robo.


--~--~-~--~~~---~--~~
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 "DataCentrica Advanced IT Technologies Pvt. Ltd."

2007-05-07 Thread zalu



Click on 
http://groups.google.com/group/django-users/web/datacentrica-advanced-it-technologies-pvt-ltd?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
-~--~~~~--~~--~--~---



Re: Is that possible to use DISTINCT with get_list?

2007-05-07 Thread Russell Keith-Magee

On 5/7/07, Pythoni <[EMAIL PROTECTED]> wrote:
>
> I need to find distinct records form my `discussions` table.
> I can use
> discussions.get_values(fields=['Subject'],order_by=['Pub_date'],distinct=True)
>
> and it works. But I would like to find  distinct records  with
> get_list not with get_values, because i need to sent the results to
> paginator,
>
> Is that possible to use DISTINCT with get_list?

I have a vague recollection that it is possible, but I could be very
wrong. I haven't used the 0.91 DB-api in over 18 months.

As a warning - the pre-0.95, pre-magic-removal APIs are very much
deprecated. You're going to find it increasingly difficult to get
answers to questions.

Relatively few people in the Django community have ever used the
pre-magic-removal APIs, and even less will remember how to use them.
The only bugs that will be fixed are critical data-loss inducing bugs;
there certainly won't be any feature improvements to that API.

I realise that it is inconvenient, but it would be well worth the
effort to invest a little time in porting your code over to the new
API.

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: Newform and File Upload problem

2007-05-07 Thread scadink

File uploads haven't been completed in newforms.  It's not a great
situation, but that's what happens with software that's currently in
development.

What I did in my view that worked:

p = Picture()
p.title = clean_data['title']
p.save_image_file(image['filename'], image['content'])

Basically, the relevant part is the save_blank_file (where blank is
the name of the part of the model to be saved).

Hopefully this will work for you!
Sean.

On May 7, 3:11 pm, guillaume <[EMAIL PROTECTED]> wrote:
> 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.
>
> Yours,
> Guillaume.
>
> Le lundi 07 mai 2007 ? 08:41 -0700, [EMAIL PROTECTED] a ?crit :
>
> > Hello everybody.
>
> > I am a Django newbie experimenting with some stuff. I am very
> > impressed by the framework, that made me want to learn more about it.
> > I am trying to do some file upload but I have a problem.
> > I tried many information sources but could not find a simple example
> > of what I am trying to do. I have a few question...
>
> > Well, It should be very simple, I just want to upload a file on the
> > server on the MEDIA directory.
> > I use the up to date SVN version ( 5156 ).
>
> > I put sipets of code below, the things I dont anderstand are:
> > * The {{form.updateFile_file}} tag produces nothing the first time I
> > load my page. Is it normal behavior?
>
> > * The validation raises an AttributeError with message: 'dict' object
> > has no attribute 'startswith'
> > The lower part of the stack is :
> > /home/guillaume/dev/Python/django_src/django/db/models/fields/
> > __init__.py in isWithinMediaRoot
> >  628.  # If the raw path is passed in, validate it's under the
> > MEDIA_ROOT.
> >  629. def isWithinMediaRoot(field_data, all_data):
>
> >  630. f = os.path.abspath(os.path.join(settings.MEDIA_ROOT,
> > field_data)) ...
>
> >  631. if not
> > f.startswith(os.path.abspath(os.path.normpath(settings.MEDIA_ROOT))):
> >  632. raise validators.ValidationError, _("Enter a valid filename.")
>
> > * If I disable the validation, I have an error because Django tries to
> > insert the file data into the database as a string...
>
> > Well I probably missed something very simple, but I cannot figure
> > it ...
>
> > Might a Django Guru engilten me ?
>
> > Yours,
> > Guillaume.
>
> > 
>
> > My model :
>
> > #-
> > class StockUpdateFile( models.Model ):
>
> > updateFile  = models.FileField( upload_to = 'updatefiles/%Y/%m/
> > %d' )
> > fdate   = models.DateField( auto_now_add = True )
>
> > def __str__( self ):
> > return "file %1-%2-%3" % str( distributor ) % str( fdate ) %
> > str( updateFile )
>
> > class Admin:
> > pass
>
> > --
> > The form is:
>
> > class UploadForm( forms.Form ):
> > updateFile = forms.Field( widget = forms.FileInput() )
>
> > 
> > My template is:
>
> >  > method="post" >
>
> >   
> >   {{form.updateFile}}:{{form.updateFile_file}}
> >   
> >   
> > 
>
> > -
> > And the code handling the form is:
>
> > def uploadFile(request, template='uploadfile.html' ):
>
> > errors = {}
>
> > form = UploadForm()
>
> > if( request.FILES ):
>
> > manip = StockUpdateFile.AddManipulator()
> > newData = request.POST.copy()
> > newData.update( request.FILES )
>
> > errors = manip.get_validation_errors( newData )
>
> > if( not errors):
>
> > manip.do_html2python( newData )
> > newFile = manip.save( newData )
> > else:
> > form = UploadForm()
>
> > return render_to_response( template,
> >context_instance =
> > RequestContext( request, {'form': form,
>
> > 'errors' : errors } ))


--~--~-~--~~~---~--~~
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: Creating extensible views ?

2007-05-07 Thread Russell Keith-Magee

On 5/8/07, kahless <[EMAIL PROTECTED]> wrote:
>
> i guess the signal API would be one possibility ? to simply send out
> specific signals like 'render_profile' and 'post_profile' where
> multiple application could listen to and respond accordingly ?

You can do what you want using a combination of Python's class
introspection functions and Django's model index
(django.db.models.get_app(), get_model(), etc).

Define a setting that specifies the name of the class that provides
the UserProfile model, then when you need to reference the UserProfile
model, load it dynamically using __import__.

You can take a similar approach for any utility method supporting the
UserProfile - say, a factory for generating a UserProfile form. Define
an interface, put the name of the factory method in a setting, and
dynamically load the function as required.

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: How do you get at a RadioFieldRenderer object from a template? (newforms)

2007-05-07 Thread Joseph Heck

Interesting solution Bill! Thanks for sharing! I'll see if I can't
make that mechanism work for me...

Malcolm's response was also great in detail, and now I think I need to
digest some and see how I can use it, and if there's a good generic
solution for me.

-joe

On 5/7/07, Bill Fenner <[EMAIL PROTECTED]> wrote:
>
> I did this with an accessor function in the form class:
>
> class NonWgStep1(forms.Form):
> add_edit = forms.ChoiceField(choices=(
> ('add', 'Add a new entry'),
> ('edit', 'Modify an existing entry'),
> ('delete', 'Delete an existing entry'),
> ), widget=forms.RadioSelect)
> def add_edit_fields(self):
> field = self['add_edit']
> return field.as_widget(field.field.widget)
>
> Then in the template, I can use form.add_edit_fields.0, etc.
>
> I am using this in the (probably not uncommon) case of having other
> form elements that go with each radio button (e.g., "modify" has a
> ChoiceField of things to modify next to it).
>
>   Bill
>
> >
>

--~--~-~--~~~---~--~~
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 do you get at a RadioFieldRenderer object from a template? (newforms)

2007-05-07 Thread Bill Fenner

I did this with an accessor function in the form class:

class NonWgStep1(forms.Form):
add_edit = forms.ChoiceField(choices=(
('add', 'Add a new entry'),
('edit', 'Modify an existing entry'),
('delete', 'Delete an existing entry'),
), widget=forms.RadioSelect)
def add_edit_fields(self):
field = self['add_edit']
return field.as_widget(field.field.widget)

Then in the template, I can use form.add_edit_fields.0, etc.

I am using this in the (probably not uncommon) case of having other
form elements that go with each radio button (e.g., "modify" has a
ChoiceField of things to modify next to it).

  Bill

--~--~-~--~~~---~--~~
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: migrating 400 images

2007-05-07 Thread Nate Straz

On Mon, May 07, 2007 at 05:14:16PM -, Milan Andric wrote:
> Wow, interact() is very cool.  Now I just need to find write one that
> does a similar thing with html body and the local img srcs recursively
> on files within a directory.  Is there a library that parses html
> pages, I'm sure there is, but one that you recommend?

There is one in the Python Standard Library[1], but I haven't used it.
Perhaps someone else on the list has.

Nate

[1] http://docs.python.org/lib/module-HTMLParser.html

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



override get_next_by_FOO() / get_previous_by_FOO()

2007-05-07 Thread roderikk

Hi all,

I have recently started with django and have been able to do good work
with the excellent documentation. Thank you.

However, now I am a little baffled. I have created a gallery app. The
model exists of a Gallery and Photo which has a foreign key to the
Gallery.

Now if I want to use the function photo.get_next_by_date in a template
and there is a photo in another gallery which has that next date it
will return that photo instead of the next one in the gallery.

In my view there are a number of things I could do but I would like to
hear from you which is best...

First of all, if possible can I overwrite the get_next_by_FOO()
function so it checks that the gallery is the same, but how?

Second, I could create a page function in my Photo model as such:

def page(self):
photo_list = [x for x in self.gallery.photo_set.all()]
ind = photo_list.index(self)
return ind + 1

And create a new template tag 'get_next_by_page' which checks for the
page/index.

Finally, in the template, which is fed with and object_list, I could
also try to go back in the for loop (again, don't know how) and just
get the previous/next objects in the list like so:

{% for photo in object_list %}
{% if has_next %}
{# nextPhoto is object_list[currentCounter + 1 ] ? #}
{% endif %}
{% endfor %}

I hope someone can help me. Thanks in advance. Roderik


--~--~-~--~~~---~--~~
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: Creating extensible views ?

2007-05-07 Thread Steven Armstrong

kahless wrote on 05/07/07 23:02:
> Hi,
> I've found documentation on how to make applications to work together
> smoothly .. but is there also some documentation on how i could make
> an application (or views of an application) extensible..
> 
> For example like in eclipse having "extension points" where 3rd party
> applications could hook into .. and extend the original
> functionality ..
> in specific i need this (e.g.) for a user profile view.. my project
> consists of multiple applications and i want them all to be
> independent .. and also have personal settings on their own..
> so i would have a community application which is responsible for
> registration & co .. and would also allow the user to change his
> profile and edit settings.. but what if i want to make it easily
> possible for my wiki and board applications to contribute additional
> settings to this view ? is there any django specific way to do
> something like it, or any thoughts on how i could implement a generic
> interface for such a problem ?
> 
> i guess the signal API would be one possibility ? to simply send out
> specific signals like 'render_profile' and 'post_profile' where
> multiple application could listen to and respond accordingly ?
> 
> i don't expect that there is any ready-to-use solution out there, so i
> would welcome any thoughts on that ;) ..
> 

Hi

I've found the following [1] a good starting point for similar 
functionality in some of my projects. Check out the file 
/trac/core.py.

[1] http://trac.edgewall.org/wiki/TracDev/ComponentArchitecture

cheers
Steven

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



DB error when sorting by a column in the generated admin

2007-05-07 Thread Hancock, David (DHANCOCK)
Django 0.96, Python 2.4, Linux, development webserver

I have a with clicking certain column headings for sorting in the contrib
Admin lists. I think I brought this on myself. The class reseller below used
to be simply a CHOICES list, but that got unwieldy, so I created the class
and gave fuel_release a foreign key to it. I also recreated the table
fuel_release so it has ids to the reseller table where the reseller names
used to be. It all seems to be working OK except that if I click on the
'reseller' column in the admin listing for fuel_releases, I get a MySQL
error:

(1054, "Unknown column 'fuel_reseller.reseller_id' in 'order clause'")

To recreate the tables and populate with ids instead of strings, I saved the
table data, edited it, dropped the tables, and did a syncdb.

I'll be grateful for any ideas you've got. Thanks, and
Cheers!
-- 
David Hancock | [EMAIL PROTECTED]


Here is some relevant model code:

class reseller(models.Model):
reseller = models.CharField(maxlength=30)
def __str__(self):
return self.reseller
class Admin:
pass
class Meta:
ordering = ['reseller',]

class fuel_release(models.Model):
tail = models.CharField(maxlength=10, blank=True)
iata = models.CharField('IATA', maxlength=4, blank=True)
...
reseller = models.ForeignKey(reseller, default=1,)
...
class Meta:
ordering = ['-release_datetime', 'company', 'tail',]
class Admin:
list_display = ['tail', 'iata', 'reseller', 'fbo', 'eta_date',
'quoted_gallons',]
list_filter = ['eta_date',]
search_fields = ['tail', 'iata',]

And in case it's helpful, here's the output from sqlall:

BEGIN;
CREATE TABLE `fuel_fuel_release` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`company_id` integer NOT NULL REFERENCES `trips_company` (`id`),
`tail` varchar(10) NOT NULL,
`iata` varchar(4) NOT NULL,
`eta_date` date NOT NULL,
`arinc_invoice_number` varchar(20) NOT NULL,
`actual_gallons` integer NULL,
`actual_cost` numeric(5, 2) NULL,
`actual_price` numeric(5, 2) NULL,
`retail_price` numeric(5, 2) NULL,
`comments` longtext NOT NULL,
`quoted_gallons` integer NULL,
`quoted_cost` numeric(5, 2) NULL,
`quoted_price` numeric(5, 2) NULL,
`reseller_id` integer NOT NULL,
`reseller_invoice_number` varchar(30) NOT NULL,
`reseller_invoice_date` date NOT NULL,
`reseller_order_number` varchar(20) NOT NULL,
`fbo` varchar(100) NOT NULL,
`margin_per_gallon` numeric(4, 3) NULL,
`revenue` numeric(8, 2) NULL,
`margin_percentage` integer NULL,
`margin_dollars` numeric(8, 2) NULL,
`rebate_per_gallon` numeric(4, 2) NULL,
`rebate_dollars` numeric(8, 2) NULL,
`release_datetime` datetime NOT NULL
);
CREATE TABLE `fuel_reseller` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`reseller` varchar(30) NOT NULL
);
ALTER TABLE `fuel_fuel_release` ADD CONSTRAINT reseller_id_refs_id_78d693b
FOREIGN KEY (`reseller_id`) REFERENCES `fuel_reseller` (`id`);
CREATE INDEX fuel_fuel_release_company_id ON `fuel_fuel_release`
(`company_id`);
CREATE INDEX fuel_fuel_release_reseller_id ON `fuel_fuel_release`
(`reseller_id`);
COMMIT;



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



Creating extensible views ?

2007-05-07 Thread kahless

Hi,
I've found documentation on how to make applications to work together
smoothly .. but is there also some documentation on how i could make
an application (or views of an application) extensible..

For example like in eclipse having "extension points" where 3rd party
applications could hook into .. and extend the original
functionality ..
in specific i need this (e.g.) for a user profile view.. my project
consists of multiple applications and i want them all to be
independent .. and also have personal settings on their own..
so i would have a community application which is responsible for
registration & co .. and would also allow the user to change his
profile and edit settings.. but what if i want to make it easily
possible for my wiki and board applications to contribute additional
settings to this view ? is there any django specific way to do
something like it, or any thoughts on how i could implement a generic
interface for such a problem ?

i guess the signal API would be one possibility ? to simply send out
specific signals like 'render_profile' and 'post_profile' where
multiple application could listen to and respond accordingly ?

i don't expect that there is any ready-to-use solution out there, so i
would welcome any thoughts on that ;) ..

thanks,
  herbert
  http://sct.sphene.net - Sphene Community Tools


--~--~-~--~~~---~--~~
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: Upgrade from Python 2.4 to 2.5

2007-05-07 Thread Sam Morris

On Mon, 07 May 2007 09:19:58 -0700, RollyF wrote:

> I am using fedora 6 distribution which comes with Python 2.4.3. I then
> installed Python 2.5.1 and re-installed the  packages I needed for my
> application. I verified that at the terminal, when I typed in "python",
> what's loaded is Python 2.5. I am runnign apache2 and mod_python. I
> recompiled and installed mod_python to python 2.5. When I run my
> application, it's coming back with:
>
> ...
>
> How do I configure Apache2 or mod_python to use Python 2.5?

The packages that Fedora provide will use the system's python 2.4 
libraries and modules. To change this, you will need to rebuild 
mod_python against your python2.5 installation. There are many ways to go 
about this, someone more familiar with Fedora might be able to help you 
with the specifics, but broadly:

 1. Remove the existing package of mod_python that is installed
 2. Grab the mod_python sources from 
 3. Follow the installation instructions at . Make sure you tell mod_python's 
configure script where to find your local installation of python2.5 by 
using an option like: --with-python=/usr/local/bin/python.

-- 
Sam Morris
http://robots.org.uk/

PGP key id 1024D/5EA01078
3412 EA18 1277 354B 991B  C869 B219 7FDB 5EA0 1078


--~--~-~--~~~---~--~~
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: Need some help with Amazon S3

2007-05-07 Thread Frédéric Sidler
i'm currently playing with amazon EC2 and S3 for data and ressources.
I found that Adrian Holovty used S3 for chicagocrime.org
http://www.holovaty.com/blog/archive/2006/04/07/0927/?highlight=s3

2007/5/7, Kyle Fox <[EMAIL PROTECTED]>:
>
>
> 1)  We found S3 to be a bit slow, both upstream and down.  Upstream is
> slow largely because of the SOAP overhead (from what I understand),
> and we were sending lots of data (about 5 resized images for each
> image uploaded to django).  Downstream, well, not much you can do
> about that, regardless of how you set up you models.  We simply stored
> the image's S3 key in the database, and used that when constructing
> get_absolute_url().
>
> 2) I'm not sure you can do this.  When you say you want to have a
> connection with the service, are you referring to a connection using
> the S3 python library?  I'm not sure how you would create a global,
> persistant connection to S3, which is what I assume you want.  We
> simple made a wrapper class around S3, and added a add_to_bucket()
> function to our user's profile model that used the S3 wrapper class.
> Again, this seemed reasonably fast, the bottleneck was not around
> managing the connection to S3, but the actual upload to S3 itself.
>
> Kyle.
>
>
> >
>

--~--~-~--~~~---~--~~
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: Upgrade from Python 2.4 to 2.5

2007-05-07 Thread Greg Donald

On 5/7/07, RollyF <[EMAIL PROTECTED]> wrote:
> I run "/sbin/ldconfig -v" and restarted Apache again. Still showing
> the same python2.4 exception when I run the application.
> I am not sure what to put in ld.so.config. I saw a couple of
> references to python2.4 libs while in verbose mode of running
> ldconfig.

You wanna put the libs path of your new python install in there,
something like /usr/local/python2.5/lib or whatever yours is exactly.
After that run ldconfig so your system knows to look there for shared
libraries from now on.


-- 
Greg Donald
http://destiney.com/

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



Re: Upgrade from Python 2.4 to 2.5

2007-05-07 Thread RollyF

Greg,

Thank you again. This is very informative.

"which python" returns

/usr/local/bin/python

which is the location of python2.5

I restarted Apache several times using "/etc/init.d/httpd restart",
including a hard reboot of the server.

I originally recompiled Python from source using:
  ./configure
  make
  make install

I run "/sbin/ldconfig -v" and restarted Apache again. Still showing
the same python2.4 exception when I run the application.
I am not sure what to put in ld.so.config. I saw a couple of
references to python2.4 libs while in verbose mode of running
ldconfig.

Thanks,
rolly

On May 7, 11:18 am, "Greg Donald" <[EMAIL PROTECTED]> wrote:
> On 5/7/07, RollyF <[EMAIL PROTECTED]> wrote:
>
> > [EMAIL PROTECTED] ~]$ python
> > Python 2.5.1 (r251:54863, May  4 2007, 14:56:43)
>
> Seems like the correct Python is in your path already.
>
> > [EMAIL PROTECTED] ~]$ $PATH
> > -bash: /usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/rxferoli/
> > bin: No such file or directory
>
> echo $PATH is probably what you want.
>
> > [EMAIL PROTECTED] ~]$ whereis python
>
> whereis just consults the locate database.  Try `which python`
> instead, it searches your PATH.
>
> > I am a linux and python newbie so I appreciate this hand-holding for
> > now. I am a bit confused. The sys.path is showing no signs of
> > python2.4, the $PATH is fist listing /usr/local/bin where python2.5 is
> > located; but whereis is definitely showing python2.4 first. Where
> > should I go to adjust this?
>
> If you want to rely on whereis you have to make sure your locate
> database is up to date.  Run `updatedb` when in doubt.
>
> Some other things to check:
>
> Did you restart Apache?
>
> Are you compiling a new Python from source?  If so did you add the
> Python libs path to your ld.so.config?  Did you run ldconfig?
>
> --
> Greg Donaldhttp://destiney.com/


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



Re: Newform and File Upload problem

2007-05-07 Thread guillaume

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.

Yours,
Guillaume.

Le lundi 07 mai 2007 � 08:41 -0700, [EMAIL PROTECTED] a �crit :
> Hello everybody.
> 
> I am a Django newbie experimenting with some stuff. I am very
> impressed by the framework, that made me want to learn more about it.
> I am trying to do some file upload but I have a problem.
> I tried many information sources but could not find a simple example
> of what I am trying to do. I have a few question...
> 
> Well, It should be very simple, I just want to upload a file on the
> server on the MEDIA directory.
> I use the up to date SVN version ( 5156 ).
> 
> I put sipets of code below, the things I dont anderstand are:
> * The {{form.updateFile_file}} tag produces nothing the first time I
> load my page. Is it normal behavior?
> 
> * The validation raises an AttributeError with message: 'dict' object
> has no attribute 'startswith'
> The lower part of the stack is :
> /home/guillaume/dev/Python/django_src/django/db/models/fields/
> __init__.py in isWithinMediaRoot
>  628.  # If the raw path is passed in, validate it's under the
> MEDIA_ROOT.
>  629. def isWithinMediaRoot(field_data, all_data):
> 
>  630. f = os.path.abspath(os.path.join(settings.MEDIA_ROOT,
> field_data)) ...
> 
>  631. if not
> f.startswith(os.path.abspath(os.path.normpath(settings.MEDIA_ROOT))):
>  632. raise validators.ValidationError, _("Enter a valid filename.")
> 
> * If I disable the validation, I have an error because Django tries to
> insert the file data into the database as a string...
> 
> Well I probably missed something very simple, but I cannot figure
> it ...
> 
> Might a Django Guru engilten me ?
> 
> Yours,
> Guillaume.
> 
> 
> 
> My model :
> 
> #-
> class StockUpdateFile( models.Model ):
> 
> updateFile  = models.FileField( upload_to = 'updatefiles/%Y/%m/
> %d' )
> fdate   = models.DateField( auto_now_add = True )
> 
> def __str__( self ):
> return "file %1-%2-%3" % str( distributor ) % str( fdate ) %
> str( updateFile )
> 
> class Admin:
> pass
> 
> --
> The form is:
> 
> class UploadForm( forms.Form ):
> updateFile = forms.Field( widget = forms.FileInput() )
> 
> 
> My template is:
> 
>  method="post" >
> 
>   
>   {{form.updateFile}}:{{form.updateFile_file}}
>   
>   
> 
>  
> -
> And the code handling the form is:
> 
> def uploadFile(request, template='uploadfile.html' ):
> 
> errors = {}
> 
> form = UploadForm()
> 
> if( request.FILES ):
> 
> manip = StockUpdateFile.AddManipulator()
> newData = request.POST.copy()
> newData.update( request.FILES )
> 
> errors = manip.get_validation_errors( newData )
> 
> if( not errors):
> 
> manip.do_html2python( newData )
> newFile = manip.save( newData )
> else:
> form = UploadForm()
> 
> return render_to_response( template,
>context_instance =
> RequestContext( request, {'form': form,
>  
> 'errors' : errors } ))
> 
> 
> > 
> 


--~--~-~--~~~---~--~~
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: Upgrade from Python 2.4 to 2.5

2007-05-07 Thread Jeremy Dunck

On 5/7/07, Greg Donald <[EMAIL PROTECTED]> wrote:
...
>
> Are you compiling a new Python from source?  If so did you add the
> Python libs path to your ld.so.config?  Did you run ldconfig?

Is apache running as the same user as you, and if not, is it locating
your 2.5 on the path?

--~--~-~--~~~---~--~~
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: Upgrade from Python 2.4 to 2.5

2007-05-07 Thread Greg Donald

On 5/7/07, RollyF <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] ~]$ python
> Python 2.5.1 (r251:54863, May  4 2007, 14:56:43)

Seems like the correct Python is in your path already.

> [EMAIL PROTECTED] ~]$ $PATH
> -bash: /usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/rxferoli/
> bin: No such file or directory

echo $PATH is probably what you want.

> [EMAIL PROTECTED] ~]$ whereis python

whereis just consults the locate database.  Try `which python`
instead, it searches your PATH.

> I am a linux and python newbie so I appreciate this hand-holding for
> now. I am a bit confused. The sys.path is showing no signs of
> python2.4, the $PATH is fist listing /usr/local/bin where python2.5 is
> located; but whereis is definitely showing python2.4 first. Where
> should I go to adjust this?

If you want to rely on whereis you have to make sure your locate
database is up to date.  Run `updatedb` when in doubt.

Some other things to check:

Did you restart Apache?

Are you compiling a new Python from source?  If so did you add the
Python libs path to your ld.so.config?  Did you run ldconfig?


-- 
Greg Donald
http://destiney.com/

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



Re: a comment on comments system and voting

2007-05-07 Thread [EMAIL PROTECTED]

Probably. That's what I did. It's not too hard (which is to say, a
newb like me figured it out).

I understand the comment system is getting reworked, though.

On May 4, 10:48 am, "omat * gezgin.com" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I feel like commenting and voting should be two separate applications,
> because in a sites scope, there can be content other than comments,
> say photos, that also need to be voted.
>
> Wouldn't it be more natural and manageable to have a generic voting
> application that keeps scores of every content and users?
>
> oMat


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



Ultimate, hand picked, genuine sites

2007-05-07 Thread Shortcut Weebly
  ShortIntroduction 

Well, cut short, Shortcut takes you to those ultimate, hand picked,
genuine sites 
that add bucks to your pocket, without any strings attached!

What you will find here:
Links to time-tested and transparent websites leading you to earn
money by
something as simple as referring it to other people (Posting it in groups,
via e-mail,
blogs, chat, etc...), something that this website does.

What you won't find in here:
Any irritating ads popping up, forums, blogs, anything that deviates
from the
website's intention.
Any hi-funda stuff. Things are pretty simple here and won't take
much of your time
to getting used to and/or to attain fast growth.


You may visit our links to sign up for them and instantly start
getting paid.
Of course hard work and dedication are essential for success
but thats not the case with Shortcut!..

Smart work and a bit of time will take you heights...

So enjoy and all the best to you.


Click here to visit shortcut.weebly.com



Please do not mark this message as spam rather delete or discard
it.
We hate spams as much as you do, this message is only for your
interest .

Thank You for reading so patiently. And sorry coz we came in without
knocking your door !!

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



Short Introduction to smart work

2007-05-07 Thread Shortcut Weebly
  ShortIntroduction 

Well, cut short, Shortcut takes you to those ultimate, hand picked,
genuine sites 
that add bucks to your pocket, without any strings attached!

What you will find here:
Links to time-tested and transparent websites leading you to earn
money by
something as simple as referring it to other people (Posting it in groups,
via e-mail,
blogs, chat, etc...), something that this website does.

What you won't find in here:
Any irritating ads popping up, forums, blogs, anything that deviates
from the
website's intention.
Any hi-funda stuff. Things are pretty simple here and won't take
much of your time
to getting used to and/or to attain fast growth.


You may visit our links to sign up for them and instantly start
getting paid.
Of course hard work and dedication are essential for success
but thats not the case with Shortcut!..

Smart work and a bit of time will take you heights...

So enjoy and all the best to you.


Click here to visit shortcut.weebly.com



Please do not mark this message as spam rather delete or discard
it.
We hate spams as much as you do, this message is only for your
interest .

Thank You for reading so patiently. And sorry coz we came in without
knocking your door !!

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



KeyError

2007-05-07 Thread Stephan Jennewein

Hi,

I get a keyerror in the admin interface if my primary key is also a
foreign key and I try to open an object.


KeyError at /admin/swi/switchport/TS4-01A-44/

'anschlnr'
Request Method: GET
Request URL: http://localhost:1200/admin/swi/switchport/TS4-01A-44/
Exception Type: KeyError
Exception Value: 'anschlnr'
Exception Location:
/usr/lib/python2.5/site-packages/django/contrib/admin/views/main.py in
original_value, line 136

   
14 {% if bound_field.field.primary_key %}
15 {{ bound_field.original_value }} <-- this should be the problem
16 {% endif %}


This is the model object:

class switchport(models.Model):
   anschlnr = models.ForeignKey(anschluss,
primary_key=True, db_column='anschlnr')
   swnr   = models.ForeignKey(switch,
db_column='swnr')
   portnr = models.IntegerField()
   switchport_status= models.CharField(maxlength=7,
choices=SWITCHPORT_STATUS)
   anschluss_status = models.CharField(maxlength=8,
choices=ANSCHLUSS_STATUS)
   iface= models.CharField(maxlength=20)
   dhcp_helper  = models.IPAddressField()
   class Meta:
 verbose_name_plural = 'switchport'
 db_table = 'switchport'
 unique_together = (('swnr', 'portnr'),)
   class Admin:
 list_display = ('anschlnr', 'swnr', 'portnr', 'dhcp_helper',
'switchport_status', 'anschluss_status')
 search_fields = ['swnr__swnr', 'anschlnr__anschlnr', 'portnr',
'switchport_status', 'anschluss_status']

Is there anything wrong or isn't it possible that the primary key is a
foreign key, too ?

Stephan



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



Re: migrating 400 images

2007-05-07 Thread Milan Andric



On May 5, 7:17 am, Nate Straz <[EMAIL PROTECTED]> wrote:
>
> >>> from blog.migrate import loadCOREBlog
>
> In loadCOREBlog I loaded all of the Zope libraries and started iterating
> through whatever needed to be migrated.  When I detected a problem I
> would use Python's code.interact function to get a shell at that point
> in my script to help deal with any unexpected migration issues.
>
> http://refried.org/viewvc/viewvc.py/refriedorg/blog/migrate.py?view=m...
>

Wow, interact() is very cool.  Now I just need to find write one that
does a similar thing with html body and the local img srcs recursively
on files within a directory.  Is there a library that parses html
pages, I'm sure there is, but one that you recommend?

--
Milan


--~--~-~--~~~---~--~~
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: Authentication of static files without mod_python?

2007-05-07 Thread AndyB


> You may be able to use something like mod_auth_mysql to access the db
> directly for authentication (assuming you use mysql). Authorization
> doesn't seem possible without using python.

It's a shared server (or else I'd just install mod_python). When you
say 'doesn't seem possible' what do you mean exactly?

The only way I can think to do it is to take the files away from
Apache and serve them via Django as I mentioned in my original post. I
was wondering a) the best way to do this and b) if I'd missed anything
that might avoid the need to do so (and worked without access to much
beyond .htaccess files)


--~--~-~--~~~---~--~~
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: Upgrade from Python 2.4 to 2.5

2007-05-07 Thread RollyF

Greg,

Thank you for the quick reply. I got the following while checking the
path:

>>>
[EMAIL PROTECTED] ~]$ python
Python 2.5.1 (r251:54863, May  4 2007, 14:56:43)
[GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.path
['', '/usr/local/lib/python25.zip', '/usr/local/lib/python2.5', '/usr/
local/lib/python2.5/plat-linux2', '/usr/local/lib/python2.5/lib-tk', '/
usr/local/lib/python2.5/lib-dynload', '/usr/local/lib/python2.5/site-
packages']
>>>
[EMAIL PROTECTED] ~]$ $PATH
-bash: /usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/rxferoli/
bin: No such file or directory
>>>

[EMAIL PROTECTED] ~]$ whereis python
python: /usr/bin/python /usr/bin/python2.4 /usr/lib/python2.4 /usr/
local/bin/python /usr/local/bin/python2.5-config /usr/local/bin/
python2.5 /usr/local/lib/python2.5 /usr/include/python2.4 /usr/share/
man/man1/python.1.gz


I am a linux and python newbie so I appreciate this hand-holding for
now. I am a bit confused. The sys.path is showing no signs of
python2.4, the $PATH is fist listing /usr/local/bin where python2.5 is
located; but whereis is definitely showing python2.4 first. Where
should I go to adjust this?

Thanks,

- rolly



On May 7, 9:39 am, "Greg Donald" <[EMAIL PROTECTED]> wrote:
> On 5/7/07, RollyF <[EMAIL PROTECTED]> wrote:
>
> > How do I configure Apache2 or mod_python to use Python 2.5?
>
> Adjust your paths so the place where you installed your new Python 2.5
> is ahead of your old Python's path.
>
> --
> Greg Donaldhttp://destiney.com/


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



Re: is this a template bug?

2007-05-07 Thread Joseph Heck

My first thought is "what's in {{ item.inleiding }}". If it included
the , then it would be displayed when you rendered that down.

Do something like:


{{ item.inleiding|escape }}


to isolate that element and see what "pops out".

On 5/7/07, Enquest <[EMAIL PROTECTED]> wrote:
>
> Consider the following code
>
>   9 {% for item in news %}
> 10 
> 11 {{ item.titel }}
> 12 
> 13 {{ item.inleiding }}  href="/in-de-pers/{{ item.slug }}/"> › lees meer
> 14 
> 15 
> 16 {% endfor %}
>
>
>
> The template result in the browser is:
>
> 
> testf
> 
> jfklsdjkfsfjsjfksklfdsfsdfsdfssfsfsdfs 
>  › lees meer
> 
>
> The "lees meer" a href is printed outside the  tags... How can
> this be... Clearly the code places it inside the  yet "a href" is
> outside...
> The text is "jklsjkfjksl" is made with tinymce for each enter it places
>  but even then there should be a  tag on the end.
>
> If I however replace the inner  with  then this problem does
> not occur.
>
> What could be the cause of this problem.
>
> thanks,
> Enquest
>
>
>
> >
>

--~--~-~--~~~---~--~~
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: Translation of class names

2007-05-07 Thread Joseph Heck
Do you want your site to be mixed language, or always in Russian?

Assuming you want the first, there's good instructions at
http://www.djangoproject.com/documentation/i18n/.

Make sure you have the middleware included and running, and then take
advantage of the url/view setup to explicitly change the language -
it's detailed near the bottom of those instructions.

Finally, a reasonable debugging step is to look at the "request"
object when it's processing through your views and see what it's
reporting as the language that it is using.

On 5/7/07, Konstantin Pavlovsky <[EMAIL PROTECTED]> wrote:
>
> up!
> nobody used i18n things?
>
>
> On 3 май, 16:05, Konstantin Pavlovsky <[EMAIL PROTECTED]>
> wrote:
> > hi all
> >
> > I am working with administrative interface. and want to make it
> > "speak" russian
> > if it possible to translate names of Classes using i18n things?
> >
> > ive translated field lables with lazy gettext
> >
> > [code]
> > manager = models.ForeignKey(User,verbose_name=_("Manager"))
> > ordertext = models.TextField(_("Order contents"))
> > order_date = models.DateTimeField(_("Order date"))
> > client_name = models.CharField(_("Client"),maxlength=255)
> > order_state = models.ForeignKey(OrderStates,verbose_name=_("Order
> > state"))
> > [/code]
> >
> > i see them in russian.it works
> > now i want modules to be called in russian.
> > i added
> > [code]
> > class Meta:
> > verbose_name = _('Order')
> > verbose_name_plural = _('Orders')
> > [/code]
> >
> > Now a have module called Oders in index page of administrative
> > interface
> > I have ran make-messages , then putted nessesary frazes for Order and
> > Orders (which appeared after i added those 2 lines above) and ran
> > compile messages, but still no russian words appeared. i still have
> > Orders instead of translation. And again - Descriptions for fields are
> > working fine.
> > i have this import above all
> > [code]
> > from django.utils.translation import gettext_lazy as _
> > [/code]
> >
> > I need some advice here:) thanx
> > P.S.
> > I have svn trunk from 26 of april this year.

--~--~-~--~~~---~--~~
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: Upgrade from Python 2.4 to 2.5

2007-05-07 Thread Greg Donald

On 5/7/07, RollyF <[EMAIL PROTECTED]> wrote:
> How do I configure Apache2 or mod_python to use Python 2.5?

Adjust your paths so the place where you installed your new Python 2.5
is ahead of your old Python's path.


-- 
Greg Donald
http://destiney.com/

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



Re: Authentication of static files without mod_python?

2007-05-07 Thread Steven Armstrong

AndyB wrote on 05/07/07 18:17:
> I've read the docs on linking Apache authentication with Django's
> (http://www.djangoproject.com/documentation/apache_auth/) and also
> found a snippet on Django Snippets (http://www.djangosnippets.org/
> snippets/62/).
> 
> The first method definitely requires mod_python and the second one
> seems to as well.
> 
> I'm stuck with fcgi at the moment. The standard CGI method would be to
> keep all static files away from Apache and pipe them all through
> Python code.
> 
> Is there any other solution or failing that does anyone have any
> advice/code on the most efficient way to go about this?
> 
> AndyB

You may be able to use something like mod_auth_mysql to access the db 
directly for authentication (assuming you use mysql). Authorization 
doesn't seem possible without using python.

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



Upgrade from Python 2.4 to 2.5

2007-05-07 Thread RollyF

I am using fedora 6 distribution which comes with Python 2.4.3. I then
installed Python 2.5.1 and re-installed the  packages I needed for my
application. I verified that at the terminal, when I typed in
"python", what's loaded is Python 2.5. I am runnign apache2 and
mod_python. I recompiled and installed mod_python to python 2.5. When
I run my application, it's coming back with:

>>>
Traceback (most recent call last):

  File "/usr/lib/python2.4/site-packages/mod_python/importer.py", line
1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.4/site-packages/mod_python/importer.py", line
1202, in _process_target
module = import_module(module_name, path=path)

  File "/usr/lib/python2.4/site-packages/mod_python/importer.py", line
304, in import_module
return __import__(module_name, {}, {}, ['*'])

ImportError: No module named django.core.handlers.modpython
>>>

How do I configure Apache2 or mod_python to use Python 2.5?

TIA,
Rolly


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



vSelectMultipleField

2007-05-07 Thread sansmojo

Hey, all!  I think I'm missing something easy here, but I can't seem
to alter the style of a vSelectMultipleField using CSS.  Here's my
change_form.htm (events is the name of the ManyToManyField)l:

{% extends "admin/change_form.html" %}
{% block extrastyle %}

.vTextField { width: 50em }
#id_events { width: 50em }
.vSelectMultipleField { width: 50em }

{% endblock %}

Is it the javascript that's messing this up for me, or am I doing
something wrong?

Thanks!

Branton


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



Authentication of static files without mod_python?

2007-05-07 Thread AndyB

I've read the docs on linking Apache authentication with Django's
(http://www.djangoproject.com/documentation/apache_auth/) and also
found a snippet on Django Snippets (http://www.djangosnippets.org/
snippets/62/).

The first method definitely requires mod_python and the second one
seems to as well.

I'm stuck with fcgi at the moment. The standard CGI method would be to
keep all static files away from Apache and pipe them all through
Python code.

Is there any other solution or failing that does anyone have any
advice/code on the most efficient way to go about this?

AndyB


--~--~-~--~~~---~--~~
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-07 Thread jeffhg58
I think this documentation will provide what you are looking for

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

jeff

-- Original message -- 
From: johnny <[EMAIL PROTECTED]> 

> 
> I have a python script that runs in a multi threaded manner for 
> backend to update certain flags in the table. I want to use django 
> models to do this. I was wondering if I import the django models just 
> like any other python, would that work? 
> 
> Also, what about the database connection, can I just create a database 
> connection inside the python script and use Django Models? 
> 
> 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: Need some help with Amazon S3

2007-05-07 Thread Kyle Fox

1)  We found S3 to be a bit slow, both upstream and down.  Upstream is
slow largely because of the SOAP overhead (from what I understand),
and we were sending lots of data (about 5 resized images for each
image uploaded to django).  Downstream, well, not much you can do
about that, regardless of how you set up you models.  We simply stored
the image's S3 key in the database, and used that when constructing
get_absolute_url().

2) I'm not sure you can do this.  When you say you want to have a
connection with the service, are you referring to a connection using
the S3 python library?  I'm not sure how you would create a global,
persistant connection to S3, which is what I assume you want.  We
simple made a wrapper class around S3, and added a add_to_bucket()
function to our user's profile model that used the S3 wrapper class.
Again, this seemed reasonably fast, the bottleneck was not around
managing the connection to S3, but the actual upload to S3 itself.

Kyle.


--~--~-~--~~~---~--~~
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: Apache2/mod_python/Django problem

2007-05-07 Thread RollyF

rob,

Thanks. It's the permissions. It's running now.

-Rolly

On May 4, 3:32 pm, oggie rob <[EMAIL PROTECTED]> wrote:
> Check Unix permissions for the todo directory and/or settings.py file.
> If apache can't access them, it won't run properly.
>
>  -rob
>
> On May 4, 6:49 am, RollyF <[EMAIL PROTECTED]> wrote:
>
> > Could someone point me to a solution somewhere? I have a directory
> > call apps and inside is a django project, todo (created using django-
> > admin.py startproject todo). This application runs OK with Django's
> > built-in server (manage.py runserver). I am trying to setup a staging
> > server in Fedora 6, running Apache 2.x and Python 2.4.4. When I run
> > the application I am getting the following error:
>
> > EnvironmentError: Could not import settings 'todo.settings' (Is it on
> > sys.path? Does it have syntax errors?): No module named
> > apps.todo.settings
>
> > Here's my setting in httpd.config
>
> > 
> >   SetHandler python-program
> >   PythonHandler django.core.handlers.modpython
> >   PythonPath "['/home/rxferoli/apps'] + sys.path"
> >   SetEnv DJANGO_SETTINGS_MODULE todo.settings
> >   PythonDebug On
> >   PythonInterpreter todo
> > 
>
> > What am I missing in the config?
>
> > TIA
> > Rolly


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



Newform and File Upload problem

2007-05-07 Thread schmidg

Hello everybody.

I am a Django newbie experimenting with some stuff. I am very
impressed by the framework, that made me want to learn more about it.
I am trying to do some file upload but I have a problem.
I tried many information sources but could not find a simple example
of what I am trying to do. I have a few question...

Well, It should be very simple, I just want to upload a file on the
server on the MEDIA directory.
I use the up to date SVN version ( 5156 ).

I put sipets of code below, the things I dont anderstand are:
* The {{form.updateFile_file}} tag produces nothing the first time I
load my page. Is it normal behavior?

* The validation raises an AttributeError with message: 'dict' object
has no attribute 'startswith'
The lower part of the stack is :
/home/guillaume/dev/Python/django_src/django/db/models/fields/
__init__.py in isWithinMediaRoot
 628.  # If the raw path is passed in, validate it's under the
MEDIA_ROOT.
 629. def isWithinMediaRoot(field_data, all_data):

 630. f = os.path.abspath(os.path.join(settings.MEDIA_ROOT,
field_data)) ...

 631. if not
f.startswith(os.path.abspath(os.path.normpath(settings.MEDIA_ROOT))):
 632. raise validators.ValidationError, _("Enter a valid filename.")

* If I disable the validation, I have an error because Django tries to
insert the file data into the database as a string...

Well I probably missed something very simple, but I cannot figure
it ...

Might a Django Guru engilten me ?

Yours,
Guillaume.



My model :

#-
class StockUpdateFile( models.Model ):

updateFile  = models.FileField( upload_to = 'updatefiles/%Y/%m/
%d' )
fdate   = models.DateField( auto_now_add = True )

def __str__( self ):
return "file %1-%2-%3" % str( distributor ) % str( fdate ) %
str( updateFile )

class Admin:
pass

--
The form is:

class UploadForm( forms.Form ):
updateFile = forms.Field( widget = forms.FileInput() )


My template is:



  
  {{form.updateFile}}:{{form.updateFile_file}}
  
  

 
-
And the code handling the form is:

def uploadFile(request, template='uploadfile.html' ):

errors = {}

form = UploadForm()

if( request.FILES ):

manip = StockUpdateFile.AddManipulator()
newData = request.POST.copy()
newData.update( request.FILES )

errors = manip.get_validation_errors( newData )

if( not errors):

manip.do_html2python( newData )
newFile = manip.save( newData )
else:
form = UploadForm()

return render_to_response( template,
   context_instance =
RequestContext( request, {'form': form,
 
'errors' : errors } ))


--~--~-~--~~~---~--~~
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-07 Thread James Bennett

On 5/7/07, johnny <[EMAIL PROTECTED]> wrote:
> I have a python script that runs in a multi threaded manner for
> backend to update certain flags in the table.  I want to use django
> models to do this.  I was wondering if I import the django models just
> like any other python, would that work?

You will need to either set the environment variable
DJANGO_SETTINGS_MODULE to point at a Django settings file, or use
manual configuration in your application to set up necessary
configuration like the database type, name and auth info. See the
documentation for details:

http://www.djangoproject.com/documentation/settings/#using-settings-without-setting-django-settings-module

> Also, what about the database connection, can I just create a database
> connection inside the python script and use Django Models?

Django will handle its own database connection automatically, based on
the settings you specify.


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



Using Django Models outside of Django

2007-05-07 Thread johnny

I have a python script that runs in a multi threaded manner for
backend to update certain flags in the table.  I want to use django
models to do this.  I was wondering if I import the django models just
like any other python, would that work?

Also, what about the database connection, can I just create a database
connection inside the python script and use Django Models?

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: sitemap for django 0.95.1

2007-05-07 Thread James Bennett

On 5/7/07, Paul Rauch <[EMAIL PROTECTED]> wrote:
> if you take a look at the first line of
> http://www.djangoproject.com/documentation/sitemaps/
> there is written: "New in Django development version"
> meaning: No, not even in 0.96

That's incorrect. The sitemaps app was part of Django 0.96. It was
added to Django in August of last year, and so is not part of the 0.95
or 0.95.1 releases (hence there isn't any Django 0.95 for sitemaps),
but it is available in 0.96.

-- 
"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: Flex + django

2007-05-07 Thread Don Arbow

I've dabbled in Flex with Django on the backend, using JSON as the  
transport mechanism. It's not that difficult, you just skip all the  
HTML template stuff and handle data requests and serve them  
accordingly. No different than implementing AJAX in the traditional  
way. I used the Cairngorm framework, which makes it easier to handle  
asynchronous calls within the Flex app.

Note also there is some AMF middleware available to enable Flash  
Remoting. I haven't used it though:

http://djangoamf.sourceforge.jp/index.php?DjangoAMF_en

Don


On May 7, 2007, at 1:14 AM, [EMAIL PROTECTED] wrote:

>
>
> Does anybody have got any experience with connection Flex(presentation
> layer) and  Django(server-side)?
> Do you think  this connection could be a good idea?


--~--~-~--~~~---~--~~
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: sitemap for django 0.95.1

2007-05-07 Thread Paul Rauch

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Mary schrieb:
> Does the sitemap work for version 0.95.1
> Casue when i went to this url 
> http://www.djangoproject.com/documentation/0.95/sitemaps/
> it gave me error page
> 
> Thanks you in advance ;
> Mary Adel
> 
>
if you take a look at the first line of
http://www.djangoproject.com/documentation/sitemaps/
there is written: "New in Django development version"
meaning: No, not even in 0.96

mfg Paul Rauch
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iQIVAwUBRj81URG67lyyQrltAQKO4Q//csKxceeJJvdOGx4KVPK40P/TBYhnQ7cV
jFvjWqPnyYkde6ccOrkrXvUfaUinaLN2TTHLCuHJclQhKjfe2xigEcQi2fJusOB3
GDdna7IFEDdDPjQ3o48gPV1YrmKWXjZj/6i30xLY3t1JVWZWM7T9C5vx39m4bkRV
dAVWkeakFg9VJ3mOwfx09cKGHnFeFOF177vw2lHlMsne/eMq6hn21i8FfidBpRr5
IeI4CRrG2LEv1DyujkszrgSGZQjbwZTQTI64UNI3IO6NSd+jJyAexyZCCiYRELDV
T3Ch8zNk6TtGwJijZcbeCSfuFeFxaQAzX++rfw4dx8cgedOVEvWAjbt57ez+nXWl
N/1Yzt1enXzUdKDEVN6uPsxxZPCJB9pJZxTAgPw2wcNi80gGcUsAsf109H6LfYeS
XVxK0kt/enGzQM7swqxXi2wul6E1lAUolZpoQehKMIHTeVJF2u7+5i8WEk1TXr3P
Oq1AVeCpgA/VVwqCLRmtI97FbMK+dU29TcrpgUeBICcudpvqKDYD2RBUbAMfORkP
GRi9J+4rLduTjXL0Z+JyA+t/KNAmdPyzTiLnrx7K285a5DJ+R/8Ll+D1fe4SXcF6
jSISRtjwAhIbNrGItOIAh10XUjkbyld4Cf/KW6+VcsS58dLiDOj2mN+8JM7Okl8K
XQyA3rt2678=
=2eaC
-END PGP SIGNATURE-

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



sitemap for django 0.95.1

2007-05-07 Thread Mary

Does the sitemap work for version 0.95.1
Casue when i went to this url 
http://www.djangoproject.com/documentation/0.95/sitemaps/
it gave me error page

Thanks you in advance ;
Mary Adel


--~--~-~--~~~---~--~~
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 this a template bug?

2007-05-07 Thread Enquest

Consider the following code

  9 {% for item in news %}
10 
11 {{ item.titel }}
12 
13 {{ item.inleiding }}  › lees meer
14 
15 
16 {% endfor %}



The template result in the browser is:


testf

jfklsdjkfsfjsjfksklfdsfsdfsdfssfsfsdfs  
 › lees meer


The "lees meer" a href is printed outside the  tags... How can
this be... Clearly the code places it inside the  yet "a href" is
outside...
The text is "jklsjkfjksl" is made with tinymce for each enter it places
 but even then there should be a  tag on the end.

If I however replace the inner  with  then this problem does
not occur.

What could be the cause of this problem.

thanks,
Enquest 



--~--~-~--~~~---~--~~
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: Amanda Bynes !

2007-05-07 Thread Kooooool forwords
[image: AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

*celebrity-movie001*
900 X 675
58 KB *celebrity-movie002*
900 X 675
56 KB *celebrity-movie003*
900 X 675
65 KB *celebrity-movie004*
900 X 675
72 KB  [image: AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

*celebrity-movie005*
900 X 675
59 KB *celebrity-movie006*
900 X 675
42 KB *celebrity-movie007*
900 X 675
52 KB *celebrity-movie008*
900 X 675
41 KB  [image: AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

*celebrity-movie009*
900 X 675
25 KB *celebrity-movie010*
900 X 675
37 KB *celebrity-movie011*
900 X 675
53 KB *celebrity-movie012*
900 X 675
89 KB
[image: AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

*celebrity-movie013*
900 X 675
63 KB *celebrity-movie014*
900 X 675
63 KB *celebrity-movie015*
900 X 675
82 KB *celebrity-movie016*
900 X 675
69 KB  [image: AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

*celebrity-movie017*
900 X 675
67 KB *celebrity-movie018*
900 X 675
90 KB *celebrity-movie019*
900 X 675
103 KB *celebrity-movie020*
900 X 675
83 KB  [image: AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

*celebrity-movie021*
900 X 675
95 KB *celebrity-movie022*
900 X 675
93 KB *celebrity-movie023*
900 X 675
77 KB *celebrity-movie024*
900 X 675
94 KB [image: AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

[image:
AMANDA BYNES ,ADVERTISEING ,ADS]

*celebrity-movie025*
900 X 675
47 KB *celebrity-movie026*
900 X 675
74 KB *celebrity-movie027*
900 X 675
68 KB *c

Is that possible to use DISTINCT with get_list?

2007-05-07 Thread Pythoni

I need to find distinct records form my `discussions` table.
I can use
discussions.get_values(fields=['Subject'],order_by=['Pub_date'],distinct=True)

and it works. But I would like to find  distinct records  with
get_list not with get_values, because i need to sent the results to
paginator,

Is that possible to use DISTINCT with get_list?

Thank you for help.
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
-~--~~~~--~~--~--~---



Re: Transaction Support in Models

2007-05-07 Thread Russell Keith-Magee

On 5/7/07, Ali Alinia <[EMAIL PROTECTED]> wrote:
>
> hi Russ,
> I have crawled! all of the documentation,
> but I don't find anything to help me.
> in which section of documetation is my answer?
> tnx Russ, (and I'm so sorry for my quick replies)

This would be a good place to start:

http://www.djangoproject.com/documentation/db-api/#limiting-querysets

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: Transaction Support in Models

2007-05-07 Thread Ali Alinia

hi Russ,
I have crawled! all of the documentation,
but I don't find anything to help me.
in which section of documetation is my answer?
tnx Russ, (and I'm so sorry for my quick replies)


--~--~-~--~~~---~--~~
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: Transaction Support in Models

2007-05-07 Thread Russell Keith-Magee

On 5/7/07, Ali Alinia <[EMAIL PROTECTED]> wrote:
>
> still another question with models:
> what about ordering and update/delete statements that have limit
> clause?
> for example, I want to delete/update records first five records of my
> table (model) order by creation date (field:creation_date) and rate
> (field:rate)

Have you considered reading the documentation? One of the strengths of
Django as a project is the fairly comprehensive documentation. These
pages describe how to do the sort of things you are describing, and
are the result of an extensive editing process, so they're much more
likely to be clear, accurate than a quick reply on a mailing list.

http://www.djangoproject.com/documentation/

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: Flex + django

2007-05-07 Thread makoto tsuyuki

Hello,

You should check DjangoAMF.
It's very fun and usable.

http://djangoamf.sourceforge.jp/index.php?DjangoAMF_en

On 5月7日, 午後5:14, [EMAIL PROTECTED] wrote:
> Does anybody have got any experience with connection Flex(presentation
> layer) and  Django(server-side)?
> Do you think  this connection could be a good idea?
>
> --
> Dziecko - instrukcja obsługi
>
> >>>http://link.interia.pl/f1a51


--~--~-~--~~~---~--~~
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: Translation of class names

2007-05-07 Thread Konstantin Pavlovsky

up!
nobody used i18n things?


On 3 май, 16:05, Konstantin Pavlovsky <[EMAIL PROTECTED]>
wrote:
> hi all
>
> I am working with administrative interface. and want to make it
> "speak" russian
> if it possible to translate names of Classes using i18n things?
>
> ive translated field lables with lazy gettext
>
> [code]
> manager = models.ForeignKey(User,verbose_name=_("Manager"))
> ordertext = models.TextField(_("Order contents"))
> order_date = models.DateTimeField(_("Order date"))
> client_name = models.CharField(_("Client"),maxlength=255)
> order_state = models.ForeignKey(OrderStates,verbose_name=_("Order
> state"))
> [/code]
>
> i see them in russian.it works
> now i want modules to be called in russian.
> i added
> [code]
> class Meta:
> verbose_name = _('Order')
> verbose_name_plural = _('Orders')
> [/code]
>
> Now a have module called Oders in index page of administrative
> interface
> I have ran make-messages , then putted nessesary frazes for Order and
> Orders (which appeared after i added those 2 lines above) and ran
> compile messages, but still no russian words appeared. i still have
> Orders instead of translation. And again - Descriptions for fields are
> working fine.
> i have this import above all
> [code]
> from django.utils.translation import gettext_lazy as _
> [/code]
>
> I need some advice here:) thanx
> P.S.
> I have svn trunk from 26 of april this year.


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



Welcome to Shortcut - Shortcut takes you to those ultimate, hand picked...

2007-05-07 Thread Shortcut Weebly
  ShortIntroduction 

Well, cut short, Shortcut takes you to those ultimate, hand picked,
genuine sites 
that add bucks to your pocket, without any strings attached!

What you will find here:
Links to time-tested and transparent websites leading you to earn
money by
something as simple as referring it to other people (Posting it in groups,
via e-mail,
blogs, chat, etc...), something that this website does.

What you won't find in here:
Any irritating ads popping up, forums, blogs, anything that deviates
from the
website's intention.
Any hi-funda stuff. Things are pretty simple here and won't take
much of your time
to getting used to and/or to attain fast growth.


You may visit our links to sign up for them and instantly start
getting paid.
Of course hard work and dedication are essential for success
but thats not the case with Shortcut!..

Smart work and a bit of time will take you heights...

So enjoy and all the best to you.


Click here to visit shortcut.weebly.com



Please do not mark this message as spam rather delete or discard
it.
We hate spams as much as you do, this message is only for your
interest .

Thank You for reading so patiently. And sorry coz we came in without
knocking your door !!

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



Blog archive

2007-05-07 Thread Alessandro Ronchi

How can I make automatically the links for the blog archive, taking all the 
years of my blog entries and list them with a link to /2005 /2006 /2007 
archives?
-- 
Alessandro Ronchi
Skype: aronchi - Wengo: aleronchi
http://www.alessandroronchi.net - Il mio sito personale
http://www.soasi.com - Sviluppo Software e Sistemi Open Source

--~--~-~--~~~---~--~~
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: Bug with __str__(self) if we use "return %s %s" ???

2007-05-07 Thread Nicolas Steinmetz

Mike Axiak wrote:

> 
> Hi,
> 
> I copied the code exactly as you have it and tested, and -- as I
> expected -- it worked fine. Are you sure you set the first_name and
> last_name fields correctly?
> Perhaps you're looking at the wrong object?

Strange, it works well now. I did not know what I made wrong before :-/

Thanks anyway,
Nicolas




--~--~-~--~~~---~--~~
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: delete obsolete content type entries...

2007-05-07 Thread Jens Diemer

That surprises me. Does nobody have the same problems?
Still nobody delete a model class?

How to clean up the django tables? With phpMyAdmin?

-- 
Mfg.

Jens Diemer



A django powered CMS: http://www.pylucid.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: Bug with __str__(self) if we use "return %s %s" ???

2007-05-07 Thread Nicolas Steinmetz

Russell Keith-Magee wrote:

> On 5/4/07, Nicolas Steinmetz <[EMAIL PROTECTED]> wrote:
>>
>> > In Django admin (0.96), when I save data, I have :
>> >
>> > L'objet Photo "first_name last_name" a �t� modifi� avec succ�s
>> >

Oups :

The object Photo "first_name last_name" has been sucessfully 
modified

>> > Instead of :
>> >
>> > L'objet Photo "John Doe" a �t� modifi� avec succ�s, if I set John as
>> > first_name and Doe as last_name.

The object Photo "John Doe" has been sucessfully 
modified

> As a general guide when asking questions - If people don't understand
> the question, they're not likely to offer an answer. My French
> vocabulary is pretty much limited to ordering wine in restaurants, so
> I have no idea what your error messages mean, let alone what could be
> causing the problem.

Sorry :-)

Nicolas


--~--~-~--~~~---~--~~
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: Transaction Support in Models

2007-05-07 Thread Ali Alinia

still another question with models:
what about ordering and update/delete statements that have limit
clause?
for example, I want to delete/update records first five records of my
table (model) order by creation date (field:creation_date) and rate
(field:rate)

how can i do that in my 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: Transaction Support in Models

2007-05-07 Thread Ali Alinia

tnx Martin
:-)


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



Flex + django

2007-05-07 Thread mars_22


Does anybody have got any experience with connection Flex(presentation
layer) and  Django(server-side)?
Do you think  this connection could be a good idea?

--
Dziecko - instrukcja obsługi
>>> http://link.interia.pl/f1a51


--~--~-~--~~~---~--~~
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 Admin to not delete records with other records associated with them.

2007-05-07 Thread Lismoreboy

Here is a DRY preserving hack for models.py to implement CASCADE
RESTRICT in django:

# START models.py DRY hack for restricted cascade
#
# Where you wish to restrict the cascade: put the word "restrict" into
the related_name property of the ForeignKey field
# e.g.
#
#   nl_group = models.ForeignKey(Nlgroup,
related_name='nlmembersrestrict')
#
# Then add the following delete method to all the classes in your
model, replacing CLASSNAME with the name of the class
# ...
# def delete(self):
#   if not restricteddependents(self):
# super(CLASSNAME, self).delete() # Call the "real" delete()
method
# ...
#
# Then add this function to the top of models.py  It will return the
number of
# restricted dependent records that are attached to this record.
#
def restricteddependents(InstanceObject):
  restricteddependents = 0
  for x in dir(InstanceObject):
if x.count('restrict'):
  restricteddependents = restricteddependents +
InstanceObject.__getattribute__(x).count()
  return restricteddependents
# the admin interface still allows you to request deletion, but
nothing is actually deleted!
# END models.py DRY hack for restricted cascade


--~--~-~--~~~---~--~~
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: Transaction Support in Models

2007-05-07 Thread Martin Winkler

> do models support transactions?

Yes, with the TransactionMiddleware. And it's well documented:
http://www.djangoproject.com/documentation/transactions/

> can we have multiple orders in our models(getting /fetching) records
> from our backend DB?

Sure. default ordering is defined in the model metadata
( http://www.djangoproject.com/documentation/model-api/#meta-options )
and you can use any other ordering anytime in your (generic) views:
Entry.objects.filter(foo='bar').order_by(['-date_published','headline'])

> can we use stored procedures (sp) through  our models?

Django does not support stored procedures (yet). But you can at least
use the lower-level db-apis of cxOracle or psycopg2.

Martin

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



Transaction Support in Models

2007-05-07 Thread Ali Alinia

hi every body,
i want to now:
A.
do models support transactions?
if yes, how?
and if no, why?

B.
can we have multiple orders in our models(getting /fetching) records
from our backend DB?

C.
can we use stored procedures (sp) through  our 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: How do you get at a RadioFieldRenderer object from a template? (newforms)

2007-05-07 Thread Malcolm Tredinnick

Hey Joe,

On Sun, 2007-05-06 at 11:53 -0700, Joseph Heck wrote:
> I'm missing the connection in newforms to get to the pieces I want to
> manipulate in the templates.
> 
> I have a newform with a single ChoiceField, set up with a RadioSelect() 
> widget:
> 
> example_choices = ((1,'a'),
>  (2,'b'),
>  (3,'c'),)
> 
> class ExampleForm(forms.Form):
>   choices = 
> forms.ChoiceField(choices=example_choices,widget=forms.RadioSelect())
> 
> def exampleview(request):
>   form = ExampleForm()
>   return render_to_response('example.html', {'form': form})
> 
> When I get that into the template, I can get to the choices:
> {{form.choices}}
> which renders out the  bits.
> 
> In the newforms tests
> (http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L643),
> there's an example where it appears that you can get to the individual
> pieces of that list set, and I'd like to be able to pull those apart
> in the template and render that up a little differently from the
> default.
> 
> As far as I understand it, {{form.choices}} is handing back a
> BoundField object to the template context to work with - but I don't
> know how I can delve through that to get to the RadioFieldRenderer,
> where I can pull apart the choice list to more detail.
> 
> I'm hoping that I can write out something like this in a template to
> style it up a little differently:
> 
> 
> {% for rb in form.choices.something %}
> {{ rb }}
> {% endfor %}
> 
> Or even break it down farther and use rb.name, rb.value,
> rb.choice_value, and rb.choice_label to display up the radio button
> selection pieces. "rb" in this case being the RadioInput objects that
> are shown in the tests at
> http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L655

You can't get to this information directly from templates using this
widget, because the function calls you need to make to cause the
rendering to happen all require arguments. Part of the implicit design
philosophy in template variable access is that although you can call
methods on the instance, they should be methods that act like attributes
or properties: be able to work out the result completely from a
knowledge of "self", without requiring external arguments.

One solution to your problem requires a change to core. It looks like a
change that isn't harmful and might be useful, though, so it's worth
considering. We could change BoundField.as_widget() so that the "widget"
parameter had a default of None and, in that case, the code used
"self.field.widget" as the value for "widget". 

Then you could get access to the RadioInput objects by iterating over
form.choices.as_widget in your example. This works because the
as_widget() method returns the result of RadioSelect.render(), which is
a RadioFieldRenderer instance, which is an iterator over RadioInput
classes.

The argument against making this change is that as far as I can work
out, it's really only useful for the RadioSelect case, which implies we
might be making a fix in the wrong place and should be looking at
RadioSelect instead. I'm wondering if making RadioFieldRenderer an
attribute of the RadioSelect class is another solution. Then you could
sub-class RadioFieldRenderer to return whatever you want (you only have
to override __unicode__) and just use it normally. The argument against
this "argument against" is that then the HTML fragment specifying how a
line is to be formatted is out of control of the template designers and
back into programming country, which is why I suggested the first
solution first. I'm still tossing the ideas over in my mind, but would
be interested to hear other thoughts.

As far as I can tell, there's no clean way to get the access you want
without hacking on core. BoundField is the thing producing the string
you want to poke around inside of and that is intimately tied to Form
(sensibly so, since there's no real need to be able to massively
customise it).

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