Re: Django serving multiple subdomain sites -- okay to use thread-locals?

2010-05-31 Thread Graham Dumpleton


On Jun 1, 1:04 pm, Kieran Farr  wrote:
> We're adapting our Django powered video site to be an open video
> platform for any user to create their own "site" using subdomains (eg
> mysite.vidplatform.com) on one Django server instance. Each "site"
> would obviously have content associated with only that site in
> addition to template and navigation customizations.
>
> Adapting the ``django-multisite`` app seems best and is working well
> on our dev server:http://github.com/shestera/django-multisite
>
> However, a number of Django developers have expressed concerns using
> thread-locals:http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser
>
> I don't see any other option besides using thread-locals to
> dynamically update SITE_ID per request.
>
> What would be another way of accomplishing this goal without thread-
> locals if indeed this is not best practice?

Irrespective of whether you use thread locals, in a multithreaded
system you are going to have that risk of one thread in your web
server potentially accessing or modifying the current state of another
thread in the system. That is simply the nature of multithreaded
systems and more so with Python where one can access just about
anything of the environment of the executing Python process, including
the stack frames of other executing threads.

If anything I would say that thread locals if used correctly are going
to be more secure than you having your own global dictionary which is
caching information keyed on the request or thread ID. This is because
in modern Python versions it would be much harder to actually get
access to the thread local instance for another thread. This is
because the thread local object is actually kept in C data structures
for the current thread and you only get given back the object instance
relevant to variable for your specific thread. To get access to that
for another thread you may require a C extension module which
traverses all the C thread state objects for other threads.

So, not sure why that warning has been given. I could understand it
for older Python versions where one may have been using Python
implementation of threading locals, ie., the threading_locals module,
as in that case data for other threads was exposed, but for latest
Python versions believe it is a bit harder to get at thread locals for
another thread. If this is not the case and it is easy to get at
thread locals for another thread, can someone post Python code as to
how.

Note that someone can take advantage of this presupposes that someone
has managed to inject code into your application from outside and have
it executed. If they can do that you probably have bigger problems to
contend with than this. What for example is there to stop someone
looking at DJANGO_SETTINGS_MODULE to work out name of settings module
and then getting that module and working out what your database
password is. They could even simply access the database using active
database handle and make arbitrary queries/changes to the database,
including stuff related to users personal details.

So, I would say that if someone has got as far as to being able to
even attempt to take advantage of it, ie., compromised your system and
can perform code injection, you are already stuffed in many many ways
and this is going to be the least of your concerns and that there is
likely much easier ways of stealing data.

Graham

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



Django serving multiple subdomain sites -- okay to use thread-locals?

2010-05-31 Thread Kieran Farr
We're adapting our Django powered video site to be an open video
platform for any user to create their own "site" using subdomains (eg
mysite.vidplatform.com) on one Django server instance. Each "site"
would obviously have content associated with only that site in
addition to template and navigation customizations.

Adapting the ``django-multisite`` app seems best and is working well
on our dev server:
http://github.com/shestera/django-multisite

However, a number of Django developers have expressed concerns using
thread-locals: http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser

I don't see any other option besides using thread-locals to
dynamically update SITE_ID per request.

What would be another way of accomplishing this goal without thread-
locals if indeed this is not best practice?

Thanks in advance for your input.

Kieran

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



Re: Built in password reset views resulting in Caught NoReverseMatch while rendering: Reverse for 'django.contrib.auth.views.password_reset_confirm'

2010-05-31 Thread Mike Dewhirst

On 1/06/2010 6:20am, Cromulent wrote:

Hi Mike,

Thanks for the response. I did think of that. My template loaders
setting is as follows:

TEMPLATE_LOADERS = (
 'django.template.loaders.app_directories.Loader',
 'django.template.loaders.filesystem.Loader',
)

all of my templates are stored in the template directory for each
individual Django application to save on cross dependencies or global
dependencies as I want to maximise the modularity of them. From
reading the docs the app_directories loader is the correct one for
this situation.


I'm not sure this is correct but that is just my own uncertainty because 
I haven't read those docs recently. However I took a different approach 
which probably came from following one of the django books.


# if templates are not found here look in app_name/templates
TEMPLATE_DIRS = (os.path.join(PROJECT_ROOT, 'templates')

My PROJECT_ROOT is the path to settings.py


The problem with the filesystem loader is that you need to specify all
your template paths in the settings file, which is something I was
trying to avoid as the app_directories loader was what I wanted.


As you can see I only specify one templates dir. If I want to use my own 
templates for an imported app (or my own for that matter) I just create 
a sub-directory in TEMPLATE_DIRS and give it the app name. Django just 
knows where to look and uses any template it finds there in preference 
to one of the same name in the installed site-packages app.


Cheers

Mike


I guess the app_directories loader works on the order of apps listed in
the INSTALLED_APPS tuple?


I don't know. You'd need to lok at the gjango source to get that.



On May 31, 2:05 am, Mike Dewhirst  wrote:

Simon

Have considered the sequence in which templates are loaded?

Seehttp://docs.djangoproject.com/en/dev/ref/settings/

If you put the filesystem template loader ahead of the app_directories
django will find your own versions named identically with django
versions and use them instead.

TEMPLATE_LOADERS = (
  'django.template.loaders.filesystem.load_template_source',
  'django.template.loaders.app_directories.load_template_source',
)

hth

Mike

On 30/05/2010 11:49pm, Cromulent wrote:




Well I got it working by changing the names of my templates to
something other than the default value. This seems like a bug to me.
Surely Django should use a provided template if it is available and
only fall back on the built in ones as an absolute last resort?
Especially as I had specified in the dictionary the correct template
name and that they were available.



On May 30, 10:41 am, Cromulentwrote:

I'm using Django 1.2.1 on Mac OS X with Python 2.6.1 if that matters.
I've read the documentation and this is what I have for my urls.py
file:



password_reset_dict = {
  'post_reset_redirect' : '/profiles/login/',
  'email_template_name' : 'registration/password_reset_email.html',
  'template_name' : 'registration/password_reset_form.html',



}



password_reset_confirm_dict = {
  'template_name' : 'registration/password_reset_confirm.html',
  'post_reset_redirect':'/profiles/login/',



}



(r'^reset/$', 'django.contrib.auth.views.password_reset',
password_reset_dict),



(r'^reset/confirm/$',
'django.contrib.auth.views.password_reset_confirm', \
password_reset_confirm_dict),



(r'^reset/done/$', 'django.contrib.auth.views.password_reset_done'),



(r'^reset/complete/$',
'django.contrib.auth.views.password_reset_complete'),



The strange thing is that when the error comes back the generic view
does not seem to be using the templates that I have specified in the
dictionary, instead the error points to the internal
password_reset_email.html template and this line in particular:



{{ protocol }}://{{ domain }}{% url
django.contrib.auth.views.password_reset_confirm uidb36=uid
token=token %}



I've done a fair bit of Googling and tried the various methods
mentioned but the ones that seemed most promising require you to
change the template and as it does not actually get to my template I'm
at a bit of a loss.



Can anyone tell me where I am going wrong with this at all?



Any help is very much 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



don't work Flatpages

2010-05-31 Thread gerram
Hi, everybody!  I tried to set Flatpages about 3 days but I could  get
only "404" error in browser. If someone had a few time look at my
settings: http://files.mail.ru/JXHUOU

Enter for admin part: user:Django, pass:Django

Regards.

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



Help: Custom ManyRelatedManager Behavior

2010-05-31 Thread Tim
Hi, I am having trouble getting the behavior I would like from a
ManyRelatedManager.

I have a many to many relationship with User and ModelB, with a join
table ModelJ. Instead of deleting items in my database, I am simply
marking them as deleted. I have a custom manager that filters out
deleted objects as a first step. Everything was working fine until I
ran across the following problem:

To access objects of ModelB that a belong to a User, say user1, I use
user1.modelb_set. Let's say user1.modelb_set returns modelb1, modelb2,
and modelb3. Finally let modelj2 describe the relationship between
user1 and modelb2.

If I set modelj2.deleted = True, I was hoping that user1.modelb_set
would only return modelb1 and modelb3. Unfortunately it still returns
all three modelb objects. I guess this is because the "deleted"
attribute is being set on the join table, and not the ModelB table.

Does anybody know how to set up custom behavior for a
ManyRelatedManager? Basically, I would like to break links between
User and ModelB by marking their ModelJ link as deleted, not actually
deleting it from the database.

Thank you,
Tim

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



Twisty Little Passages... widgets, fields, forms

2010-05-31 Thread Michael Davis
I'm trying to implement a simple grade book application using a
modelformset where the students' names are READONLY and the grades are
the only thing the teacher can edit. I've been looking for sample code
to implement the readonly portion and one fellow (on another site)
suggests I use his, but he never posts sample usage code along with
it.

He suggests I use a custom widget:
class ReadOnlyWidget(forms.Widget):
def __init__(self, original_value, display_value=None):
self.original_value = original_value
if display_value:
self.display_value = display_value
super(ReadOnlyWidget, self).__init__()
def _has_changed(self, initial, data):
return False
def render(self, name, value, attrs=None):
if self.display_value is not None:
return unicode(self.display_value)
return unicode(self.original_value)
def value_from_datadict(self, data, files, name):
return self.original_value

But I can't figure out how to set the original_value in my
application.
The "obvious" choice like:
class GradeForm(ModelForm):
student = forms.CharField(max_length=50,
widget=ReadOnlyWidget(instance))
doesn't work as I'm fairly sure instance isn't set here or if it is
how I can invoke it so it does the right thing in a modelformset.

