Problem logging in to admin using Safari

2008-06-22 Thread Pieter Claerhout

Hi all,

I've started playing with Django and stumbled upon a very strange problem.

I've created a small test application with just a single app in there
which renders some static HTML. I've also enabled the automatic admin
side which seems to work just fine when I run the development server.

I've then moved the whole thing to MacOSX Leopard using the built-in
Apache and mod_python 3.3.1. Everything works fine as well, except for
the admin side on Safari. Whenever I try to login to the admin side on
Safari, I get the message:

Looks like your browser isn't configured to accept cookies. Please
enable cookies, reload this page, and try again.

If I try the same on Windows IE, Windows FireFox, Mac Firefox, it
works just fine.

I've tried emptying the cache of safari, but that didn't change a
thing. I've also recreated the db and flushed the session table, but
again, no difference.

Here's the mod_python config I'm using:



ServerName django_test.local


SetHandler python-program
PythonDebug Off
PythonAutoReload Off
PythonInterpreter django_test
PythonHandler django.core.handlers.modpython
PythonPath "['/web_projects'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE django_test.settings


Alias /media "/Library/Python/2.5/site-packages/django/contrib/admin/media"

AllowOverride None
Order allow,deny
Allow from all


SetHandler None




Anyone an clue what could be causing this? I'm using django-trunk (rev
7725) on MacOS X 10.5.3.

Cheers,


pieter

-- 
pieter claerhout . [EMAIL PROTECTED] . http://www.yellowduck.be/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



ordering in the ManyRelatedManager object

2008-06-22 Thread Bing

Hi,

I have a general question regarding the ordering in
the ManyRelatedManager object.  For example,
There are two classes in my model:  one is
called Book for books and another is Author for authors.

A many-to-many field is defined  in class Book
authors = models.ManyToManyField(Author)

In database, the many-to-many relationship
is described in an additional table book_author
with three columns: (id, book_id, author_id)

Now for a Book object b, both b.authors.all() and b.authors.iterator()
are sorted in the order of book_author.author_id.
But what I want is to retrieve the authors of b
in the order of book_author.id because this is
the right order of the authors.

Any solution? Many thanks in advance!



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



custom form with admin look and feel

2008-06-22 Thread chefsmart

I'm using django svn trunk. I have created several custom forms that
show up in the admin section of the website. However, these forms look
nothing like the admin forms. I tried extending change_form.html
template - unsuccessfully.

Does anyone know what my template should contain to achieve admin look
and feel.

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



Any suggestions on encryption methodology?

2008-06-22 Thread Tye

Say - for the sake of example - I'm accepting highly sensitive  
financial data through a form over SSL.

Staff members need to retrieve that information at a later time.

Meanwhile, I want that data to be encrypted while it's sitting in the  
database. What do you suggest?

Sent from my iPhone

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: dynamically filling ChoiceField

2008-06-22 Thread Calvin Dodge

On Jun 22, 8:08 pm, "Rishabh Manocha" <[EMAIL PROTECTED]> wrote:
> Some more details would be good, but off the top of my head, something like
> this might work:
>
> def my_view(request):
>form = MyForm()
>form.fields['mychoice'].choices = ((1,'ABC'),(2,'XYZ'))

Thanks - that's exactly what I needed.

Calvin Dodge
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



dynamic value of a ModelChoiceField

2008-06-22 Thread [EMAIL PROTECTED]

In a form, I have a field defined as ModelChoiceField

class myForm(forms.Form)
  myfield = forms.ModelChoiceField(MyClass.objects.all())
 myfield2 = forms.CharField()

My problem is that I cant seem to dynamically set the value that the
user selected for this field. When ever, user edits the record, this
select list always gets set to no value instead of the value that the
user had originally selected.

the input text field has no problems in showing the saved data
correctly.

am I missing something ?

thnx,
-p
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: dynamically filling ChoiceField

2008-06-22 Thread Rishabh Manocha
Some more details would be good, but off the top of my head, something like
this might work:

def my_view(request):
   form = MyForm()
   form.fields['mychoice'].choices = ((1,'ABC'),(2,'XYZ'))

I havent' been able to test this out, so make sure you do before you using
it.

You can of-course do any amount of pre-processing before you apply that
tuple.

Best,

Rishabh

On Mon, Jun 23, 2008 at 8:25 AM, Calvin Dodge <[EMAIL PROTECTED]> wrote:

>
> I've been tearing out what little hair I have left trying to figure
> this out.
>
> How do I dynamically fill a ChoiceField by filtering on a value known
> to the URLView? Every "dynamic fill" example I've found assumes the
> form knows it all - I haven't seen anything which shows me how to pass
> that value from the view to the form.
>
> Help? Please?
>
> Calvin Dodge
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



dynamically filling ChoiceField

2008-06-22 Thread Calvin Dodge

I've been tearing out what little hair I have left trying to figure
this out.

How do I dynamically fill a ChoiceField by filtering on a value known
to the URLView? Every "dynamic fill" example I've found assumes the
form knows it all - I haven't seen anything which shows me how to pass
that value from the view to the form.

Help? Please?

Calvin Dodge
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: gathering a group for a new web2 project

2008-06-22 Thread Tye

More details?

On Jun 22, 10:35 am, José Moreira <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> i have a web2 project i'm working on, there's some stuff already done
> but i'm considering scratching up in django.
>
> i'm working alone and it would be great to gather up a team.
>
> anyone interest let me know.
>
> best of luck
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Choosing between User.first_name/last_name & username

2008-06-22 Thread Stuart Grimshaw

On Jun 22, 11:48 pm, Nathaniel Whiteinge <[EMAIL PROTECTED]> wrote:
> Stuart Grimshaw wrote:
> > but it was throwing syntax errors on "player.player.first_name == '' ?
> > player.player.username : player.player.first_name)"
>
> It looks like you're trying to use a ternary operator here, but only
> Python 2.5 and later has one (and the syntax is different [2]). The

Thanks Nathaniel, I'm on 2.5, but was just using the wrong syntax ,,,