The less obvious choice of setting it from within the form's __init__
function is currently beyond my ability as I do not understand the
code flow through here and am not sure how to instantiate the widget
from within the form's __init__ function.

Can someone point me to a good source of documentation at this level
of detail?

Thanks

Mike

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



Re: Can't access Django Dev Server.

2010-05-31 Thread Jeliuc Alexandr
Hello
1. no index page (debug off)
2. try another port
3. check for bugs in urls and views
4. recheck configurations in settings

On May 30, 3:03 am, gin tonic  wrote:
> My development server is running but when I attempt to access it at
> the localhost 127.0.0.1:8000 I receive a page not found error while my
> command shell shows no attempt to access the site.
>
> No error messages.
> No sign of a connection attempt.
>
> Anyone ever seen this before?
>
> 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Can't access Django Dev Server.

2010-05-31 Thread gin tonic
FIXED:

settings.py > was

ADMIN_MEDIA_PREFIX = ''

settings.py > is now

ADMIN_MEDIA_PREFIX = '/media/'


On May 31, 3:15 pm, gin tonic  wrote:
> Also, I can connect to other projects, just not this one. Seems like
> I'm overlooking something in settings.py or urls.py.
>
> What would cause it to give no errors while not connecting?
>
> On May 31, 1:31 pm, gin tonic  wrote:
>
>
>
> > Nope.
>
> > But, there were changes in with some of the settings when I did my
> > first upload to webfaction, but from what I can tell, I've restored
> > all my settings to their original state before the upload, but even
> > though the dev runs, I can't connect.
>
> > On May 29, 5:30 pm, Juan Hernandez  wrote:
>
> > > any firewall??
>
> > > On Sat, May 29, 2010 at 8:03 PM, gin tonic 
> > > wrote:
>
> > > > My development server is running but when I attempt to access it at
> > > > the localhost 127.0.0.1:8000 I receive a page not found error while my
> > > > command shell shows no attempt to access the site.
>
> > > > No error messages.
> > > > No sign of a connection attempt.
>
> > > > Anyone ever seen this before?
>
> > > > 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-us...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > django-users+unsubscr...@googlegroups.com > > >  groups.com>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/django-users?hl=en.

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



Re: Can't access Django Dev Server.

2010-05-31 Thread gin tonic
Also, I can connect to other projects, just not this one. Seems like
I'm overlooking something in settings.py or urls.py.

What would cause it to give no errors while not connecting?

On May 31, 1:31 pm, gin tonic  wrote:
> Nope.
>
> But, there were changes in with some of the settings when I did my
> first upload to webfaction, but from what I can tell, I've restored
> all my settings to their original state before the upload, but even
> though the dev runs, I can't connect.
>
> On May 29, 5:30 pm, Juan Hernandez  wrote:
>
>
>
> > any firewall??
>
> > On Sat, May 29, 2010 at 8:03 PM, gin tonic wrote:
>
> > > My development server is running but when I attempt to access it at
> > > the localhost 127.0.0.1:8000 I receive a page not found error while my
> > > command shell shows no attempt to access the site.
>
> > > No error messages.
> > > No sign of a connection attempt.
>
> > > Anyone ever seen this before?
>
> > > 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-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com > >  groups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.

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



Re: django-registration custom fields

2010-05-31 Thread Pankaj Singh
Thanks my problem has been resolved :)

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



not understanding the OAuth2 docs

2010-05-31 Thread pyfreak
I plan on utilizing: http://github.com/simplegeo/python-oauth2  for my
django-based Twitter app, however I'm wondering if anyone here who
understands the django example, understands it better than I do.

The first half of the page has an example for just plain Python, and
there's  a part there, where it looks like the user is prompted for a
pin.

"oauth_verifier = raw_input('What is the PIN? ')"

However, lower in the page, in the Django example, there's no mention
of this.

Another difference between the two:
 Python example:  Uses: 'http://twitter.com/oauth/authorize'

 Django:   'http://twitter.com/oauth/authenticate

   Should I just ignore that, and just simply implement the Django
example into my code, and not try to fully understand that fully right
now?  There's always later, for when I have time to really grasp the
Oauth2 flow.


My goal is to completely use "Use twitter as login", which I'm
guessing is the "three-legged" Oauth flow.

thanks,
Steve


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



Re: Can't access Django Dev Server.

2010-05-31 Thread gin tonic
Nope.

But, there were changes in with some of the settings when I did my
first upload to webfaction, but from what I can tell, I've restored
all my settings to their original state before the upload, but even
though the dev runs, I can't connect.

On May 29, 5:30 pm, Juan Hernandez  wrote:
> any firewall??
>
> On Sat, May 29, 2010 at 8:03 PM, gin tonic wrote:
>
>
>
> > My development server is running but when I attempt to access it at
> > the localhost 127.0.0.1:8000 I receive a page not found error while my
> > command shell shows no attempt to access the site.
>
> > No error messages.
> > No sign of a connection attempt.
>
> > Anyone ever seen this before?
>
> > 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-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com > groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



Importing ImageField from file or - better - generating it from another ImageField

2010-05-31 Thread Ricardo Bánffy
Hi folks

I am having huge problems wrapping my head around the ImageField field
type. I am trying to generate default thumbnails for uploaded images,
both stored as ImageField attributes. It's done this way because the
user must be able to manually edit the thumbnail if needed.

I am failing miserably at that. I went as far as to generate the
thumbnail and saving it to a specific location, but I have so far been
unable to attribute the contents of that file to the ImageField that
corresponds to the thumbnail.

Has anyone solved this problem in a simple way?

-- 
Ricardo Bánffy
http://www.dieblinkenlights.com
http://twitter.com/rbanffy

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



Re: Built in password reset views resulting in Caught NoReverseMatch while rendering: Reverse for 'django.contrib.auth.views.password_reset_confirm'

2010-05-31 Thread Cromulent
Hi Mike,

Thanks for the response. I did think of that. My template loaders
setting is as follows:

TEMPLATE_LOADERS = (
'django.template.loaders.app_directories.Loader',
'django.template.loaders.filesystem.Loader',
)

all of my templates are stored in the template directory for each
individual Django application to save on cross dependencies or global
dependencies as I want to maximise the modularity of them. From
reading the docs the app_directories loader is the correct one for
this situation.

The problem with the filesystem loader is that you need to specify all
your template paths in the settings file, which is something I was
trying to avoid as the app_directories loader was what I wanted. I
guess the app_directories loader works on the order of apps listed in
the INSTALLED_APPS tuple?

On May 31, 2:05 am, Mike Dewhirst  wrote:
> Simon
>
> Have considered the sequence in which templates are loaded?
>
> Seehttp://docs.djangoproject.com/en/dev/ref/settings/
>
> If you put the filesystem template loader ahead of the app_directories
> django will find your own versions named identically with django
> versions and use them instead.
>
> TEMPLATE_LOADERS = (
>      'django.template.loaders.filesystem.load_template_source',
>      'django.template.loaders.app_directories.load_template_source',
> )
>
> hth
>
> Mike
>
> On 30/05/2010 11:49pm, Cromulent wrote:
>
>
>
> > Well I got it working by changing the names of my templates to
> > something other than the default value. This seems like a bug to me.
> > Surely Django should use a provided template if it is available and
> > only fall back on the built in ones as an absolute last resort?
> > Especially as I had specified in the dictionary the correct template
> > name and that they were available.
>
> > On May 30, 10:41 am, Cromulent  wrote:
> >> I'm using Django 1.2.1 on Mac OS X with Python 2.6.1 if that matters.
> >> I've read the documentation and this is what I have for my urls.py
> >> file:
>
> >> password_reset_dict = {
> >>      'post_reset_redirect' : '/profiles/login/',
> >>      'email_template_name' : 'registration/password_reset_email.html',
> >>      'template_name' : 'registration/password_reset_form.html',
>
> >> }
>
> >> password_reset_confirm_dict = {
> >>      'template_name' : 'registration/password_reset_confirm.html',
> >>      'post_reset_redirect':'/profiles/login/',
>
> >> }
>
> >> (r'^reset/$', 'django.contrib.auth.views.password_reset',
> >> password_reset_dict),
>
> >> (r'^reset/confirm/$',
> >> 'django.contrib.auth.views.password_reset_confirm', \
> >> password_reset_confirm_dict),
>
> >> (r'^reset/done/$', 'django.contrib.auth.views.password_reset_done'),
>
> >> (r'^reset/complete/$',
> >> 'django.contrib.auth.views.password_reset_complete'),
>
> >> The strange thing is that when the error comes back the generic view
> >> does not seem to be using the templates that I have specified in the
> >> dictionary, instead the error points to the internal
> >> password_reset_email.html template and this line in particular:
>
> >> {{ protocol }}://{{ domain }}{% url
> >> django.contrib.auth.views.password_reset_confirm uidb36=uid
> >> token=token %}
>
> >> I've done a fair bit of Googling and tried the various methods
> >> mentioned but the ones that seemed most promising require you to
> >> change the template and as it does not actually get to my template I'm
> >> at a bit of a loss.
>
> >> Can anyone tell me where I am going wrong with this at all?
>
> >> Any help is very much 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Image deduplication and upload_to

2010-05-31 Thread Ricardo Bánffy
Thanks. I have successfully made a lobotomized version I called
OverwritingStorage that extends FileStorage and overrides
get_available_name, _save and delete (and offers a hashed_path
classmethod to be used in upload_to callables)