> good news is that you can accomplish what you want without using a
> ternary operator since Python boolean operators return values instead
> of just true or false [1]. Try the following instead::
>
>     swap_players_form.fields['side_a'].choices = [(
>             player.player.id,
>             player.player.first_name or player.player.username
>         ) for player in side_a]
>
> I similar idiom that I make frequent use of if I don't require that a
> user enter a first or last name and therefore need to use the username
> as a fallback is the following. (Note the built-in Django method
> ``get_full_name`` always returns a string, but the first name or the
> last name can be empty.)::

I was going for the full name, but using first_name as a starting
point, I figured if that was blank, they probably both were.

Thanks for pointing out get_full_name and for the introspection stuff
too, just what I needed.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Help with mod_python and dynamic vhosts

2008-06-22 Thread Brian Ritchie
Hello all,

My first post to this mailing list.  I didn't see this in the archive.  It
this was covered before, sorry about that.

I have a webserver (Ubuntu, Apache2) with dynaminc vhosts setup. I'm
experimenting with django a bit and I tried to setup the byteflow blog by
adding a subdomain of http://blog.mysite.com (note: not the real URL :P).  I
followed the instructions shown here...

http://blog.leschinsky.in.ua/2008/02/05/byteflow-installation/
http://blog.leschinsky.in.ua/2008/02/05/byteflow-setup/

Installation went smoothly but the apache2 setup isn't right. Those
isntructions are meant for a more simple apache2 setup. I'm not the most
knowledgeable when it comes to setting up Apache2 vhosts (using the
sites_available and sites_enabled directories), so I can't get it to work. I
had some fellow programmers help me but they were not familiar with this
type of apache2 setup either. Here is the basic byteflow config that I
used...

NameVirtualHost *:80

   ServerAdmin [EMAIL PROTECTED]
   ServerName blog.mysite.com


  SetHandler python-program
  PythonHandler django.core.handlers.modpython
  SetEnv DJANGO_SETTINGS_MODULE settings
  PythonDebug On
  PythonPath "['/home/me/django-src/byteflow' ] + sys.path"


Alias /static/ /home/me/django-src/byteflow/static/

  SetHandler None


Alias /admin-media/
/home/me/django-src/django_trunk/django/contrib/admin/media/

  SetHandler None



ErrorLog /var/log/apache2/byteflow.log
LogLevel warn
CustomLog /var/log/apache2/byteflow.log combined
 

That *almost* works. Under certain variations of this configuration, I can
see the blog and I know that the blog is functional. The problem is that
this config causes all of my dynamic vhost domains to display the blog
(eek!). I've tried variations of this where I placed my full URL
blog.mysite.com:80 for the NameVirtualHost and VirtualHost lines, including
removing NameVirtualHost from this config. It seems that I can get either
one of two results. I can get the blog to appear on all of my sites or I can
get the blog.mysite.com to point to /www/blog.mysite.com/ (which is blank)
like the rest of my dynamic vhosts.

My dynamic_vhosts config has this...


Options Indexes FollowSymLinks MultiViews
DirectoryIndex index index.html index.php index.phtml

AllowOverride All
Order allow,deny
Allow from all


 #the IP of my server
# Get servername from Host: header
UseCanonicalName Off

# this log format can be split per-virtual-host based on the first field
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
LogFormat "%V %h %l %u %t \"%r\" %>s %b \"%{Referer}i\"\"%{User-Agent}i\""
vcombined
CustomLog /var/log/apache2/access_vhost_log vcombined

#
# include the server name in the filenames used to satisfy requests
VirtualDocumentRoot /www/%0/public_html
VirtualScriptAlias  /www/%0/cgi-bin
#
#   This configuration can be changed into an IP-based virtual hosting
#   solution by just turning UseCanonicalName Off into UseCanonicalName DNS.
#   The server name that is inserted into the filename is then derived from
#   the IP address of the virtual host.


So I'm looking for a mix of dynamic vhosts for all of my domains except one
select vhost that gets handled by mod_python.
Any insight would be helpful.  Thanks.

Brian

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



media server implementation - context processor, custom template tag, or custom filter

2008-06-22 Thread alex

I already have {{ MEDIA_URL }} set in html, css, and js templates and
that's working great. I would like to start setting far future caching
headers on media files based on the git abbreviated commit hash for
each file. i can think of three options for implementing this and
would appreciate feedback, especially in regard to the processing or
performance penalties any of these approaches may incur. i've
implemented proof-of-concept versions of all of them in development
and they at least accomplish what I want, though I haven't yet done
any benchmarking.

as part of the production deployment process, a script is run which
essentially does the following: for every static media file, find the
git abbreviated commit hash which looks like "857vb4". the results are
written to disk as a python dictionary:

STATIC_ASSETS = {
"/media/image/button.png": "/857vb4",
"/media/image/submit.png": "/219cb3",
etc.
}

the dictionary has approx 100 entries and may grow to 200.

all of the approaches below generate html like this:

http://media.example.com/857vb4/media/image/button.png;>
http://media.example.com/219cb3/media/image/submit.png;>

but the actual paths on disk do not include version numbers. apache
has a re-write rule which removes the revision information, so that
clients can be told to cache the static files for a long time into the
future because whenever the file changes, the revision number in the
url will change. here are some ways i've come up with for adding the
revision info to the static file urls.

1) simple string filter
templates look like this: 
and the template filter is approx:

@register.filter
@stringfilter
def get_file_version(value, arg):
if arg in STATIC_ASSETS:
value = STATIC_ASSETS[arg] + arg;
else:
value = arg;
return value

2) simple custom template tag
templates look like: 

template tag code:

@register.simple_tag
def get_file_version(arg):
value = arg
if arg in ASSET_LIST:
value = ASSET_LIST[arg] + arg;
return value

The third option would be a custom context processor which adds
template variables to each page that are tied to the filename.

Are these approaches reasonable or do they incur too much processing
for, say, a page that has 10 or 20 static files (images, js, css)? Is
there a better way I'm overlooking? I'm trying to avoid approaches
which rename files on disk or do find-and-replace operations on
template files.

Any feedback appreciated.

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



Re: GeoDjangoFriendly?

2008-06-22 Thread Tyler Erickson


After mulling over the pros and cons of Slicehost vs. Webfaction hosting for
GeoDjango, I ended up going with Slicehost.  I recorded the steps I used to
setup GeoDjango on Slicehost in case anyone else wants to do the same...
http://blog.tylerickson.net/2008/06/geodjango-on-slicehost-getting-started-1-of-4/
http://blog.tylerickson.net/2008/06/geodjango-on-slicehost-getting-started-1-of-4/
  

- Tyler


Tyler Erickson-3 wrote:
> 
> 
> Alex,
> 
> I would be interested in hearing if your remaining issues with the
> GeoDjango install get resolved.
> 
> Following the WebFaction forum post, it looks like there is another
> user with a successful GeoDjango install (overcoming a GEOS config
> problem).
> http://forum.webfaction.com/viewtopic.php?id=957
> 
> I'm still undecided on WebFaction vs. SliceHost... both seem to have
> their advantages.  For now I think I will just wait and watch for a
> little while...
> 
> - Tyler
> 

-- 
View this message in context: 
http://www.nabble.com/GeoDjangoFriendly--tp17045299p17984713.html
Sent from the django-users mailing list archive at Nabble.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: Choosing between User.first_name/last_name & username

2008-06-22 Thread Nathaniel Whiteinge

Stuart Grimshaw wrote:
> but it was throwing syntax errors on "player.player.first_name == '' ?
> player.player.username : player.player.first_name)"

It looks like you're trying to use a ternary operator here, but only
Python 2.5 and later has one (and the syntax is different [2]). The
good news is that you can accomplish what you want without using a
ternary operator since Python boolean operators return values instead
of just true or false [1]. Try the following instead::

swap_players_form.fields['side_a'].choices = [(
player.player.id,
player.player.first_name or player.player.username
) for player in side_a]

I similar idiom that I make frequent use of if I don't require that a
user enter a first or last name and therefore need to use the username
as a fallback is the following. (Note the built-in Django method
``get_full_name`` always returns a string, but the first name or the
last name can be empty.)::

user.get_full_name() or user.username

.. [1] http://www.diveintopython.org/power_of_introspection/and_or.html
.. [2]

The Python 2.5 ternary operator syntax::

value_when_true if condition else value_when_false

is equivalent to::

cond ? valueIfTrue : valueIfFalse
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Ticket: Doc error on reverse()

2008-06-22 Thread [EMAIL PROTECTED]

There are 2 reverse() methods defined in that file, one of them is a
method on the RegexURLResolver class which has the signature that you
suggest, the other is the one imported with from
django.core.urlresolvers import reverse, and it has that signature.

On Jun 22, 4:31 pm, Aral Balkan <[EMAIL PROTECTED]> wrote:
> Sorry to send this to the list but I cannot post tickets on your
> ticket tracker (I keep getting Error 500: Ticket flagged as potential
> spam).
>
> Ticket I was trying to open follows:
>
> * * *
>
> The docs athttp://www.djangoproject.com/documentation/url_dispatch/#reverse
> state that the reverse() function has the following signature:
>
> reverse(viewname, urlconf=None, args=None, kwargs=None)
>
> Whereas it is actually:
>
> reverse(self, lookup_view, *args, **kwargs):
>
> i.e., all args are required (Latest Django trunk from SVN).
>
> * * *
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Ticket: Doc error on reverse()

2008-06-22 Thread Aral Balkan

Sorry to send this to the list but I cannot post tickets on your
ticket tracker (I keep getting Error 500: Ticket flagged as potential
spam).

Ticket I was trying to open follows:

* * *

The docs at http://www.djangoproject.com/documentation/url_dispatch/#reverse
state that the reverse() function has the following signature:

reverse(viewname, urlconf=None, args=None, kwargs=None)

Whereas it is actually:

reverse(self, lookup_view, *args, **kwargs):

i.e., all args are required (Latest Django trunk from SVN).

* * *

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



User Templates

2008-06-22 Thread Dan

I am looking for a way to enable users to make template to control the
presentation of reports that they would require. I am looking for the
most flexible to them and most secure to me way to do this. I want to
be careful since the data serve would come from my domain and thus be
vulnerable to origin-domain tricks. I can't have users write django
templates as they could put infinite loops or other nastinesses in
them.

Do you have an idea how I might achieve this? The resulting report do
not need to be HTML, if something nice can be made with PDF or
anything else, I'm open to it.

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



Choosing between User.first_name/last_name & username

2008-06-22 Thread Stuart Grimshaw

As part of my sign up process, I don't require that people fill in
their first/last name, and just choose to show the username if no name
is entered.

Unfortunatly, I've come across a bit of code that I can't do this in,
which has got me thinking, I'm doing this all over the show, so there
must be a better way of doing it.

Ideally I'd like to just override the __unicode__ of the User method,
but I've been reading about the kerfuffle involved doing that, so does
anyone have any other bright ideas?

The problem that kicked all this off was that I was trying something
like this:

swap_players_form.fields['side_a'].choices = [(player.player.id,
player.player.first_name == '' ? player.player.username :
player.player.first_name) for player in side_a]

but it was throwing syntax errors on "player.player.first_name == '' ?
player.player.username : player.player.first_name)", if I could get
this method to work for now to let me move on that'd be a start.

Any ideas anyone?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



EmailMultiAlternatives send error

2008-06-22 Thread MrJogo

I'm sending a user-submitted form using EmailMultiAlternatives. From
my view, I'm calling a helper function in a different file (but in the
same directory) to actually compose and send the email. When I send
the message from this helper function (using msg.send()), I get a
Server Error page. When, however, I return the message, and send it
from views.py, it sends fine. Anyone know why?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: display m2M in admin view in 0.96

2008-06-22 Thread bussiere maillist

i will try tomorow thanks