http://djangosnippets.org/snippets/2044/

Now my problem is not being able to wrap my head around computing an
ImageField based on another ImageField (in my case, a default
thumbnail that can be edited later)

But that deserves its own thread.

On Thu, May 27, 2010 at 6:37 AM, Nuno Maltez  wrote:
> Hi,
>
> I think it's designed to do that. See the behaviour of the
> save/get_available_name methods on core/files/storage.py (in the
> django source). Maybe you can write your own storage that overrides
> this (never tried it, but should work).
>
> Nuno
>
> 2010/5/26 Ricardo Bánffy :
>> Hi folks.
>>
>> I want to prevent the duplication of uploaded images. For that, I am
>> using the upload_to property of ImageField set to a callable that
>> computes the md5 hash of the uploaded file data and returns a file
>> name. This should work _but_ when I save the model, the filename I
>> gave back in the function is getting a "_1", "_2" and so on suffix to
>> prevent my efforts at deduplication.
>>
>> http://dpaste.com/199576/
>>
>> Anyone has had a similar problem?
>>
>> I understand I'll have to take care of other problems too, like
>> preventing the deletion of files that are referenced by more than one
>> ImageFile and could do something to prevent the actual overwriting of
>> the same data on the same file as before, but that's a start.
>>
>>
>> --
>> Ricardo Bánffy
>> http://www.dieblinkenlights.com
>> http://twitter.com/rbanffy
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Ricardo Bánffy
http://www.dieblinkenlights.com
http://twitter.com/rbanffy

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



django problems

2010-05-31 Thread rahul jain
Hi Django,

I have few questions and would like to seek your help.


Q1) I have defined lot of admin actions and some of the actions
require creating threads. So I split my long models.py into set of
files. But whenever I try to import anything from models
python complains ?

ex: if i have defined model name

class Test(models.Model):
blah blah

In my second file, I tried importing this class by using following

from models import Test

from app_name.models import Test

but none of them work.I am not sure why ?

Q2) Also, I have split my admin functions into set of functions

func1(){

   func2()

}


and in func2 (), if something bad happens

I would like to do self.message_user (request,"Bad") and then exit.

Right now i have to do return

But once it return back to func1() then it keeps on adding more of
those messages defined inside func1 ().

So how to do the redirect inside func2 () so that it simply exits and
displays just one message on admin.


Q3)Thirdly list_ordering dosent work for django default id. So i am
using django id (autoincrement primary key)

and would like to display in other way around like it should start
from 1 ---100 not from 100  ---1 on display.

so i tried this on admin model

lordering = ('-id',)

but it complains the id does not exist which exists though but not
defined by me.

Q4) how to change the theme for my django admin ?

Thanks for your help.

--RJ

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



Re: Django form validations

2010-05-31 Thread Horst Gutmann
Well, since validators were introduced with 1.2 you can't really use
them just right away with 1.1. So if zou want to use validators as in
1.2, you probably should update to 1.2 ;-) But there are still all the
other validation facilities available like clean_fieldname etc.

You can find all the details about the features available in 1.1 again
in the documentation:
http://docs.djangoproject.com/en/1.1/ref/forms/validation/

Ideally you want to do the validation on both sides since client-side
validation speeds up the interaction but this is not an alternative to
doing server-side validation since this is the place where it actually
matters for the state of your website. Client-side validation is just
an add-on ;-)

On Mon, May 31, 2010 at 6:10 PM, tazimk  wrote:
> yes, I have read that section but right know I am using Django version
> 1.1 which does not support some new built in validation functions .
> Also, where should valiadtions be done ideally server side or client
> side i.e using javascripts etc ?
>
> On May 31, 1:01 pm, Horst Gutmann  wrote:
>> Have you already 
>> readhttp://docs.djangoproject.com/en/1.2/ref/forms/validation/#ref-forms-...
>> ?
>>
>>
>>
>> On Mon, May 31, 2010 at 9:16 AM, tazimk  wrote:
>> > How to use django custom validators to verify form fields data
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "Django users" group.
>> > To post to this group, send email to django-us...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/django-users?hl=en.- Hide quoted text -
>>
>> - Show quoted text -
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: django-admin-tools

2010-05-31 Thread rahul jain
Hi David,

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', 'your_em...@domain.com'),
)

MANAGERS = ADMINS



DATABASE_ENGINE = 'mysql'   # 'postgresql_psycopg2',
'postgresql', 'mysql', 'sqlite3' or 'oracle'.


# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = '/Users/---/Documents/---/media'

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com";, "http://example.com/media/";
MEDIA_URL = ''

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/";, "/media/".
ADMIN_MEDIA_PREFIX = '/media/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = '---'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.csrf.middleware.CsrfMiddleware',
)

ROOT_URLCONF = '---.urls'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or
"C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
"mytemplates",
)

TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.auth',
'django.core.context_processors.request',
)


INSTALLED_APPS = (
'admin_tools',
'admin_tools.theming',
'admin_tools.menu',
'admin_tools.dashboard',
'django.contrib.auth',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.contenttypes',
'---.---',
'django.contrib.databrowse'

)

and then if  i do "" ls -ln media """ inside my root project directory,

admin_tools -> /Library/Python/2.6/site-packages/admin_tools/media/admin_tools



urls.py

from django.conf.urls.defaults import *
from django.contrib import databrowse


# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
# Example:
# (r'^---/', include('---.foo.urls')),

# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)),
(r'^admin_tools/', include('admin_tools.urls')),
(r'^data/(.*)', databrowse.site.root),

)

My guess is documentation is wrong.I think admin_tools media folder
should be inside django.contrib.admin.

--RJ


On Sun, May 30, 2010 at 10:55 AM, izi  wrote:
> Hi,
>
> On 30 mai, 08:43, rahul jain  wrote:
>> Hi Django,
>>
>> Anybody able to ran django-admin-tools successfully. I followed the
>> instructions from this website
>>
>> http://packages.python.org/django-admin-tools/0.2.0/quickstart.html#q...
>>
>> I was expecting a new theme for dashboard and index page after hitting
>> admin link but its still the same.
>>
>
> If you followed the quickstart step by step it should work.
> Please give more information about your settings, urls, the version of
> django you are using, etc.
>
> Note: django-admin-tools has its own mailing list so you should post
> there :
> http://groups.google.com/group/django-admin-tools/
>
> Regards,
>
> --
> David
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-user

Re: Item is already being moderated

2010-05-31 Thread shacker

On May 31, 1:41 am, shacker  wrote:

> I get "The model 'item' is already being moderated."  I haven't set up
> moderation before, so it's not clear what's triggering this. I do have
> an "enable_comments" field on the Item model. Odd that the error puts
> "item" in lowercase rather than upper.

I was able to fix this like this:

from django.contrib.comments.moderation import CommentModerator,
moderator, AlreadyModerated



class ItemModerator(CommentModerator):
email_notification = True
enable_field = 'enable_comments'

# moderator.register(Item, ItemModerator)

try:
moderator.register(Item, ItemModerator)
except AlreadyModerated:
pass


Not clear *why* this works, since I'm now bypassing the register step.
And it's not clear why Django thinks moderation is already registered.
Is this a bug, or a documentation oversight, or something I'm not
understanding? I do see a few blog posts and semi-related filed bugs
on this topic.

Scot

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



Re: Problems with Django File Fields

2010-05-31 Thread Nuno Maltez
Well, I know this doesn't address most of the issues you raise, but
I've used a combination of django-filebrowser,
http://code.google.com/p/django-filebrowser/ , FileBrowseField and
apache's x-sendfile, http://tn123.ath.cx/mod_xsendfile/, for serving
restricted access files, successfully.

I found that django-filebrowser and FileBrowseField really make the
admin's task of managing file uploads easier. You can make your own
directory structure, even though you have to do it manually.

This, of course, doesn't solve your all your issues:
- the filepath (relative to a media folder) is still stored in the
database, but to be honest it hasn't been an actual problem so far.
- to make a file private is the administrators responsibility - the
admin must upload the files to a "private" folder, secured by apache,
and
to serve the file you must code a view that validates the user's
permissions and returns the filepath to mod xsendfile.

It's not a perfect solution but it's the best I found so far, at least
for my purposes :)

Nuno

On Mon, May 31, 2010 at 2:06 PM, klaasvanschel...@gmail.com
 wrote:
> Hi All,
>
> The standard  Django File Fields (both on models and the form
> equivalent) have a number of shortcomings from my point of view / in
> my field. The most important of these are:
>
> * The result of uploaded file fields are assumed to be "public", i.e.
> served through the MEDIA url. I would rather store the files somewhere
> safe and determine in my view who gets to download what.
> * The filename is stored in the database, including the (potentially
> long) path to the file. This in itself creates all kinds of trouble:
>  * What if I want to move a file?
>  * What if the full path is longer than 255 characters?
>  * What if I create (using objects) a separate directory structure?
> Why is there now a global uniqueness constraint on variable names?
>
> As far as I see the custom storage system does not fix any of the
> above problems, since it is "name" based.
>
> For a number of my applications I've worked around the above problems
> by simply coding around it: I'm storing the filename in the DB in a
> CharField, and manually read/write the file from/to disk in view
> operations. I'm using the [appname]/[modelname]/[fieldname]/id as a
> path.
>
> Obviously I'd like to factor out the above. So I tried
> http://docs.djangoproject.com/en/1.2/howto/custom-model-fields/
>
> I'm running into a bunch of problems:
> * The 'real' django FileField does not follow the pattern from the
> article above (i.e. search for to_python in the source). What's going
> on here?
> * As described above, I'd like to use the pk of an object to write the
> file. However, the pk is not available before the save is done (at the
> model level). Are there known solutions for this problem?
>
> What paths could you recommend for me? Are my observations on the
> limitations of FileFields correct? Have some of you tried and found
> (different?) solutions?
>
> thanks a bunch.
>
> regards,
> Klaas van Schelven
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Inconsistent database results between application and shell

2010-05-31 Thread Stodge
I hang my head in shame. I had the name and type reversed in my Ajax
call to the view.

:(

On May 31, 12:19 pm, Stodge  wrote:
> Weird:
>
> syslog.syslog("Connections = %s" % str(connection.queries))
>
> gives:
>
> May 31 12:18:41 localhost python: Connections = []
>
> On May 31, 12:12 pm, Stodge  wrote:
>
>
>
> > Thanks. The various pieces of data (self.name etc) are 100% correct -
> > I dumped them all using syslog. However, it just occurred to me that
> > maybe it's a unicode/string issue. I'm trying to dump the SQL that's
> > generated - debug_toolbar isn't working for me.
>
> > The timestamps are generated from the request and they too are
> > correct, assuming here that year, month and day have the correct
> > values:
>
> >                 today = datetime.datetime(self.req_year, self.req_month,
> > self.req_day)
> >                 tomorrow = today + datetime.timedelta(days=1)
>
> > Thanks
>
> > On May 31, 12:08 pm, Javier Guerra Giraldez 
> > wrote:
>
> > > On Mon, May 31, 2010 at 9:56 AM, Stodge  wrote:
> > > > I have a query that filters on four fields:
>
> > > >                res = MyModel.objects.filter(name=self.name,
> > > >                                                           
> > > > type=self.type,
> > > >                                                           
> > > > last_update_time__gte=today,
> > > >                                                           
> > > > last_update_time__lte=tomorrow)
>
> > > > If I enter the exact same query in the shell, I get the correct
> > > > results from the database. If I access my app through the browser and
> > > > let it run the query, I get zero results. The settings file is correct
>
> > > all four of these parameters need some context (the 'self' object, and
> > > those 'today' and 'tomorrow' variables).  obviously, you couldn't just
> > > type that in the shell and get any result.  so, the problem might lay
> > > in some other code you're not showing.
>
> > > just guessing: something that has bitten me before is that even if
> > > querysets are lazy, the paraemters it gets aren't.  specially when
> > > they're time dependent, like 'today' and 'tomorrow'.  if you're
> > > creating this queryset at startup, these values might not be correct
> > > when you finally evaluate the query.
>
> > > --
> > > Javier

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



Error

2010-05-31 Thread Bruxo_Mor Juca
Senhores,

Preciso de ajuda no que se diz respeito a configuração do MANAGE.PY
estou com o seguinte erro:

Error execute_manage.py(settings)

Estou criando uma pagina, criei no arquivo de Setting.py a seguinte
definição:


'django.contrib.blog';  inclui esta linha logo abaixo da linha
'django.contrib.admin';

Sem a minha linha o site local funciona, quando coloco a minha linha
aparece o erro que citei acima.

Se alguem puder me ajudar..agradeço.

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



Re: Django form validations

2010-05-31 Thread tazimk
yes, I have read that section but right know I am using Django version
1.1 which does not support some new built in validation functions .
Also, where should valiadtions be done ideally server side or client
side i.e using javascripts etc ?

On May 31, 1:01 pm, Horst Gutmann  wrote:
> Have you already 
> readhttp://docs.djangoproject.com/en/1.2/ref/forms/validation/#ref-forms-...
> ?
>
>
>
> On Mon, May 31, 2010 at 9:16 AM, tazimk  wrote:
> > How to use django custom validators to verify form fields data
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.- Hide quoted text -
>
> - Show quoted text -

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



Can't override a ForeignKey field in a model-generated form

2010-05-31 Thread David Euzen
Using Django 1.2,

I've got a "Niveau" class in models.py. That class contains an auto-
refering field called "niveau" as a ForeignKey field. I use this class
to store a tree structure: the "niveau" field references a "Niveau"
instance's parent.

class Niveau(models.Model):
TYPES=( ('CAMP', 'Campagne'),
('STEP', 'Etape'),
('TACH', 'Tache'),
('TIR', 'Tir'),)
niveau=models.ForeignKey('self', related_name='niveau_superieur',
null=True, blank=True)
type=models.CharField(max_length=4, choices=TYPES)


I display this class using differents forms for each level of the
"Niveau" tree using ModelForm:

One of these levels is:

class EtapeForm(ModelForm):
niveau=models.ForeignKey('self',
related_name='niveau_superieur',verbose_name='niveau parent',
null=True, blank=True, limit_choices_to = {'type' :'CAMP'})
class Meta:
model = Niveau
fields = ['type', 'nom', 'date_debut', 'date_fin', 'summary',
'conclusion', 'action', 'objectif', 'niveau',]
widgets = { 'type': HiddenInput, }

According to 
http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#overriding-the-default-field-types-or-widgets,
this is supposed to override the "Niveau" "niveau" field but it
doesn't work.

Maybe the new "widgets" attribute to the Meta class of ModelForm could
help, but I can't find how to define choices for the Select widget in
Django's documentation.

There must be other ways to do this, but since I'm new to Django (this
is my first app) I haven't found them out yet.

Thanks,
David

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



Re: django-registration custom fields

2010-05-31 Thread shacker
Pankaj -

The fact that you're using a save() method here means that you're
using instructions referring to an older version of django-
registration. But you're probably actually deploying a current
version, which doesn't allow for that. The upgrade guide says:

"Previously, the form used to collect data during registration was
expected to implement a save() method which would create the new user
account. This is no longer the case; creating the account is handled
by the backend, and so any custom logic should be moved into a custom
backend, or by connecting listeners to the signals sent during the
registration process."

Details:

http://stackoverflow.com/questions/2601487/django-registration-django-profile-using-your-own-custom-form/2687377#2687377

Scot


On May 31, 1:07 am, Pankaj Singh 
wrote:
> I am using django-profiles with django-registration as per tutorial from
>
> http://praveensunsetpoint.wordpress.com/2009/04/21/django-registratio...
>
> But after the submitting the form I am getting this error
>
> AttributeError at /accounts/register/
>
> 'RegistrationForm' object has no attribute 'save'
>
> Please help me
>
> ### 
> ##
>
> def register(request,
> success_url=None,form_class=RegistrationFormUniqueEmail,
> profile_callback=None,
>     template_name='registration/registration_form.html',
>     extra_context=None):
>     pform_class = utils.get_profile_form()
>
>     if request.method == 'POST':
>         profileform = pform_class(data=request.POST, files=request.FILES)
>         form = form_class(data=request.POST, files=request.FILES)
>
>         if form.is_valid():
>             new_user = form.save()
>             profile_obj = profileform.save(commit=False)
>             profile_obj.user = new_user
>             profile_obj.save()
>
>             return HttpResponseRedirect('/accounts/register/complete/')
>
>     else:
>         form = form_class()
>         profileform = pform_class()
>
>     if extra_context is None:
>         extra_context = {}
>         context = RequestContext(request)
>
>         for key, value in extra_context.items():
>             context[key] = callable(value) and value() or value
>
>     return render_to_response(template_name,{'form':
> form,'profileform':profileform,}, context_instance=context)
>
> ### 
> #

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



Re: tinymce hyperlinks

2010-05-31 Thread Nuno Maltez
Maybe related to this issue?

http://code.google.com/p/django-grappelli/issues/detail?id=184

It's supposed to be fixed on the latest grappelli release though.

Nuno


On Mon, May 31, 2010 at 5:13 PM, Bobby Roberts  wrote:
> the only javascript error i'm getting is this:
>
> document.getElementsBySelector is not a function
>
> it's in my admin/js folder in the action.js file?
>
>
>
>
> On May 31, 5:15 am, Nuno Maltez  wrote:
>> Which version of grappelli are you using? Currently the trunk requires
>> django 1.2 but I think there's a branch that still works with 1.1.
>>
>> Having said that, we're using grappelli (a slightly older revision)
>> with Django 1.1 in a live project and it works just fine. Do you
>> notice any javascript errors when using the wizard?
>>
>> Nuno
>>
>> On Sun, May 30, 2010 at 9:45 PM, Bobby Roberts  wrote:
>> > i'm using django 1.1 with tinymce and the grappelli skins.  we just
>> > realized that the tinymce editor does not let you put hyperlinks in.
>> > if you go into HTML and hand code them they are fine.  if you try to
>> > click the link button and use the wizard, no link is inserted and the
>> > insert button doesn't do anything.  Has anyone else run into this.
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "Django users" group.
>> > To post to this group, send email to django-us...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Inconsistent database results between application and shell

2010-05-31 Thread Stodge
Weird:


syslog.syslog("Connections = %s" % str(connection.queries))

gives:

May 31 12:18:41 localhost python: Connections = []



On May 31, 12:12 pm, Stodge  wrote:
> Thanks. The various pieces of data (self.name etc) are 100% correct -
> I dumped them all using syslog. However, it just occurred to me that
> maybe it's a unicode/string issue. I'm trying to dump the SQL that's
> generated - debug_toolbar isn't working for me.
>
> The timestamps are generated from the request and they too are
> correct, assuming here that year, month and day have the correct
> values:
>
>                 today = datetime.datetime(self.req_year, self.req_month,
> self.req_day)
>                 tomorrow = today + datetime.timedelta(days=1)
>
> Thanks
>
> On May 31, 12:08 pm, Javier Guerra Giraldez 
> wrote:
>
>
>
> > On Mon, May 31, 2010 at 9:56 AM, Stodge  wrote:
> > > I have a query that filters on four fields:
>
> > >                res = MyModel.objects.filter(name=self.name,
> > >                                                           type=self.type,
> > >                                                           
> > > last_update_time__gte=today,
> > >                                                           
> > > last_update_time__lte=tomorrow)
>
> > > If I enter the exact same query in the shell, I get the correct
> > > results from the database. If I access my app through the browser and
> > > let it run the query, I get zero results. The settings file is correct
>
> > all four of these parameters need some context (the 'self' object, and
> > those 'today' and 'tomorrow' variables).  obviously, you couldn't just
> > type that in the shell and get any result.  so, the problem might lay
> > in some other code you're not showing.
>
> > just guessing: something that has bitten me before is that even if
> > querysets are lazy, the paraemters it gets aren't.  specially when
> > they're time dependent, like 'today' and 'tomorrow'.  if you're
> > creating this queryset at startup, these values might not be correct
> > when you finally evaluate the query.
>
> > --
> > Javier

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



Re: Empty QueryDict on POST

2010-05-31 Thread Shawn Milochik
Try using django-debug-toolbar.  It will show the POST and GET values.

Also, you can use request.POST.get('formID') instead, which will return None 
(or the second, optional argument) if it's empty.

What is your json_response middleware doing? Could it have anything to do with 
this?

What if you just print (or log debug) request.POST to the terminal output -- 
anything there?

Shawn


On May 31, 2010, at 9:40 AM, Brian wrote:

> Hello!
> 
> I could use some help tracking down a problem here. I have a view that
> starts as follows:
> 
> @login_required
> @json_response
> def save_exercise_week( request, week_id ):
>formID = request.POST['formID']
> 
> But this returns a 500 error because the QueryDict is empty --
> MultiValueDictKeyError at ... "Key 'formID' not found in > " In fact, according to the Django error page, there is no GET, POST,
> or FILES data.
> 
> I've checked my HTML form over several times and it looks fine. In
> Firebug, it says the POST sent is:
> 
> csrfmiddlewaretoken: ...
> fatPercentage: 10
> formID: formWeek4
> weekNumber: 17
> weight: 150.0
> year: 2010
> 
> which is correct. So, it looks like somewhere between the sending of
> the request and the calling of the view, the POST data is lost. I am
> using an XHR request to retrieve this view, but that's working fine
> for other views in my project. I would appreciate any ideas about what
> might be causing this. I've attached more data below from the error.
> Thank you!
> 
> 
> CSRF_COOKIE   '...'
> DOCUMENT_ROOT '...'
> GATEWAY_INTERFACE 'CGI/1.1'
> HTTP_ACCEPT   'text/html,application/xhtml+xml,application/xml;q=0.9,*/
> *;q=0.8'
> HTTP_ACCEPT_CHARSET   'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
> HTTP_ACCEPT_ENCODING  'gzip,deflate'
> HTTP_ACCEPT_LANGUAGE  'en-us,en;q=0.5'
> HTTP_CONNECTION   'close'
> HTTP_COOKIE   'csrftoken=6cd4642c36c8ff19dcb0c734a2d45fb6;
> sessionid=8c8ddb6631837ba811a62c8076f7521f; logintheme=cpanel;
> cprelogin=no;
> cpsession=HVb7EJsM_GibQJqkt_Z2NvUxRp0F0VNWv1qQNRTqYwc09MfDogZU7pbsZjbGjmuf'
> HTTP_HOST '...'
> HTTP_USER_AGENT   'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-
> US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10'
> PATH  '/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/courier-imap/
> sbin:/usr/lib/courier-imap/bin:/usr/local/sbin:/usr/local/bin:/sbin:/
> bin:/usr/sbin:/usr/bin:/usr/X11R6/bin'
> PATH_INFO u'...'
> PATH_TRANSLATED   'redirect:/cgi-bin/gfnn.fcgi/v2/exercise/save/week/4//
> exercise/save/week/4/'
> QUERY_STRING  ''
> REDIRECT_STATUS '200'
> REDIRECT_TZ   'America/Los_Angeles'
> REDIRECT_UNIQUE_ID'TAO30K6EpiIAAFFKYocAAAKQ'
> REDIRECT_URL  '...'
> REMOTE_ADDR   '217.41.238.90'
> REMOTE_PORT   '53799'
> REQUEST_METHOD 'GET'
> REQUEST_URI   '/v2/exercise/save/week/4/'
> SCRIPT_FILENAME   '.../cgi-bin/gfnn.fcgi'
> SCRIPT_NAME   u''
> SERVER_ADDR   '174.132.166.58'
> SERVER_ADMIN  '...'
> SERVER_NAME   '...'
> SERVER_PORT   '80'
> SERVER_PROTOCOL   'HTTP/1.1'
> SERVER_SIGNATURE  'Apache mod_fcgid/2.3.5
> mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server
> at gofitnow.net Port 80\n'
> SERVER_SOFTWARE   'Apache mod_fcgid/2.3.5 mod_auth_passthrough/2.1
> mod_bwlimited/1.4 FrontPage/5.0.2.2635'
> TZ'America/Los_Angeles'
> UNIQUE_ID 'TAO30K6EpiIAAFFKYocAAAKQ'
> wsgi.errors   
> wsgi.input
> wsgi.multiprocess False
> wsgi.multithread  True
> wsgi.run_once False
> wsgi.url_scheme   'http'
> wsgi.version  (1, 0)
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

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



Re: tinymce hyperlinks

2010-05-31 Thread Bobby Roberts
the only javascript error i'm getting is this:

document.getElementsBySelector is not a function

it's in my admin/js folder in the action.js file?




On May 31, 5:15 am, Nuno Maltez  wrote:
> Which version of grappelli are you using? Currently the trunk requires
> django 1.2 but I think there's a branch that still works with 1.1.
>
> Having said that, we're using grappelli (a slightly older revision)
> with Django 1.1 in a live project and it works just fine. Do you
> notice any javascript errors when using the wizard?
>
> Nuno
>
> On Sun, May 30, 2010 at 9:45 PM, Bobby Roberts  wrote:
> > i'm using django 1.1 with tinymce and the grappelli skins.  we just
> > realized that the tinymce editor does not let you put hyperlinks in.
> > if you go into HTML and hand code them they are fine.  if you try to
> > click the link button and use the wizard, no link is inserted and the
> > insert button doesn't do anything.  Has anyone else run into this.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

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



Re: Inconsistent database results between application and shell

2010-05-31 Thread Stodge
Thanks. The various pieces of data (self.name etc) are 100% correct -
I dumped them all using syslog. However, it just occurred to me that
maybe it's a unicode/string issue. I'm trying to dump the SQL that's
generated - debug_toolbar isn't working for me.

The timestamps are generated from the request and they too are
correct, assuming here that year, month and day have the correct
values:

today = datetime.datetime(self.req_year, self.req_month,
self.req_day)
tomorrow = today + datetime.timedelta(days=1)

Thanks

On May 31, 12:08 pm, Javier Guerra Giraldez 
wrote:
> On Mon, May 31, 2010 at 9:56 AM, Stodge  wrote:
> > I have a query that filters on four fields:
>
> >                res = MyModel.objects.filter(name=self.name,
> >                                                           type=self.type,
> >                                                           
> > last_update_time__gte=today,
> >                                                           
> > last_update_time__lte=tomorrow)
>
> > If I enter the exact same query in the shell, I get the correct
> > results from the database. If I access my app through the browser and
> > let it run the query, I get zero results. The settings file is correct
>
> all four of these parameters need some context (the 'self' object, and
> those 'today' and 'tomorrow' variables).  obviously, you couldn't just
> type that in the shell and get any result.  so, the problem might lay
> in some other code you're not showing.
>
> just guessing: something that has bitten me before is that even if
> querysets are lazy, the paraemters it gets aren't.  specially when
> they're time dependent, like 'today' and 'tomorrow'.  if you're
> creating this queryset at startup, these values might not be correct
> when you finally evaluate the query.
>
> --
> Javier

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



Re: Inconsistent database results between application and shell

2010-05-31 Thread Javier Guerra Giraldez
On Mon, May 31, 2010 at 9:56 AM, Stodge  wrote:
> I have a query that filters on four fields:
>
>                res = MyModel.objects.filter(name=self.name,
>                                                           type=self.type,
>                                                           
> last_update_time__gte=today,
>                                                           
> last_update_time__lte=tomorrow)
>
> If I enter the exact same query in the shell, I get the correct
> results from the database. If I access my app through the browser and
> let it run the query, I get zero results. The settings file is correct


all four of these parameters need some context (the 'self' object, and
those 'today' and 'tomorrow' variables).  obviously, you couldn't just
type that in the shell and get any result.  so, the problem might lay
in some other code you're not showing.

just guessing: something that has bitten me before is that even if
querysets are lazy, the paraemters it gets aren't.  specially when
they're time dependent, like 'today' and 'tomorrow'.  if you're
creating this queryset at startup, these values might not be correct
when you finally evaluate the query.


-- 
Javier

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



Re: Django 1.2.1 install in Ubuntu 10.04 via Synaptic?

2010-05-31 Thread AD
Thanks.

I went ahead and downloaded the Django 1.2.1 tarball, untarred it and
ran

sudo python setup.py install in the directory.

I needed to make one small change in my Apache httpd.conf file, but
otherwise it all seems to be working smoothly!

Thanks!

On May 31, 10:33 am, Massimiliano della Rovere
 wrote:
> or you can do the following tric:
> 1) install django sudo apt-get -y install python-django
> 2) now you have all the dependencies you need
> 3) sudo apt-get -y install python-setuptools
> 4) sudo apt-get remove python-django
> 5) sudo easy_install -Z django
>
> repeat step 5 after each release of django
>
> On Mon, May 31, 2010 at 16:20, Leonel Nunez  wrote:
> > > I agree with you, Shawn. I just didn't want to push ahead with a manual
> > uninstall and install if more-experienced Ubuntu users thought I'd be
> > seeing Django 1.2.1 show up in the repository quickly.
>
> > > I'll give it a go. Thanks,
>
> > Ubuntu is a stable linux distribution. This means once a release is made,
> > NO new package versions will be included except for those microreleases :
>
> >https://wiki.ubuntu.com/StableReleaseUpdates/MicroReleaseExceptions
>
> > Django is in main section for Karmic,Lucid this means that you will have
> > official SECURITY updates as long as the ubuntu version does not get its
> > EOL ( karmic 18 months from release date and lucid 5 years)
>
> > So you can deploy today with django 1.1.1 in lucid and your app will run
> > without changes for 5 years.
>
> > If you want 1.2.1 wait for it gets into Maveric ( current devel version )
> > and a backport can be done but this will not have oficial support.
>
> > Or wait for someone to make a backport and keep it updated on launchpad PPA
>
> > Saludos
>
> > Leonel
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



Inconsistent database results between application and shell

2010-05-31 Thread Stodge
I have a query that filters on four fields:

res = MyModel.objects.filter(name=self.name,
   type=self.type,
   
last_update_time__gte=today,
   
last_update_time__lte=tomorrow)

If I enter the exact same query in the shell, I get the correct
results from the database. If I access my app through the browser and
let it run the query, I get zero results. The settings file is correct
so I'm assuming that both executions are using the same remote
database. I'm seeing no errors or exceptions. The data being used in
the query is valid and exactly the same for both executions. What am I
missing? This is driving me nuts - any help appreciated. 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django 1.2.1 install in Ubuntu 10.04 via Synaptic?

2010-05-31 Thread Massimiliano della Rovere
or you can do the following tric:
1) install django sudo apt-get -y install python-django
2) now you have all the dependencies you need
3) sudo apt-get -y install python-setuptools
4) sudo apt-get remove python-django
5) sudo easy_install -Z django

repeat step 5 after each release of django

On Mon, May 31, 2010 at 16:20, Leonel Nunez  wrote:

> > I agree with you, Shawn. I just didn't want to push ahead with a manual
> uninstall and install if more-experienced Ubuntu users thought I'd be
> seeing Django 1.2.1 show up in the repository quickly.
> >
> > I'll give it a go. Thanks,
> >
>
>
> Ubuntu is a stable linux distribution. This means once a release is made,
> NO new package versions will be included except for those microreleases :
>
> https://wiki.ubuntu.com/StableReleaseUpdates/MicroReleaseExceptions
>
> Django is in main section for Karmic,Lucid this means that you will have
> official SECURITY updates as long as the ubuntu version does not get its
> EOL ( karmic 18 months from release date and lucid 5 years)
>
> So you can deploy today with django 1.1.1 in lucid and your app will run
> without changes for 5 years.
>
> If you want 1.2.1 wait for it gets into Maveric ( current devel version )
> and a backport can be done but this will not have oficial support.
>
> Or wait for someone to make a backport and keep it updated on launchpad PPA
>
>
> Saludos
>
> Leonel
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Empty QueryDict on POST

2010-05-31 Thread Brian
Hello!

I could use some help tracking down a problem here. I have a view that
starts as follows:

@login_required
@json_response
def save_exercise_week( request, week_id ):
formID = request.POST['formID']

But this returns a 500 error because the QueryDict is empty --
MultiValueDictKeyError at ... "Key 'formID' not found in " In fact, according to the Django error page, there is no GET, POST,
or FILES data.

I've checked my HTML form over several times and it looks fine. In
Firebug, it says the POST sent is:

csrfmiddlewaretoken: ...
fatPercentage: 10
formID: formWeek4
weekNumber: 17
weight: 150.0
year: 2010

which is correct. So, it looks like somewhere between the sending of
the request and the calling of the view, the POST data is lost. I am
using an XHR request to retrieve this view, but that's working fine
for other views in my project. I would appreciate any ideas about what
might be causing this. I've attached more data below from the error.
Thank you!


CSRF_COOKIE '...'
DOCUMENT_ROOT   '...'
GATEWAY_INTERFACE   'CGI/1.1'
HTTP_ACCEPT 'text/html,application/xhtml+xml,application/xml;q=0.9,*/
*;q=0.8'
HTTP_ACCEPT_CHARSET 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
HTTP_ACCEPT_ENCODING'gzip,deflate'
HTTP_ACCEPT_LANGUAGE'en-us,en;q=0.5'
HTTP_CONNECTION 'close'
HTTP_COOKIE 'csrftoken=6cd4642c36c8ff19dcb0c734a2d45fb6;
sessionid=8c8ddb6631837ba811a62c8076f7521f; logintheme=cpanel;
cprelogin=no;
cpsession=HVb7EJsM_GibQJqkt_Z2NvUxRp0F0VNWv1qQNRTqYwc09MfDogZU7pbsZjbGjmuf'
HTTP_HOST   '...'
HTTP_USER_AGENT 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-
US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10'
PATH'/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/courier-imap/
sbin:/usr/lib/courier-imap/bin:/usr/local/sbin:/usr/local/bin:/sbin:/
bin:/usr/sbin:/usr/bin:/usr/X11R6/bin'
PATH_INFO   u'...'
PATH_TRANSLATED 'redirect:/cgi-bin/gfnn.fcgi/v2/exercise/save/week/4//
exercise/save/week/4/'
QUERY_STRING''
REDIRECT_STATUS '200'
REDIRECT_TZ 'America/Los_Angeles'
REDIRECT_UNIQUE_ID  'TAO30K6EpiIAAFFKYocAAAKQ'
REDIRECT_URL'...'
REMOTE_ADDR '217.41.238.90'
REMOTE_PORT '53799'
REQUEST_METHOD 'GET'
REQUEST_URI '/v2/exercise/save/week/4/'
SCRIPT_FILENAME '.../cgi-bin/gfnn.fcgi'
SCRIPT_NAME u''
SERVER_ADDR '174.132.166.58'
SERVER_ADMIN'...'
SERVER_NAME '...'
SERVER_PORT '80'
SERVER_PROTOCOL 'HTTP/1.1'
SERVER_SIGNATURE'Apache mod_fcgid/2.3.5
mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server
at gofitnow.net Port 80\n'
SERVER_SOFTWARE 'Apache mod_fcgid/2.3.5 mod_auth_passthrough/2.1
mod_bwlimited/1.4 FrontPage/5.0.2.2635'
TZ  'America/Los_Angeles'
UNIQUE_ID   'TAO30K6EpiIAAFFKYocAAAKQ'
wsgi.errors 
wsgi.input  
wsgi.multiprocess   False
wsgi.multithreadTrue
wsgi.run_once   False
wsgi.url_scheme 'http'
wsgi.version(1, 0)

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



Re: Django 1.2.1 install in Ubuntu 10.04 via Synaptic?

2010-05-31 Thread Leonel Nunez
> I agree with you, Shawn. I just didn't want to push ahead with a manual
uninstall and install if more-experienced Ubuntu users thought I'd be
seeing Django 1.2.1 show up in the repository quickly.
>
> I'll give it a go. Thanks,
>


Ubuntu is a stable linux distribution. This means once a release is made,
NO new package versions will be included except for those microreleases :

https://wiki.ubuntu.com/StableReleaseUpdates/MicroReleaseExceptions

Django is in main section for Karmic,Lucid this means that you will have
official SECURITY updates as long as the ubuntu version does not get its
EOL ( karmic 18 months from release date and lucid 5 years)

So you can deploy today with django 1.1.1 in lucid and your app will run
without changes for 5 years.

If you want 1.2.1 wait for it gets into Maveric ( current devel version )
and a backport can be done but this will not have oficial support.

Or wait for someone to make a backport and keep it updated on launchpad PPA


Saludos

Leonel




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



Re: New product django-queries

2010-05-31 Thread Guthy Peter
No, I haven't seen this, thank you for pointing me at that.

However, I think my "solution" is a much simpler one. You don't have
to write views, everything is set up automatically.

Also, the list of searchable models is generated automatically.

Of course, django-queries is a tool for people you trust (like
admins), as there isn't any rights management...

Yours, Peter

On 31 Mai, 15:33, David De La Harpe Golden
 wrote:
> On 31/05/10 11:55, Guthy Peter wrote:
> Hmm. Have you seen django-filter? There's probably some overlap.
>
> http://github.com/alex/django-filter/
>
>  > With these, you can answer questions like "which authors have written
>  > books that have genre Sci-Fi or Fantasy"
>
> The approach might be a bit different, but you can allow such things in
> django-filter with the related__field syntax, something like:
>
> class AuthorFilterSet(FilterSet):
>      class Meta:
>          model = Author
>      books__genre = ModelMultipleChoiceFilter(queryset=Genre.objects.all())

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



Re: New product django-queries

2010-05-31 Thread David De La Harpe Golden

On 31/05/10 11:55, Guthy Peter wrote:

Dear Django users,

I have written a new module for Django: it's called django-queries,
and is sort of a mix between the Admin and the Databrowse products.
While the Admin interface is for entering data, django-queries is
intended for searching the entered information.



Hmm. Have you seen django-filter? There's probably some overlap.

http://github.com/alex/django-filter/

> With these, you can answer questions like "which authors have written 
> books that have genre Sci-Fi or Fantasy"


The approach might be a bit different, but you can allow such things in 
django-filter with the related__field syntax, something like:


class AuthorFilterSet(FilterSet):
class Meta:
model = Author
books__genre = ModelMultipleChoiceFilter(queryset=Genre.objects.all())

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



Re: Auto populate currently logged in user's user id in forms

2010-05-31 Thread gvkalra
I think that I figured it out . we can use commit=False then
get the user from request.user .. am I correct ? ... any
other way ??

On May 31, 6:03 pm, gvkalra  wrote:
> Hi.
> Here what I have 
> donehttp://github.com/gvkalra/showtime/blob/master/photo/views.py
>
> What I want to do is:
> Auto populate the database with currently logged in user's user id
> like it has been done with the date of creation of the record by
> using
> uploaded = models.DateField(auto_now_add=True)
>
> how to do that with:
> clicked_by = models.ForeignKey(User) ??
>
> something like
> clicked_by = models.ForeignKey(User.username, editable=False)
>
> {though it doesn't work, but just to demonstrate the 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How can I test the correctness of my models against the schema of a database?

2010-05-31 Thread David Horat
Thanks for the info Jani.

One question: How did you manage to make the tests in Django?
Because it forces you to create a test database and the idea of our
tests is to do them on an already full test database.
My idea if I can't skip it is to try and make them with the Python
Unit Testing Framework. But I would prefer all tests to be together in
Django.

Regards,
David

On May 31, 8:34 am, Jani Tiainen  wrote:
> Not really.
>
> If you're specially working with legacy databases trying to figure out that do
> Django models match underlying schema is PITA.
>
> We resolved this partially by doing few simple tests, namely running through
> all models and doing empty query. Since Django ORM queries for every field it
> revealed most of the problems right away. Of course we didn't checked lenghts
> or types of field.
>
> Also this could be useful in development phase when you add new fields.
>
> In django-command-extensions exists dbdiff command which produces somekind of
> diff against underlying database but it's in very early stages.
>
>
>
>
>
> > Sorry. I haven't use other methods for that.
> > But isn't it enough to test it using loremiser or something like that
> > and like an addition debug toolbar?
>
> > On May 31, 12:53 am, David Horat  wrote:
> > > Dear group,
>
> > > How can I test the correctness of my models against the schema of a
> > > database?
>
> > > To solve this question, I have tried unsuccessfully several options:
> > > - Using ./manage.py test triggers the creation and destruction of a
> > > database, but I want to check the correctness of the model against a
> > > production database, since I just want to check the schema, not the
> > > content.
> > > - Creating my own test runner as specified
> > > herehttp://stackoverflow.com/questions/138851which basically hacks the
> > > Django stack and gives you other problems. In any case this seems not to
> > > be the correct way.
>
> > > Has anyone of you faced this situation before? Any clues?
>
> > > Thank you in advance.
>
> > > Best Regards,
> > > David Horat
>
> --
>
> Jani Tiainen

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



Problems with Django File Fields

2010-05-31 Thread klaasvanschel...@gmail.com
Hi All,

The standard  Django File Fields (both on models and the form
equivalent) have a number of shortcomings from my point of view / in
my field. The most important of these are:

* The result of uploaded file fields are assumed to be "public", i.e.
served through the MEDIA url. I would rather store the files somewhere
safe and determine in my view who gets to download what.
* The filename is stored in the database, including the (potentially
long) path to the file. This in itself creates all kinds of trouble:
  * What if I want to move a file?
  * What if the full path is longer than 255 characters?
  * What if I create (using objects) a separate directory structure?
Why is there now a global uniqueness constraint on variable names?

As far as I see the custom storage system does not fix any of the
above problems, since it is "name" based.

For a number of my applications I've worked around the above problems
by simply coding around it: I'm storing the filename in the DB in a
CharField, and manually read/write the file from/to disk in view
operations. I'm using the [appname]/[modelname]/[fieldname]/id as a
path.

Obviously I'd like to factor out the above. So I tried
http://docs.djangoproject.com/en/1.2/howto/custom-model-fields/

I'm running into a bunch of problems:
* The 'real' django FileField does not follow the pattern from the
article above (i.e. search for to_python in the source). What's going
on here?
* As described above, I'd like to use the pk of an object to write the
file. However, the pk is not available before the save is done (at the
model level). Are there known solutions for this problem?

What paths could you recommend for me? Are my observations on the
limitations of FileFields correct? Have some of you tried and found
(different?) solutions?

thanks a bunch.

regards,
Klaas van Schelven

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



Auto populate currently logged in user's user id in forms

2010-05-31 Thread gvkalra
Hi.
Here what I have done 
http://github.com/gvkalra/showtime/blob/master/photo/views.py

What I want to do is:
Auto populate the database with currently logged in user's user id
like it has been done with the date of creation of the record by
using
uploaded = models.DateField(auto_now_add=True)

how to do that with:
clicked_by = models.ForeignKey(User) ??

something like
clicked_by = models.ForeignKey(User.username, editable=False)

{though it doesn't work, but just to demonstrate the 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: db autoclobbering with automated tests

2010-05-31 Thread Russell Keith-Magee
On Fri, May 28, 2010 at 12:59 PM, Rolando Espinoza La Fuente
 wrote:
> On Thu, May 27, 2010 at 2:00 PM, dmitry b  wrote:
>> So, no one is running automated tests?
>
> I'd added a patch that adds the --noinput option to testserver command:
> http://code.djangoproject.com/ticket/12619

I've just marked that ticket Ready For Checkin; once we branch for 1.3
development, I'll check this in.

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



Re: New product django-queries

2010-05-31 Thread Guthy Peter
You have much more freedom with defining search criteria.

In case of ForeignKeys, users can also select more then one related
object, so one can search for "books, that have genre Sci-Fi or
Fantasy".

Also, as it's noted in the documentation, you can define InlineQueries
(comparable to the InlineAdmin). With these, you can answer questions
like "which authors have written books that have genre Sci-Fi or
Fantasy" (in the case of Author->Book relationship in the models).
Later, it will be possible to search for  between 
and  or  greater than .

And if you have many records in the foreign model, the filter lists in
the admin are quite unhandy I think.

I think these possibilities are quite unique for a completely general
interface.



On 31 Mai, 13:35, Jeliuc Alexandr  wrote:
> Hello.
> Can You explain the difference between this module and filters and
> search functionality of admin.modelAdmin?
> What is its best?
>
> On May 31, 1:55 pm, Guthy Peter  wrote:
>
>
>
> > Dear Django users,
>
> > I have written a new module for Django: it's called django-queries,
> > and is sort of a mix between the Admin and the Databrowse products.
> > While the Admin interface is for entering data, django-queries is
> > intended for searching the entered information.
>
> > After defining the searchable fields, users are able to define complex
> > search criteria for filtering the datasets. Field types and field
> > dependencies are worked out automatically.
>
> > Please have a look on the website
> >  http://django-queries.googlecode.com/
>
> > You can find there examples and screenshots as well.
>
> > I would be happy if someone would find this product useful.
>
> > Please feel free to adding comments to the page and the code.
>
> > Yours,
> > Peter Guthy

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



Re: New product django-queries

2010-05-31 Thread Jeliuc Alexandr
Hello.
Can You explain the difference between this module and filters and
search functionality of admin.modelAdmin?
What is its best?

On May 31, 1:55 pm, Guthy Peter  wrote:
> Dear Django users,
>
> I have written a new module for Django: it's called django-queries,
> and is sort of a mix between the Admin and the Databrowse products.
> While the Admin interface is for entering data, django-queries is
> intended for searching the entered information.
>
> After defining the searchable fields, users are able to define complex
> search criteria for filtering the datasets. Field types and field
> dependencies are worked out automatically.
>
> Please have a look on the website
>  http://django-queries.googlecode.com/
>
> You can find there examples and screenshots as well.
>
> I would be happy if someone would find this product useful.
>
> Please feel free to adding comments to the page and the code.
>
> Yours,
> Peter Guthy

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



Re: Django form validations

2010-05-31 Thread Horst Gutmann
Have you already read
http://docs.djangoproject.com/en/1.2/ref/forms/validation/#ref-forms-validation
?

On Mon, May 31, 2010 at 9:16 AM, tazimk  wrote:
> How to use django custom validators to verify form fields data
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



New product django-queries

2010-05-31 Thread Guthy Peter
Dear Django users,

I have written a new module for Django: it's called django-queries,
and is sort of a mix between the Admin and the Databrowse products.
While the Admin interface is for entering data, django-queries is
intended for searching the entered information.

After defining the searchable fields, users are able to define complex
search criteria for filtering the datasets. Field types and field
dependencies are worked out automatically.

Please have a look on the website
  http://django-queries.googlecode.com/

You can find there examples and screenshots as well.

I would be happy if someone would find this product useful.

Please feel free to adding comments to the page and the code.

Yours,
Peter Guthy

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



Re: Django project as linux package

2010-05-31 Thread Petr Pejcel
Thanks so much. But I don't need to do it, but talk about it on my
exam.
Can you give me only important things, which must be  done?

Thanks again.

On 31 kvě, 10:21, Baurzhan Ismagulov  wrote:
> On Mon, May 31, 2010 at 12:36:36AM -0700, Petr Pejcel wrote:
> > How can I distribute Django project as linux package? For example deb
> > package.
>
> http://www.radix50.net/~ibr/notes/20080323-0-django-autotools-debian
>
> Questions or feedback welcome.
>
> With kind regards,
> --
> Baurzhan Ismagulovhttp://www.kz-easy.com/

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



fabric ssh connect problem

2010-05-31 Thread knight
Hi,

I'm trying to deploy a django app with fabric and get the following
error:

Alexs-MacBook:fabric alex$ fab config:instance=peergw deploy -H  -
u  -p 
[192.168.2.93] run: cat /etc/issue
Traceback (most recent call last):
  File "build/bdist.macosx-10.6-universal/egg/fabric/main.py", line
419, in main
  File "/Users/alex/Rabota/server/mx30/scripts/fabric/fab/
commands.py", line 37, in deploy
checkup()
  File "/Users/alex/Rabota/server/mx30/scripts/fabric/fab/
commands.py", line 140, in checkup
if not 'Ubuntu' in run('cat /etc/issue'):
  File "build/bdist.macosx-10.6-universal/egg/fabric/network.py", line
382, in host_prompting_wrapper
  File "build/bdist.macosx-10.6-universal/egg/fabric/operations.py",
line 414, in run
  File "build/bdist.macosx-10.6-universal/egg/fabric/network.py", line
65, in __getitem__
  File "build/bdist.macosx-10.6-universal/egg/fabric/network.py", line
140, in connect
  File "build/bdist.macosx-10.6-universal/egg/paramiko/client.py",
line 149, in load_system_host_keys
  File "build/bdist.macosx-10.6-universal/egg/paramiko/hostkeys.py",
line 154, in load
  File "build/bdist.macosx-10.6-universal/egg/paramiko/hostkeys.py",
line 66, in from_line
  File "build/bdist.macosx-10.6-universal/egg/paramiko/rsakey.py",
line 61, in __init__
paramiko.SSHException: Invalid key
Alexs-MacBook:fabric alex$

I can't connect to the server via ssh. What can be my problem?

Regards, Arshavski Alexander.

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



uploading file in 2 steps

2010-05-31 Thread knight
Hi,

I want to upload a file in 2 steps.
First I want to upload it and show the errors and on the second step I
want actually to save the file data in the database.
So I made a simple form and my problem is how to pass the same file to
the form on the second step.
I mean how to insert request.FILES data in the same form again. Or
maybe there is a better way?

Thanks,
Arshavski Alexander.

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



Re: ImportError: No module named django.core

2010-05-31 Thread Nuno Maltez
Well, it seems that your python lib is at /usr/lib/python2.6/dist-packages:

> mx:~/webapps$ python -c "from distutils.sysconfig import
> get_python_lib; print get_python_lib()"
>
> /usr/lib/python2.6/dist-packages

but django is in "local" - /usr/local/lib/python2.6/dist-packages

> /usr/local/lib/python2.6/dist-packages/django/bin/django-admin.py

So have you tried adding /usr/local/lib/python2.6/dist-packages/
(directory that holds the django module) to your pythonpath?

Nuno

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



RE: Re: Django project as linux package

2010-05-31 Thread Henrik Genssen
you can use ant and ant-deb-task
http://code.google.com/p/ant-deb-task/

regards

Henrik

>reply to message:
>date: 31.05.2010 10:21:04
>from: "Baurzhan Ismagulov" 
>to: "Django users" 
>subject: Re: Django project as linux package
>
>On Mon, May 31, 2010 at 12:36:36AM -0700, Petr Pejcel wrote:
>> How can I distribute Django project as linux package? For example deb
>> package.
>
>http://www.radix50.net/~ibr/notes/20080323-0-django-autotools-debian.html
>
>Questions or feedback welcome.
>
>With kind regards,
>-- 
>Baurzhan Ismagulov
>http://www.kz-easy.com/
>
>-- 
>You received this message because you are subscribed to the Google Groups 
>"Django users" group.
>To post to this group, send email to django-us...@googlegroups.com.
>To unsubscribe from this group, send email to 
>django-users+unsubscr...@googlegroups.com.
>For more options, visit this group at 
>http://groups.google.com/group/django-users?hl=en.
>

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



Re: tinymce hyperlinks

2010-05-31 Thread Nuno Maltez
Which version of grappelli are you using? Currently the trunk requires
django 1.2 but I think there's a branch that still works with 1.1.

Having said that, we're using grappelli (a slightly older revision)
with Django 1.1 in a live project and it works just fine. Do you
notice any javascript errors when using the wizard?

Nuno

On Sun, May 30, 2010 at 9:45 PM, Bobby Roberts  wrote:
> i'm using django 1.1 with tinymce and the grappelli skins.  we just
> realized that the tinymce editor does not let you put hyperlinks in.
> if you go into HTML and hand code them they are fine.  if you try to
> click the link button and use the wizard, no link is inserted and the
> insert button doesn't do anything.  Has anyone else run into this.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Item is already being moderated

2010-05-31 Thread shacker
Per the comment moderation docs at:

http://docs.djangoproject.com/en/dev/ref/contrib/comments/moderation/
:


# models.py

from django.contrib.comments.moderation import CommentModerator,
moderator

class ItemModerator(CommentModerator):
email_notification = True
enable_field = 'enable_comments'

moderator.register(Item, ItemModerator)



I get "The model 'item' is already being moderated."  I haven't set up
moderation before, so it's not clear what's triggering this. I do have
an "enable_comments" field on the Item model. Odd that the error puts
"item" in lowercase rather than upper.

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



Re: Django project as linux package

2010-05-31 Thread Baurzhan Ismagulov
On Mon, May 31, 2010 at 12:36:36AM -0700, Petr Pejcel wrote:
> How can I distribute Django project as linux package? For example deb
> package.

http://www.radix50.net/~ibr/notes/20080323-0-django-autotools-debian.html

Questions or feedback welcome.

With kind regards,
-- 
Baurzhan Ismagulov
http://www.kz-easy.com/

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



Re: django-registration custom fields

2010-05-31 Thread Pankaj Singh
I am using django-profiles with django-registration as per tutorial from

http://praveensunsetpoint.wordpress.com/2009/04/21/django-registration-and-django-profile

But after the submitting the form I am getting this error

AttributeError at /accounts/register/

'RegistrationForm' object has no attribute 'save'

Please help me

#

def register(request,
success_url=None,form_class=RegistrationFormUniqueEmail,
profile_callback=None,
template_name='registration/registration_form.html',
extra_context=None):
pform_class = utils.get_profile_form()


if request.method == 'POST':
profileform = pform_class(data=request.POST, files=request.FILES)
form = form_class(data=request.POST, files=request.FILES)

if form.is_valid():
new_user = form.save()
profile_obj = profileform.save(commit=False)
profile_obj.user = new_user
profile_obj.save()

return HttpResponseRedirect('/accounts/register/complete/')

else:
form = form_class()
profileform = pform_class()

if extra_context is None:
extra_context = {}
context = RequestContext(request)

for key, value in extra_context.items():
context[key] = callable(value) and value() or value

return render_to_response(template_name,{'form':
form,'profileform':profileform,}, context_instance=context)



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



Django project as linux package

2010-05-31 Thread Petr Pejcel
Hello,
Can anyone give me hand and help me with my problem?
How can I distribute Django project as linux package? For example deb
package.

Thanks a lot for your time.

Regards
Petr

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



Django form validations

2010-05-31 Thread tazimk
How to use django custom validators to verify form fields data

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



Re: How can I test the correctness of my models against the schema of a database?

2010-05-31 Thread Jani Tiainen
Not really.

If you're specially working with legacy databases trying to figure out that do 
Django models match underlying schema is PITA.

We resolved this partially by doing few simple tests, namely running through 
all models and doing empty query. Since Django ORM queries for every field it 
revealed most of the problems right away. Of course we didn't checked lenghts 
or types of field.

Also this could be useful in development phase when you add new fields.

In django-command-extensions exists dbdiff command which produces somekind of 
diff against underlying database but it's in very early stages.

> Sorry. I haven't use other methods for that.
> But isn't it enough to test it using loremiser or something like that
> and like an addition debug toolbar?
> 
> On May 31, 12:53 am, David Horat  wrote:
> > Dear group,
> > 
> > How can I test the correctness of my models against the schema of a
> > database?
> > 
> > To solve this question, I have tried unsuccessfully several options:
> > - Using ./manage.py test triggers the creation and destruction of a
> > database, but I want to check the correctness of the model against a
> > production database, since I just want to check the schema, not the
> > content.
> > - Creating my own test runner as specified
> > herehttp://stackoverflow.com/questions/138851 which basically hacks the
> > Django stack and gives you other problems. In any case this seems not to
> > be the correct way.
> > 
> > Has anyone of you faced this situation before? Any clues?
> > 
> > Thank you in advance.
> > 
> > Best Regards,
> > David Horat

-- 

Jani Tiainen

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