On Sun, Jun 22, 2008 at 6:42 PM, Karen Tracey <[EMAIL PROTECTED]> wrote:
> On Sun, Jun 22, 2008 at 6:19 AM, bussiere maillist
> <[EMAIL PROTECTED]> wrote:
>>
>> how can i display object in a m2M field ?
>> i've tried with the dem function but it didn't work
>>
>> regards
>> Bussiere
>>
>> class Agent(models.Model):
>>nom = models.CharField(maxlength=60)
>>service = models.ForeignKey(Service)
>>telephone = models.CharField(maxlength=60,blank=True,null=True)
>>email = models.EmailField(blank=True,null=True)
>>def __str__(self):
>>return self.nom
>>class Admin:
>>pass
>>
>> class Entreprise(models.Model):
>>nom = models.CharField(maxlength=60)
>>service = models.ForeignKey(Service)
>>telephone = models.CharField(maxlength=60)
>>email = models.EmailField(blank=True,null=True)
>>def __str__(self):
>>return self.nom
>>class Admin:
>>pass
>>
>>
>>
>> class Intervention(models.Model):
>>state = models.CharField(maxlength=10,choices=State_Choices)
>>description  = models.ManyToManyField(Description,blank=True,null=True)
>>date_crea = models.DateTimeField('date_crea',blank=True,null=True)
>>date_ferm = models.DateTimeField('date_ferm',blank=True,null=True)
>>demandeur =
>>
>> models.ManyToManyField(Agent,blank=True,null=True,related_name='demandeur')
>>concerne =
>> models.ManyToManyField(Agent,blank=True,null=True,related_name='concerne')
>>service = models.ManyToManyField(Service,blank=True,null=True)
>>intervenant = models.ManyToManyField(Entreprise,blank=True,null=True)
>>note = models.ForeignKey(Note,blank=True,null=True)
>>solution = models.ForeignKey(Solution,blank=True,null=True)
>>typepanne = models.ForeignKey(TypePanne,blank=True,null=True)
>>upload_image =
>> models.ImageField(upload_to='images',blank=True,null=True)
>>upload_file = models.FileField(upload_to='files',blank=True,null=True)
>>
>>def dem(self):
>>string = ''
>>for agent in self.demandeur :
>>string = agent
>>return str(string)
>>
>
> First, you are overwriting, not adding to, 'string' on each iteration of the
> loop.  Second self.demandeur is a ManyRelatedManager which you cannot
> iterate through.  If you want to iterate through the items in the set you
> have to call .all() on the ManyRelatedManager.  Something like (untested)
> should do it:
>
> def dem(self):
> return ' '.join([str(agent) for agent in self.demandeur.all()])
>
> Karen
>
> >
>

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



Complex URLs and numerous GET variables

2008-06-22 Thread [EMAIL PROTECTED]

Hi

I've got a bit of a problem as I'm now wishing to use more complex
urls on my app and I'm not sure how to go about doing it the Django
way.

I've got an online store that can have filters placed on it like
Price, Make, Category.

Thing is when I wanted to use one of those it was simple:

example.com/shop/cat/widgets

However, I now want to use all of them.  I did think I could do:

example.com/shop/widgets/250-500/FoobarCompany

But it seems dodgy.

Can anyone point me in the right direction on this?  I'm a bit lost.

Really appreciate your input. :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



gathering a group for a new web2 project

2008-06-22 Thread José Moreira

Hi all,

i have a web2 project i'm working on, there's some stuff already done
but i'm considering scratching up in django.

i'm working alone and it would be great to gather up a team.

anyone interest let me know.

best of luck

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 best to delete one of multiple records?

2008-06-22 Thread Kenneth McDonald

I have a list of records, and I'd like the user to be able to delete  
any given record by pressing a button. My current strategy is to have  
each record in its own form (so that pressing the submit button for  
that form would delete the record), and have each form contain a  
hidden field identifying the corresponding record via a unique key so  
that I know which record to delete. However, this is very crude, and  
no doubt indicative of the fact that I'm still just starting to learn  
Django. What would people suggest as better alternatives? Feel free to  
point me to documentation--I don't mind doing the reading, it's just  
finding the relevant material that's a problem (there's so much of  
it :-) ).

Thanks,
Ken

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Thanks!!!!!!!!!!!!!!!!!

2008-06-22 Thread Andre Meyer
me too:

django is the best in design, features, documentation and community

just awesome!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: display m2M in admin view in 0.96

2008-06-22 Thread Karen Tracey
On Sun, Jun 22, 2008 at 6:19 AM, bussiere maillist <
[EMAIL PROTECTED]> wrote:

>
> how can i display object in a m2M field ?
> i've tried with the dem function but it didn't work
>
> regards
> Bussiere
>
> class Agent(models.Model):
>nom = models.CharField(maxlength=60)
>service = models.ForeignKey(Service)
>telephone = models.CharField(maxlength=60,blank=True,null=True)
>email = models.EmailField(blank=True,null=True)
>def __str__(self):
>return self.nom
>class Admin:
>pass
>
> class Entreprise(models.Model):
>nom = models.CharField(maxlength=60)
>service = models.ForeignKey(Service)
>telephone = models.CharField(maxlength=60)
>email = models.EmailField(blank=True,null=True)
>def __str__(self):
>return self.nom
>class Admin:
>pass
>
>
>
> class Intervention(models.Model):
>state = models.CharField(maxlength=10,choices=State_Choices)
>description  = models.ManyToManyField(Description,blank=True,null=True)
>date_crea = models.DateTimeField('date_crea',blank=True,null=True)
>date_ferm = models.DateTimeField('date_ferm',blank=True,null=True)
>demandeur =
> models.ManyToManyField(Agent,blank=True,null=True,related_name='demandeur')
>concerne =
> models.ManyToManyField(Agent,blank=True,null=True,related_name='concerne')
>service = models.ManyToManyField(Service,blank=True,null=True)
>intervenant = models.ManyToManyField(Entreprise,blank=True,null=True)
>note = models.ForeignKey(Note,blank=True,null=True)
>solution = models.ForeignKey(Solution,blank=True,null=True)
>typepanne = models.ForeignKey(TypePanne,blank=True,null=True)
>upload_image =
> models.ImageField(upload_to='images',blank=True,null=True)
>upload_file = models.FileField(upload_to='files',blank=True,null=True)
>
>def dem(self):
>string = ''
>for agent in self.demandeur :
>string = agent
>return str(string)
>
>
First, you are overwriting, not adding to, 'string' on each iteration of the
loop.  Second self.demandeur is a ManyRelatedManager which you cannot
iterate through.  If you want to iterate through the items in the set you
have to call .all() on the ManyRelatedManager.  Something like (untested)
should do it:

def dem(self):
return ' '.join([str(agent) for agent in self.demandeur.all()])

Karen

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



Re: Add db tables on-the-fly

2008-06-22 Thread Ned Batchelder
Creating a table per user is definitely going against the grain in a 
relational database world.  You'll be much happier with one table to 
store the data across users, with a foreign key to the users table to 
keep everything straight.

--Ned.
http://nedbatchelder.com

MickaelC wrote:
> It is not really a problem
> It's for a multi user app. For each new users, i create a serie table
> or all data in the same table?
> If it's easy to create table on-the-fly when a new user registers, i
> prefere.
>
> but I do not see how
>
> MickaelC
> (Désolé for my English)
>
> On 22 juin, 14:07, Christian Joergensen <[EMAIL PROTECTED]> wrote:
>   
>> MickaelC wrote:
>> 
>>> Hi,
>>> It is a method to add tables to a model without having to manually
>>> launch the syncdb command in a shell?
>>>   
>>> If yes
>>> can you give me tips ?
>>> else
>>> :-(
>>>   
>> What problem are you trying to solve? This really doesn't sound like a
>> common Django idiom.
>>
>> If you insist, you could probably do (using 0.96):
>>
>>from django.core.management import syncdb
>>syncdb()
>>
>> Regards,
>>
>> --
>> Christian Joergensenhttp://www.technobabble.dk
>> 
> >
>
>
>   

-- 
Ned Batchelder, http://nedbatchelder.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: auth context processor setup

2008-06-22 Thread mcordes

That was it. 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: auth context processor setup

2008-06-22 Thread Nick Sandford

On Sun, Jun 22, 2008 at 10:20 PM, mcordes <[EMAIL PROTECTED]> wrote:
>
> I seem to already have the auth middleware enabled too. From what I'm
> seeing, generic views _do_ have the user object available in their
> templates. It's just my custom views that don't automatically have
> this. It's easy enough for me to pass in the request.user object from
> each of my templates, but I really thought I wouldn't need to do this.

render_to_response doesn't use a RequestContext whereas the generic views do.

To enable this in render_to_response try:
from django.template import RequestContext
...
render_to_response('some/template.html',
context_instance=RequestContext(request))

Hope this helps,
Nick

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: very heavy problem with edit_inline

2008-06-22 Thread Alessandro Ronchi
Is it possible to add a link on my foreignkeys to edit the external reference?

It's strange it's possible to add a new referenced object but not open
an existing one and edit it. It should be very very useful.

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: auth context processor setup

2008-06-22 Thread Vasiliy Gladkov

Maybe you forgot to use context_instance parameter in render() call?
If you want to use context processors, it must look like

return render_to_response('template.html', context,
context_instance=RequestContext(request))

context_instance parameter passes contexts from processors to your
templates

On 23 июн, 00:20, mcordes <[EMAIL PROTECTED]> wrote:
> I seem to already have the auth middleware enabled too. From what I'm
> seeing, generic views _do_ have the user object available in their
> templates. It's just my custom views that don't automatically have
> this. It's easy enough for me to pass in the request.user object from
> each of my templates, but I really thought I wouldn't need to do this.
>
> -Matt
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Thanks!!!!!!!!!!!!!!!!!

2008-06-22 Thread Alex Morega

+1


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



Re: Add db tables on-the-fly

2008-06-22 Thread MickaelC

It is not really a problem
It's for a multi user app. For each new users, i create a serie table
or all data in the same table?
If it's easy to create table on-the-fly when a new user registers, i
prefere.

but I do not see how

MickaelC
(Désolé for my English)

On 22 juin, 14:07, Christian Joergensen <[EMAIL PROTECTED]> wrote:
> MickaelC wrote:
> > Hi,
> > It is a method to add tables to a model without having to manually
> > launch the syncdb command in a shell?
>
> > If yes
> >     can you give me tips ?
> > else
> >     :-(
>
> What problem are you trying to solve? This really doesn't sound like a
> common Django idiom.
>
> If you insist, you could probably do (using 0.96):
>
>    from django.core.management import syncdb
>    syncdb()
>
> Regards,
>
> --
> Christian Joergensenhttp://www.technobabble.dk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Having problems with regroup on datetime

2008-06-22 Thread Darthmahon

Not sure what happened, but I fixed this by doing this:

{% regroup event_list by date.date as events %}
{% for event in grouped %}
{{ event.grouper|date:"l jS F" }}
{% for event in events.list %} {{ event.title }} {% endfor %}
{% endfor %}

On Jun 22, 1:01 pm, Darthmahon <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am trying to group a list of events using the regroup template tag
> as such:
>
> {% regroup event_list by date as events %}
>
> {% for event in events %}
> {{ event.grouper.day }}
> {% for event in events.list %} {{ event.title }} {% endfor %}
> {% endfor %}
>
> Now, in my model for Events, I am using a datetime field so when I do
> the regroup, unless the events are EXACTLY the same time, they will
> print seperate H2's.
>
> Using the code above it looks like this:
>
> Saturday 22nd
> - Event 1
>
> Saturday 22nd
> - Event 2
>
> I want it to look like this:
>
> Saturday 22nd
> - Event 1
> - Event 2
>
> Any ideas? I know it has something to do with the datetime field
> having the date and time, I just want it to have the date so I can
> regroup on that.
>
> Cheers,
> Chris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: auth context processor setup

2008-06-22 Thread mcordes

I seem to already have the auth middleware enabled too. From what I'm
seeing, generic views _do_ have the user object available in their
templates. It's just my custom views that don't automatically have
this. It's easy enough for me to pass in the request.user object from
each of my templates, but I really thought I wouldn't need to do this.

-Matt
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



display m2M in admin view in 0.96

2008-06-22 Thread bussiere maillist

how can i display object in a m2M field ?
i've tried with the dem function but it didn't work

regards
Bussiere

class Agent(models.Model):
nom = models.CharField(maxlength=60)
service = models.ForeignKey(Service)
telephone = models.CharField(maxlength=60,blank=True,null=True)
email = models.EmailField(blank=True,null=True)
def __str__(self):
return self.nom
class Admin:
pass

class Entreprise(models.Model):
nom = models.CharField(maxlength=60)
service = models.ForeignKey(Service)
telephone = models.CharField(maxlength=60)
email = models.EmailField(blank=True,null=True)
def __str__(self):
return self.nom
class Admin:
pass



class Intervention(models.Model):
state = models.CharField(maxlength=10,choices=State_Choices)
description  = models.ManyToManyField(Description,blank=True,null=True)
date_crea = models.DateTimeField('date_crea',blank=True,null=True)
date_ferm = models.DateTimeField('date_ferm',blank=True,null=True)
demandeur =
models.ManyToManyField(Agent,blank=True,null=True,related_name='demandeur')
concerne = 
models.ManyToManyField(Agent,blank=True,null=True,related_name='concerne')
service = models.ManyToManyField(Service,blank=True,null=True)
intervenant = models.ManyToManyField(Entreprise,blank=True,null=True)
note = models.ForeignKey(Note,blank=True,null=True)
solution = models.ForeignKey(Solution,blank=True,null=True)
typepanne = models.ForeignKey(TypePanne,blank=True,null=True)
upload_image = models.ImageField(upload_to='images',blank=True,null=True)
upload_file = models.FileField(upload_to='files',blank=True,null=True)

def dem(self):
string = ''
for agent in self.demandeur :
string = agent
return str(string)


def __str__(self):
return self.state
class Admin:
list_display = ('state','date_crea','dem')
list_filter = ('state','date_crea')
ordering = ('state','-date_crea')

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: TemplateDoesNotExist at /admin/

2008-06-22 Thread sggottlieb

I will do that.  In the meantime, I wanted to add that to make the
admin interface look pretty you need to copy the media directory as
well.

--Seth

On Jun 21, 10:24 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Sat, Jun 21, 2008 at 9:22 AM, sggottlieb <[EMAIL PROTECTED]> wrote:
> > Thanks Karen!  That was the issue.
>
> Glad that was it, and it sounds like you could fix the symptom.  To get a
> real fix implemented it would be helpful for you to post details of your
> system (new install, upgrade from an earlier OS X, whether a Macports
> version of Python had been installed, how you installed Django and what
> version) to that ticket (http://code.djangoproject.com/ticket/7414).  I
> don't think we have a good handle yet on what set of circumstances, exactly,
> causes this to happen.  Just several reports on this group of people hitting
> it and manually fixing it by copying over directories themselves.  It would
> be nice if we could do something to fix the root problem, but first someone
> has to understand when and why it is happening.  (A similar problem on
> Windows turned out to result from one and only one variant of 'python
> setup.py install' and 'setup.py install' neglecting to copy the installation
> data files, so it could be something very subtle that triggers the problem.)
>
> Thanks,
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: help - limit_choices_to

2008-06-22 Thread M.Ganesh

Karen Tracey wrote:
> On Sat, Jun 21, 2008 at 9:23 PM, M.Ganesh <[EMAIL PROTECTED] 
> > wrote:
>
>
> Hi All,
>
> This question might have been answered so may times, but I am
> unable to
> glean the information I am looking for from the 260 odd entries that
> turn up while searching the mailing-list archives. So here I ask again
>
> #my models
> class entity(models.Model):
>name = models.Charfield()
>
> class address(models.Model):
>entity = models.FK(entity)
>  #entites can
> have multiple addresses
>street_address = models.TextField(...)
>
> class despatch(models.Model):
>sent_to = models.FK(entity, related_name = 'receiver')
>address = models.FK(address)
>sent_by = models.FK(entity, related_name = 'sender')
>
> Now when I show a form to enter 'despatch' data, after the user
> selects
> the sent_to 'sent_to' address, I want to show only the addresses
> of that
> entity in the 'address' selection. How do I do it?
>
> Note : I don't know java scripts, AJAX etc yet. If the above can be
> achieved only using  these,  then a  small  code snippet  will
>  help me
> start
>
>
> I have not had to do this myself, so have no code snippet to share.  
> It does seem like a commonly-discussed thing, but in a quick Google 
> search I didn't find anything that matched exactly.  This page:
>
> http://remysharp.com/2007/01/20/auto-populating-select-boxes-using-jquery-ajax/
>
> discusses doing exactly what you want with jQuery and Ajax...and PHP.  
> So not quite what you are looking for.  But this page:
>
> http://www.packtpub.com/article/enhancing-the-user-interface-with-ajax
>
> discusses adding jQuery to a Django app and doing other cool stuff 
> with it. So probably you can glean bits of information from both and 
> put it together to do what you are looking for.  I do believe you need 
> to learn a little Javascript/Ajax to do this.
>
> Karen
Thanks Karen for the leads. I'll follow those breadcrumbs

Regards Ganesh


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: has_perm() equivalent for group membership...

2008-06-22 Thread Alessandro Ronchi
2008/6/22, chefsmart <[EMAIL PROTECTED]>:
>
>  has_perm() checks whether a user has_certain_permission. Is there a
>  similarly elegant way to check whether a user
>  belongsTo_certain_group ?

if certain_group in user.groups.all():
  print "The user is in certain_group!"

Maybe you can try also the get:
if user.groups.get("certain_group"):
-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



New site - any comments please on structure / bugs/ security holes etc etc.

2008-06-22 Thread Richard Green

Hi there - I've just put a noddy site together so that I could give
myself a real goal for getting a django based site running. I've got a
few bigger internet ideas but I thought I'd do something small to
start with to test the feasility of writing it in django, before
embarking on a route using technology that might not be fit for
purpose... Obviously if I've reached this point then its fair to say
that I think I may well be using django for the bigger projects (or
I'd be posting on another site!!)

Anyway - my site is at : www.scareports.com  - I'm trying to collect
stories of (basically) horrid things that happen at airports mainly
due to the draconian security measures that governments will think
will stop terrorists etc etc. I remember a time when flying was fun
but now it seems to be a lottery just getting to the airplane. I chose
this subject as it seems everyone has a story to tell ( a friend of
mine - for example - was told to put her BABY through the luggage xray
machine; thankfully she flatly refused )..

If you have 5 minutes - and I'm not trying to pimp the site but just
my usage of django - please drop in and let me know if you see any
problems / faults etc. I'm especially interested in security holes of
any type. I've set up the emails via google for apps and I'm not sure
if it's activated yet so don't write to me at [EMAIL PROTECTED] but
please comment on this thread.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Serving media from Django only in development [Trick]

2008-06-22 Thread Kless

urls.py
-
from django.conf import settings


# Serves media content. WARNING!! Only for development uses.
# On production use lighthttpd for media content.
if settings.DEBUG:

# Delete the first trailing slash, if any.
if settings.MEDIA_URL.startswith('/'):
media_url = settings.MEDIA_URL[1:]
else:
media_url = settings.MEDIA_URL

# Add the last trailing slash, if have not.
if not media_url.endswith('/'):
media_url = media_url + '/'

urlpatterns += patterns('',
(r'^' + media_url + '(?P.*)$',
'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}
),
)
-

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Multiple fields without manytomanyfield?

2008-06-22 Thread Xan

Hi,

Suposing you want a model A with several and indetermined number of
integer fields. Is there any possibility of defining A without
creating a Integer class and then add ManyToManyField(Integer) in
class A?

Thanks a lot!
Xan.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Having problems with regroup on datetime

2008-06-22 Thread Darthmahon

Hi,

I am trying to group a list of events using the regroup template tag
as such:

{% regroup event_list by date as events %}

{% for event in events %}
{{ event.grouper.day }}
{% for event in events.list %} {{ event.title }} {% endfor %}
{% endfor %}

Now, in my model for Events, I am using a datetime field so when I do
the regroup, unless the events are EXACTLY the same time, they will
print seperate H2's.

Using the code above it looks like this:

Saturday 22nd
- Event 1

Saturday 22nd
- Event 2

I want it to look like this:

Saturday 22nd
- Event 1
- Event 2

Any ideas? I know it has something to do with the datetime field
having the date and time, I just want it to have the date so I can
regroup on that.

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



Add new context processors [Trick]

2008-06-22 Thread Kless

To add any new context processor, write this on your settings file:

---
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS

TEMPLATE_CONTEXT_PROCESSORS = TEMPLATE_CONTEXT_PROCESSORS + \
('project.app.context_processors.name',)
---

So, neither that variable is overwritted neither you have to copy it
from the global settings file.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Use values of Site module on templates [SOLVED]

2008-06-22 Thread Kless

At the end, I'll get these variables directly from the Site module.

And to access to them, can be made using templatetags or context
processors -that is better for this case-.

* Templatetags
---
from django import template
from django.contrib.sites.models import Site


register = template.Library()
current_site = Site.objects.get_current()

def site_domain():
return current_site.domain

@register.simple_tag
def site_url():
return "http://www.%s; % (site_domain())

@register.simple_tag
def site_name():
return current_site.name
---

* Context processors
---
from django.contrib.sites.models import Site


def site(request):
"""Adds site-related context variables to the context.
"""
current_site = Site.objects.get_current()

return {
'SITE_NAME': current_site.name,
'SITE_DOMAIN': current_site.domain,
'SITE_URL': "http://www.%s; % (current_site.domain),
}
---

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: auth context processor setup

2008-06-22 Thread Vasiliy Gladkov

You have to enable auth middleware and application in settings.py -
http://djangobook.com/en/1.0/chapter12/
Then you can use user specific variables in your templates -
{{ user.username }}, {{ user.is_staff }} and so on

On 22 июн, 14:43, mcordes <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Is there anything I need to do to enable the auth context processor
> other than adding "django.core.context_processors.auth" to
> TEMPLATE_CONTEXT_PROCESSORS in my settings.py?
>
> I'd like to be able to access the 'auth user' object in my various
> templates, which from what I understand this processor is supposed to
> be injecting it, but it doesn't seem to be working.
>
> my settings.py file contains:
>
> TEMPLATE_CONTEXT_PROCESSORS = (
>     "django.core.context_processors.auth",
> )
>
> and in my template I'm using:
>
> {{user}}
>
> Is there anything else I need to get this to work?  Any suggestions?
>
> -Matt
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django on apache and mod_python.... and problems

2008-06-22 Thread foxbunny

On Jun 22, 5:59 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> I'm assuming you have papastudio.blog listed in INSTALLED_APPS?
>
> Does apache have read access to the whole tree under  /papastudio, including
> blog?  It seems apache can read /papastudio, otherwise you'd get an
> 'ImportError: No module named papastudio'.  Instead it can't find blog
> underneath it, which might mean it doesn't have read access to the blog
> subdirectory.  Or else it's looking in the wrong place, in which case it'll
> help if you post where the code resides in the file system and the specifics
> of how you have configured Apache.
>
> Karen

Karen, thanks a bunch! It was the exec permission, not read, but your
e-mail gave me the hint. ;)

I don't know how it happened that it lost the exec perms, but I got it
'fixed' now.


Branko
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Add db tables on-the-fly

2008-06-22 Thread Christian Joergensen

MickaelC wrote:
> Hi,
> It is a method to add tables to a model without having to manually
> launch the syncdb command in a shell?
> 
> If yes
> can you give me tips ?
> else
> :-(

What problem are you trying to solve? This really doesn't sound like a 
common Django idiom.

If you insist, you could probably do (using 0.96):

   from django.core.management import syncdb
   syncdb()

Regards,

-- 
Christian Joergensen
http://www.technobabble.dk

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Extending the method that is called the first time a model is deployed.

2008-06-22 Thread James Bennett

On Sun, Jun 22, 2008 at 4:41 AM, mwebs <[EMAIL PROTECTED]> wrote:
> It seems as if these signals have to be used in management.py, but
> what I need is something I can use directly in my model code.
> Something like overloading a method. The fact that this should be
> happen in the model-class is very important. E.g I dont want every
> model to be registerd in my "meta-model" Apps only some of my models.

I think you've misunderstood how signals work; you can selectively do
something only when a certain specific class is first loaded.


-- 
"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: Extending the method that is called the first time a model is deployed.

2008-06-22 Thread mwebs

Hi,

It seems as if these signals have to be used in management.py, but
what I need is something I can use directly in my model code.
Something like overloading a method. The fact that this should be
happen in the model-class is very important. E.g I dont want every
model to be registerd in my "meta-model" Apps only some of my models.

One Idea was to implement this kind of registration everytime a model
is instantiated and checking if there is already an entry. But this a
hack because I really need this only one time (the first time the
model is deployed.)

any ideas?

Thanks, Toni

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



has_perm() equivalent for group membership...

2008-06-22 Thread chefsmart

has_perm() checks whether a user has_certain_permission. Is there a
similarly elegant way to check whether a user
belongsTo_certain_group ?

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: User Profile in Admin interface (using trunk)

2008-06-22 Thread Alessandro Ronchi
2008/6/21, ristretto <[EMAIL PROTECTED]>:
>
>  Was there any solution to this?  I'm looking through the tickets,
>  wiki, docs, web, and now the source trying to figure out how to get my
>  profile data saved along with a User in the admin.  Anyone have that
>  working?   My situation is the same as this poster's, except I don't
>  get any error; I just get no profile record created.
>
>  If I create a new user, no profile record is created in the DB.
>
>  Incidentally, my profile model has one field which is a ForeignKey.
>
>  class UserProfile(models.Model):
> country = models.ForeignKey(Country, core=True)
> user = models.ForeignKey(User, unique=True,
>  edit_inline=models.TABULAR)

Do not use the foreignkey as core, but another field. This works:
- - - - -
user = models.ForeignKey(User, unique=True,
edit_inline=models.STACKED, num_in_admin=1,min_num_in_admin=1,
max_num_in_admin=1,num_extra_on_change=0)

nomeditta = models.CharField("Nome Ditta", max_length=100, core=True)
- - - - -
-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: very heavy problem with edit_inline

2008-06-22 Thread Alessandro Ronchi
2008/6/22, Karen Tracey <[EMAIL PROTECTED]>:
> If all fields marked core are blanked, then the object is deleted.

If you have a foreignkey with core=True, among others, it deletes also
if another core field is not blank.

I've tried also with my user:
- - - - -
user = models.ForeignKey(User, unique=True,
edit_inline=models.STACKED, num_in_admin=1,min_num_in_admin=1,
max_num_in_admin=1,num_extra_on_change=0)

nomeditta = models.CharField("Nome Ditta", max_length=100, core=True)
- - - - -

and now it works.
-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: very heavy problem with edit_inline

2008-06-22 Thread Alessandro Ronchi
2008/6/22, Alessandro Ronchi <[EMAIL PROTECTED]>:
> 2008/6/21, Scott Moonen <[EMAIL PROTECTED]>:
>
> > Yes, I think it is incorrect.  It should be set on some field that the user
>  > can type in and which must not be blank.  Then, when that field is left
>  > blank, the admin will actually delete the address.  I recommend setting
>  > core=True on the indirizzo field.

If there's more than one core=True field it doesn't work: if one of
them is deleted, the object is deleted.

expecially there's problems if the core=True is set on the ForeignKey.
Maybe it's the same problem with extending the users in another
threads.

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: very heavy problem with edit_inline

2008-06-22 Thread Karen Tracey
On Sun, Jun 22, 2008 at 3:32 AM, Alessandro Ronchi <
[EMAIL PROTECTED]> wrote:

> 2008/6/21, Scott Moonen <[EMAIL PROTECTED]>:
> > Yes, I think it is incorrect.  It should be set on some field that the
> user
> > can type in and which must not be blank.  Then, when that field is left
> > blank, the admin will actually delete the address.  I recommend setting
> > core=True on the indirizzo field.
>
> If I put core=True on more than one field, and if 1/3 of those fields
> is blank, the object is deleted, or it needs 3/3 fields blank to
> delete?
>

If all fields marked core are blanked, then the object is deleted.

BTW this core thing is gone in newforms-admin.  There's a 'delete' checkbox
next to edited-inline objects that lets you delete them in a more
straightforward manner.

Karen

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



Re: very heavy problem with edit_inline

2008-06-22 Thread Alessandro Ronchi
2008/6/21, Scott Moonen <[EMAIL PROTECTED]>:
> Yes, I think it is incorrect.  It should be set on some field that the user
> can type in and which must not be blank.  Then, when that field is left
> blank, the admin will actually delete the address.  I recommend setting
> core=True on the indirizzo field.

If I put core=True on more than one field, and if 1/3 of those fields
is blank, the object is deleted, or it needs 3/3 fields blank to
delete?

-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Add db tables on-the-fly

2008-06-22 Thread MickaelC

Hi,
It is a method to add tables to a model without having to manually
launch the syncdb command in a shell?

If yes
can you give me tips ?
else
:-(

thank you for your helps !
MickaelC

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



Re: Django Book translation (es) finished

2008-06-22 Thread Marcelo Barbero

Manuel:

En el ticket #54 me preguntan:

"Marcelo, ¿Tenes todavía presente en cuál/cuales capítulos encontraste
esto que nos reportas?."

Contestales que yo lo empecé a ver en el Capítulo 4. No sé si después
habrá más casos, pero calculo que sí.

Marcelo Barbero

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---