Re: django-tinymce not appearing in admin

2009-08-11 Thread Kenneth Gonsalves

On Wednesday 12 Aug 2009 11:08:55 am diogobaeder wrote:
> I configured django-tinymce extension to work with a model field; It
> loads all the JavaScript correctly, right after the field, in a script
> tag, passing the right element ID, but the editor simply doesn't show,
> only the original textarea is present. Here is a piece of my project
> where TinyMCE configuration should be entered:
>
> http://dpaste.com/hold/78621/
>
> Anything wrong in here?

you have not specified which django version you are using. If it is trunk, I am 
under the impression that you need a Media subclass to your model.Admin class 
in admin.py to hold the tiny_mce settings. In older versions of django this 
was in the Admin subclass. btw, in a mailing list it is not advisable to paste 
in dpaste as that will vanish and b0rk the archives.
-- 
regards
kg
http://lawgon.livejournal.com

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



Re: Deploying django on apache - cant access database

2009-08-11 Thread consiglieri

Thanks Graham!

The absolute path was the issue. Can't believe I couldnt find that
anywhere.

As for the Alias, well i was just testing to make sure that wasnt an
issue.And its in the httpd.conf , for perl-cgi you need that so since
i was having issues i decided to try and see if it was causing my
issues. (Which it wasnt). As the apaches conf says

# ScriptAlias: This controls which directories contain server
scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications
and
# run by the server when requested rather than as documents sent
to the
# client.  The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.

So i was thinking maybe i need to set an alias so that apache executes
the python scripts.

The only thing i have noted now is that that when i go to the admin
url the css doesnt seem to follow but probably its just a sethandler
issue.

Anyway Graham I really appreciate your input. At least now i know my
setup is working and I ca get on with actually developing the app
better as well as trying to master the django framework

Thomas


On 12 Aug, 00:02, Graham Dumpleton  wrote:
> For SQLite database, the directory the database is in must also be
> writable to user that Apache runs as. The location of the database in
> settings file must also be an absolute path, can't use a relative
> path.
>
> BTW, what is:
>
>   Alias test.django.com "/Users/someone/djangoproject/appname"
>
> for in configuration? It will have no effect and normall your wouldn't
> have anything like that in configuration for Django.
>
> Graham
>
> On Aug 12, 4:45 am, consiglieri  wrote:
>
>
>
> > Thanks for the tip, however it does not make a difference. I moved the
> > app to another catalogue and made sure that the database file was
> > chmod to 755 and also that all directories have the same permissions.
> > The error remains.
>
> > There is something happening that i dont understand. I'm beginning to
> > think there is someting wrong with the django or mod_python
> > installation but i am at a loss understanding what it can be.
>
> > Thomas
>
> > On 11 Aug, 19:04, Mike Ramirez  wrote:
>
> > > On Tuesday 11 August 2009 09:43:38 am consiglieri wrote:
>
> > > > Hi
>
> > > > I'm new with django and have made a small test app which works as it
> > > > should with the development server.
>
> > > > However when i try and deploy it with apache and mod_python I cant get
> > > > it to work. I have tested that mod_python works. I can do the
> > > > recommended mod_python test. When i try to run the django app via
> > > > apache it works well as long as the page being displayed does not
> > > > actually try and access the database. In other words if I enter a url
> > > > that just pops up an empty page with no django tags in it the page is
> > > > displayed as it should.
>
> > > > These are my settings.
>
> > > > Apache 2.2.11
> > > > mod_python 3.3.2-dev
> > > > I am on a Mac (Leopard 10.5.8)
> > > > I have the latest stable version of django 1.1
>
> > > > When I start apache the following can be found in the logs
>
> > > > Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.7l DAV/2 mod_python/
> > > > 3.3.2-dev-20080819 Python/2.5.1 configured -- resuming normal
> > > > operations
>
> > > > The necessary settings in httpd.conf with regards to django is as
> > > > follows
>
> > > > Alias test.django.com "/Users/someone/djangoproject/appname"
>
> > > > SetHandler python-program
> > > > PythonHandler django.core.handlers.modpython
> > > > SetEnv DJANGO_SETTINGS_MODULE appname.settings
> > > > PythonDebug On
> > > > PythonPath "['/Users/someone/djangoproject/'] + sys.path"
>
> > > > When i run a url that invokes a function which tries to access the
> > > > database (sqlite3 in this case) i receive the following error
>
> > > You have to make sure the database file is also readable and writeable by 
> > > the
> > > user apache is running as.  The leading path should also be readable to 
> > > the
> > > apache user.  755 settings on the directories in the tree.  
>
> > > Some ways of fixing this are making a group; say djangodevs and add both 
> > > your
> > > user and the apache user to that group and setting the sqlite file to be
> > > rwxrwx---.
>
> > > You could run apache as your user by changing the User/Group setting in 
> > > your
> > > httpd.conf/apache2.conf (see sample below) or a variation of this with the
> > > above suggestion.
>
> > > # User/Group: The name (or #number) of the user/group to run httpd as.    
> > >   
> > > #  . On SCO (ODT 3) use "User nouser" and "Group nogroup".                
> > >   
> > > #  . On HPUX you may not be able to use shared memory as nobody, and the  
> > >   
> > > #    suggested workaround is to create a user www and use that user.      
> > >   
> > > #  NOTE that some kernels refuse to setgid(Group) or 

django-tinymce not appearing in admin

2009-08-11 Thread diogobaeder

Hi,

I configured django-tinymce extension to work with a model field; It
loads all the JavaScript correctly, right after the field, in a script
tag, passing the right element ID, but the editor simply doesn't show,
only the original textarea is present. Here is a piece of my project
where TinyMCE configuration should be entered:

http://dpaste.com/hold/78621/

Anything wrong in here?

Thanks,

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



django-tagging not working in 1.1?

2009-08-11 Thread nbv4

I'm having trouble getting my tagged modles registered in 1.1

When I have "tagging.register(MyModel)" at the bottom, I get this
error when I try to add a new instance of that model in the admin:
"null value in column "object_id" violates not-null constraint"

full traceback:

#

Traceback:
File "/home/chris/lib/python2.6/django/core/handlers/base.py" in
get_response
  92. response = callback(request, *callback_args,
**callback_kwargs)
File "/home/chris/lib/python2.6/django/contrib/admin/options.py" in
wrapper
  226. return self.admin_site.admin_view(view)(*args,
**kwargs)
File "/home/chris/lib/python2.6/django/views/decorators/cache.py" in
_wrapped_view_func
  44. response = view_func(request, *args, **kwargs)
File "/home/chris/lib/python2.6/django/contrib/admin/sites.py" in
inner
  186. return view(request, *args, **kwargs)
File "/home/chris/lib/python2.6/django/db/transaction.py" in
_commit_on_success
  240. res = func(*args, **kw)
File "/home/chris/lib/python2.6/django/contrib/admin/options.py" in
add_view
  718. new_object = self.save_form(request, form,
change=False)
File "/home/chris/lib/python2.6/django/contrib/admin/options.py" in
save_form
  551. return form.save(commit=False)
File "/home/chris/lib/python2.6/django/forms/models.py" in save
  407.  fail_message, commit,
exclude=self._meta.exclude)
File "/home/chris/lib/python2.6/django/forms/models.py" in
save_instance
  62. f.save_form_data(instance, cleaned_data[f.name])
File "/home/chris/lib/python2.6/django/db/models/fields/__init__.py"
in save_form_data
  310. setattr(instance, self.name, data)
File "/home/chris/lib/python2.6/tagging/managers.py" in __set__
  65. Tag.objects.update_tags(instance, value)
File "/home/chris/lib/python2.6/tagging/models.py" in update_tags
  50. TaggedItem._default_manager.create(tag=tag,
object=obj)
File "/home/chris/lib/python2.6/django/db/models/manager.py" in create
  126. return self.get_query_set().create(**kwargs)
File "/home/chris/lib/python2.6/django/db/models/query.py" in create
  315. obj.save(force_insert=True)
File "/home/chris/lib/python2.6/django/db/models/base.py" in save
  410. self.save_base(force_insert=force_insert,
force_update=force_update)
File "/home/chris/lib/python2.6/django/db/models/base.py" in save_base
  495. result = manager._insert(values,
return_id=update_pk)
File "/home/chris/lib/python2.6/django/db/models/manager.py" in
_insert
  177. return insert_query(self.model, values, **kwargs)
File "/home/chris/lib/python2.6/django/db/models/query.py" in
insert_query
  1087. return query.execute_sql(return_id)
File "/home/chris/lib/python2.6/django/db/models/sql/subqueries.py" in
execute_sql
  320. cursor = super(InsertQuery, self).execute_sql(None)
File "/home/chris/lib/python2.6/django/db/models/sql/query.py" in
execute_sql
  2369. cursor.execute(sql, params)
File "/home/chris/lib/python2.6/django/db/backends/util.py" in execute
  19. return self.cursor.execute(sql, params)

Exception Type: IntegrityError at /admin/plane/plane/add/
Exception Value: null value in column "object_id" violates not-null
constraint

###

then why I try to edit an existing airplane, I get this error: "can't
adapt"

Traceback:
File "/home/chris/lib/python2.6/django/core/handlers/base.py" in
get_response
  92. response = callback(request, *callback_args,
**callback_kwargs)
File "/home/chris/lib/python2.6/django/contrib/admin/options.py" in
wrapper
  226. return self.admin_site.admin_view(view)(*args,
**kwargs)
File "/home/chris/lib/python2.6/django/views/decorators/cache.py" in
_wrapped_view_func
  44. response = view_func(request, *args, **kwargs)
File "/home/chris/lib/python2.6/django/contrib/admin/sites.py" in
inner
  186. return view(request, *args, **kwargs)
File "/home/chris/lib/python2.6/django/db/transaction.py" in
_commit_on_success
  240. res = func(*args, **kw)
File "/home/chris/lib/python2.6/django/contrib/admin/options.py" in
change_view
  830. self.save_model(request, new_object, form,
change=True)
File "/home/chris/lib/python2.6/django/contrib/admin/options.py" in
save_model
  557. obj.save()
File "/home/chris/lib/python2.6/django/db/models/base.py" in save
  410. self.save_base(force_insert=force_insert,
force_update=force_update)
File "/home/chris/lib/python2.6/django/db/models/base.py" in save_base
  474. rows = manager.filter(pk=pk_val)._update
(values)
File "/home/chris/lib/python2.6/django/db/models/query.py" in _update
  444. return query.execute_sql(None)
File "/home/chris/lib/python2.6/django/db/models/sql/subqueries.py" in
execute_sql
  120. 

Re: django 0.96.4 does not has django.utils._os

2009-08-11 Thread dongua
  
1177
def runserver(addr, port, use_reloader=True, admin_media_dir=''):
1178
  "Starts a lightweight Web server for development."
1179
  from django.core.servers.basehttp import run, AdminMediaHandler,
WSGIServerException
1180
  from django.core.handlers.wsgi import WSGIHandler
1181
  if not addr: 
1182
  addr = '127.0.0.1'
1183
  if not port.isdigit():
1184
  sys.stderr.write(style.ERROR("Error: %r is not a valid port number.\n"
% port)) 
1185
  sys.exit(1)
1186
  quit_command = sys.platform == 'win32' and 'CTRL-BREAK' or 'CONTROL-C'
1187
  def inner_run():
1188
  from django.conf import settings
1189
  print "Validating models..."
1190
  validate()
1191
  print "\nDjango version %s, using settings %r" % (get_version(),
settings.SETTINGS_MODULE)
1192
  print "Development server is running at http://%s:%s/; % (addr, port)
1193
  print "Quit the server with %s." % quit_command
1194
  try: 
1195
  handler = AdminMediaHandler(WSGIHandler(), admin_media_path)
1196
  run(addr, int(port), handler)
1197
  except WSGIServerException, e:
1198
  # Use helpful error messages instead of ugly tracebacks.
1199
  ERRORS = {
1200
  13: "You don't have permission to access that port.",
1201
  98: "That port is already in use.",
1202
  99: "That IP address can't be assigned-to.",
1203
  } 
1204
  try: 
1205
  error_text = ERRORS[e.args[0].args[0]]
1206
  except (AttributeError, KeyError):
1207
 

Re: django 0.96.4 does not has django.utils._os

2009-08-11 Thread dongua
after i download ]
http://code.djangoproject.com/browser/django/branches/0.96-bugfixes/django/utils/_os.py

and runserver:

Development server is running at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Unhandled exception in thread started by 
Traceback (most recent call last):
  File "D:\Python25\Lib\site-packages\django\core\management.py", line 1195,
in
inner_run
handler = AdminMediaHandler(WSGIHandler(), admin_media_path)
NameError: global name 'admin_media_path' is not defined

2009/8/11 Russell Keith-Magee 

>
> On Tue, Aug 11, 2009 at 8:37 PM, dongua wrote:
> >
>  > /django/core/servers/basehttp.py
> > code:
> > from django.utils._os import safe_join
> >
> > but there does not has any _os.py in pacakge, and after install 0.96.4
> > will can't runserver
>
> It appears that the security fix that was committed in r11354 was
> missing a file. I have committed the missing file in r11430.
>
> As a temporary workaround, you can download the missing file
> (django/utils/_os.py) from the Django source code browser [1]. If you
> drop this file into the django/utils directory wherever you have
> installed Django, you will be able to run the development server
> again.
>
> A new release that includes this missing file will be made in the near
> future (time permitting, within a few days).
>
> I deeply apologize for any inconvenience this has caused.
>
> [1]
> http://code.djangoproject.com/browser/django/branches/0.96-bugfixes/django/utils/_os.py
>
> Yours,
> Russ Magee %-)
>
> >
>

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



Re: Location of Change User admin template

2009-08-11 Thread Karen Tracey
On Tue, Aug 11, 2009 at 11:57 PM, Russell Keith-Magee <
freakboy3...@gmail.com> wrote:

>
> On Wed, Aug 12, 2009 at 10:24 AM, Karen Tracey wrote:
> > On Tue, Aug 11, 2009 at 4:14 PM, bfrederi 
> wrote:
> >>
> >> I was browsing contrib/admin templates for the "Change User" template
> >> that allows you to change the user's permissions and such. I can't
> >> seem to find it though. Can anyone point me in the right direction?
> >
> > Admin doesn't have special templates for certain models, so far as I
> know.
>
> Incorrect. See contrib/admin/templates/admin/auth/user. The general
> capability to override templates on a per-model basis is generic. User
> is the only model that exploits this capability by default.
>

Yeah, I did find those and then failed to revise the sentence.  I don't see
a template there for editing a user, though, just adding, changing password,
and confirming delete.  So I think the template for "Change User" is not
customized in any special way for User, it's the standard admin change
template.  So how to get a similar effect (which is what I was guessing the
real underlying question was) for a different model would be found by
looking at the UserAdmin ModelAdmin definitions.

Karen

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



Re: Location of Change User admin template

2009-08-11 Thread Russell Keith-Magee

On Wed, Aug 12, 2009 at 10:24 AM, Karen Tracey wrote:
> On Tue, Aug 11, 2009 at 4:14 PM, bfrederi  wrote:
>>
>> I was browsing contrib/admin templates for the "Change User" template
>> that allows you to change the user's permissions and such. I can't
>> seem to find it though. Can anyone point me in the right direction?
>
> Admin doesn't have special templates for certain models, so far as I know.

Incorrect. See contrib/admin/templates/admin/auth/user. The general
capability to override templates on a per-model basis is generic. User
is the only model that exploits this capability by default.

However, that said, changing the template will only change the way the
information is displayed. If you're looking to actually change the
permissions, you'll need to look at the views, not the template.

Yours,
Russ Magee %-)

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



Re: imitating a spreadsheet (kind of) with formsets

2009-08-11 Thread Karen Tracey
On Tue, Aug 11, 2009 at 7:49 PM, Chris Curvey  wrote:

>
> So, is there a way for me to get a form field out of a form from
> within the templating language?  I'd like to do something like this:
>
> {% for field_name in field_names %}
> 
>  {{ field_name }}
>  {% for form in formset %}
>  {{ form[field_name] %} 
>  {% endfor %}
> 
> {% endfor %}
>
> But this does not work -- Django chokes at the opening "[" with a
> syntax error.
>

You're trying to use Python syntax in the template.  Templates are not
Python.  Recall dictionary lookup in templates (what you look to be trying)
is one of the things done by dot in a template:

http://docs.djangoproject.com/en/dev/topics/templates/#variables

Also you probably want to review this doc:

http://docs.djangoproject.com/en/dev/topics/forms/#looping-over-the-form-s-fields

for some examples of how to loop over the fields in a form (and what all you
can access/display for a field) in a template.  Also this:

http://docs.djangoproject.com/en/dev/topics/forms/formsets/#using-a-formset-in-views-and-templates

for some formset-specific info.

Karen

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



Re: Location of Change User admin template

2009-08-11 Thread Karen Tracey
On Tue, Aug 11, 2009 at 4:14 PM, bfrederi  wrote:

>
> I was browsing contrib/admin templates for the "Change User" template
> that allows you to change the user's permissions and such. I can't
> seem to find it though. Can anyone point me in the right direction?


Admin doesn't have special templates for certain models, so far as I know.
How a model appears in admin is controlled by the ModelAdmin class
registered with the admin for the Model. Since User is an auth model, you'd
want to look in django/contrib/auth/admin.py for the UserAdmin class.

Karen

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



Re: problem with django_openid

2009-08-11 Thread Kenneth Gonsalves

On Wednesday 12 Aug 2009 7:36:57 am Malcolm Tredinnick wrote:
> On Wed, 2009-08-12 at 07:10 +0530, Kenneth Gonsalves wrote:
> > hi
> > was trying to install django_openid on latest svn head. I am getting this
> > error - do not know whether it is mine or openid's
>
> The main error I see here is a complete failure to use cut-and-paste
> view from the debug screen when pasting a traceback. Come on, Kenneth!
> You've been using Django and getting help from this list for far too
> long not to know that pasting a concise representation of the problem
> helps us to help you.

I always goof up in pasting a traceback - never seem to get it right and 
always get screamed at ;-) btw, I did use cut and paste view from the debug 
screen - but seem to have got it wrong.
>
> Also the error is line 42 of the output you did paste. It says template
> syntax error, so that's definitely the first place to start looking and
> searching for the string reported in the template shows up the problem
> fairly quickly.

problem is I posted without my morning coffee - I see the error now.

-- 
regards
kg
http://lawgon.livejournal.com

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



newbie queryset question

2009-08-11 Thread joep

I have a model which contains a list of users and a list of groups
that can access the model, e.g,,

readers = models.ManyToManyField(User, blank=True, null=True,)
reader_groups = models.ManyToManyField(Group, blank=True,
null=True,)

where User and Group are the standard django auth models. Now, given
that I have a user and his/her groups, how can I form a queryset for
the rows of the model that the user has access to? That is, I want
something like:

   select all rows where the user is in the list of readers
   OR the intersection of the user's groups and reader_groups is
not []

I'm kinda stumped. Is this possible?






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



Re: problem with django_openid

2009-08-11 Thread Malcolm Tredinnick

On Wed, 2009-08-12 at 07:10 +0530, Kenneth Gonsalves wrote:
> hi
> was trying to install django_openid on latest svn head. I am getting this 
> error - do not know whether it is mine or openid's

The main error I see here is a complete failure to use cut-and-paste
view from the debug screen when pasting a traceback. Come on, Kenneth!
You've been using Django and getting help from this list for far too
long not to know that pasting a concise representation of the problem
helps us to help you.

Also the error is line 42 of the output you did paste. It says template
syntax error, so that's definitely the first place to start looking and
searching for the string reported in the template shows up the problem
fairly quickly.

Regards,
Malcolm



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



Re: syncdb with ForeignKey to_field outputs statements in wrong order

2009-08-11 Thread Malcolm Tredinnick

On Tue, 2009-08-11 at 12:00 -0700, physicsnick wrote:
> Actually they don't need to be unique (and I don't want them to be
> unique). MySQL does not require that foreign keys be unique; only that
> they be indexed.
> 
> I am actually using this for a temporal database. There are many
> instances of an Author with the same code (an instance for each time
> it was changed). In  relation to the above example I am having the
> Author's default manager filter for live instances of the object, and
> making it be used to resolve foreign keys via "use_for_related_fields
> = True". This means the reverse relationship (book.author) gives one
> object: the live version of the author with the referenced code. While
> the foreign key itself is a many-to-many relation at the database
> level,

Django's ForeignKey field is many-to-one. The fact that it happens not
to raise an error when you twist it slightly in the way you're doing
doesn't mean it's expected to work.

I'm not convinced there is a bug involved here, since you're not using
the ForeignKey class correctly. As far as I can work out, when
ForeignKey is used correctly, we always are going to be generating the
correct SQL.

I thought Django's "validate" management command raised an error when
to_field was used to target a non-unique field, but apparently I'm
hallucinating. That's probably an oversight in the implementation.

Regards,
Malcolm



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



Re: How to get this auto-field id value

2009-08-11 Thread Malcolm Tredinnick

On Tue, 2009-08-11 at 17:27 -0700, David wrote:
> Any tips/suggestions are highly appreciated...

One tip is to wait more than eight hours before posting "please help me"
yet again.

> 
> 
> 
> On Aug 11, 9:26 am, David  wrote:
> > Just a little more information. The autoField id is in the model
> > class.  Model_Form is a form based on this model class.
> >
> > On Aug 11, 9:20 am, David  wrote:
> >
> >
> >
> > > Hello,
> >
> > > I am trying to retrieve an autoField id value in my following code
> > > when I update records.
> >
> > > def update_record(request):
> > > if request.POST:
> > > form = Model_Form(request.POST)
> > > if form.is_valid():
> > > form.save(pk=form.id, force_update=True)
> >
> > > I got an error that "Model_Form" object has no attribute 'id'.
> >
> > > Model_Form is a model-based form class that has an autoField id that
> > > increases one by one. When I update a record, I need to give this
> > > value.
> >
> > > I even tried "pk=form.pk", however it did not work either.

ModelForm subclasses don't include any AutoField values. By definition,
they are *automatically* assigned by the database. If you're using an
AutoField, you don't set it yourself. If you want to manage the primary
key value yourself, don't make it an AutoField.

Regards,
Malcolm



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



Re: dates with a different format in the db

2009-08-11 Thread Malcolm Tredinnick

On Tue, 2009-08-11 at 08:58 -0700, Vokial wrote:
> Hi!
> In a db i have, already filled up with data, i have a varchar field
> which contains dates formatted like "mmdd". Is there a way to make
> Django recognise that field as a proper DateField even if the
> formatting is different than the usual "-mm-dd" ?

Django wouldn't recognise a character field that stored the dates in
-mm-dd format as a DateField, either.

> Because i can't alter the data in that db and i have to order the
> entries by date...

One of the reasons mmdd is quite a decent storage format is that
normal string sorting puts the dates in order. So why can't you just
order on that column as it already stands? You won't be able to do
anything like filter using the __month lookup type, because it isn't a
date field at the database level. But ordering shouldn't be a problem.

> ...maybe by defining a function that automatically decodes the string
> into a datetime python object like strptime?

You can certainly convert the string values to datetime.date objects
easily enough, but that doesn't help with ordering in querysets, for
example, since that ordering happens at the database level.

Regards,
Malcolm



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



Re: Django aggregates and having

2009-08-11 Thread Russell Keith-Magee

On Wed, Aug 12, 2009 at 5:50 AM, lfrodrigues wrote:
>
> Hi,
>
> I'm having some problems with "having":
>
> I want to group by date and restrict to a given week, in my tests I
> can do this:
> select_data = {"d": """date_format(date, '%%U')"""}
> ScoreHistory.objects.extra(select=select_data).values('d').annotate
> (l=Sum("points")).filter(l=2).query.as_sql()
>
> sql:
> SELECT (date_format(date, '%%U')) AS `d`, SUM
> (`profile_scorehistory`.`points`) AS `l` FROM `profile_scorehistory`
> GROUP BY date_format(date, '%%U') HAVING SUM
> (`profile_scorehistory`.`points`) = 2
>
> Good but what I want to get is this:
> sql:
> SELECT (date_format(date, '%%U')) AS `d`, SUM
> (`profile_scorehistory`.`points`) AS `l` FROM `profile_scorehistory`
> GROUP BY date_format(date, '%%U') HAVING  `d`= 2

I might be missing something here, but as far as I can make out,
you're getting exactly what you've asked for. Your query contains
filter(l=2) - that is, you're filtering on l, the SUM.

> How can I force using having when I can't define the param in
> annotate?

I'm afraid I don't see how this relates to your original question.

Yours,
Russ Magee %-)

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



problem with django_openid

2009-08-11 Thread Kenneth Gonsalves

hi
was trying to install django_openid on latest svn head. I am getting this 
error - do not know whether it is mine or openid's

trace back:

Environment:

Request Method: GET
Request URL: http://ilugc.web/
Django Version: 1.2 pre-alpha SVN-11422
Python Version: 2.6.0
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'ilugc.web',
 'django.contrib.comments',
 'django_openidconsumer']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django_openidconsumer.middleware.OpenIDMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'django.middleware.locale.LocaleMiddleware')


Template error:
In template /home/lawgon/ilugc/templates/base.html, error at line 37
   Could not parse the remainder: '/openid/' from '/openid/'
   27 : 


   28 : 


   29 : 


   30 : {% trans "A site for the Indian Linux Users Group 
Chennai Chapter - ILUGC" %}   


   31 : 


   32 : 


   33 : 


   34 : 


   35 : 


   36 : 


   37 :  {% if request.user.is_anonymous %} 


   38 : {% trans "login" %}


   39 : |


   40 : {% trans "register" 
%}


   41 : |


   42 : {% trans "openid" %}


   43 :   {% else %}


   44 : {{ 
request.user.username }}


   45 : |


   46 : {% trans "logout" 
%}


   47 :   {% endif %}


Traceback:
File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py" in 
get_response
  92. response = callback(request, *callback_args, 
**callback_kwargs)
File "/home/lawgon/ilugc/web/views.py" in report
  311. return HttpResponse(t.render(c))
File "/usr/lib/python2.6/site-packages/django/template/__init__.py" in render
  178. return self.nodelist.render(context)
File "/usr/lib/python2.6/site-packages/django/template/__init__.py" in render
  779. bits.append(self.render_node(node, context))
File "/usr/lib/python2.6/site-packages/django/template/debug.py" in 
render_node
  71. result = node.render(context)
File "/usr/lib/python2.6/site-packages/django/template/loader_tags.py" in 
render
  71. compiled_parent = self.get_parent(context)
File "/usr/lib/python2.6/site-packages/django/template/loader_tags.py" in 
get_parent
  68. return get_template_from_string(source, origin, parent)
File "/usr/lib/python2.6/site-packages/django/template/loader.py" in 
get_template_from_string
  90. return Template(source, origin, name)
File "/usr/lib/python2.6/site-packages/django/template/__init__.py" in 
__init__
  168. self.nodelist = compile_string(template_string, origin)
File "/usr/lib/python2.6/site-packages/django/template/__init__.py" in 
compile_string
  189. return parser.parse()
File "/usr/lib/python2.6/site-packages/django/template/__init__.py" in parse
  285. compiled_result = compile_func(self, token)
File "/usr/lib/python2.6/site-packages/django/template/defaulttags.py" in 
do_if
  828. nodelist_true = parser.parse(('else', 'endif'))
File "/usr/lib/python2.6/site-packages/django/template/__init__.py" in parse
  266. filter_expression = self.compile_filter(token.contents)
File "/usr/lib/python2.6/site-packages/django/template/__init__.py" in 
compile_filter
  358. return FilterExpression(token, self)
File "/usr/lib/python2.6/site-packages/django/template/__init__.py" in 
__init__
  538. raise TemplateSyntaxError("Could not parse the remainder: 
'%s' from '%s'" % (token[upto:], token))

Exception Type: TemplateSyntaxError at /
Exception Value: Could not parse the remainder: '/openid/' from '/openid/'

-- 
regards
kg
http://lawgon.livejournal.com

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



Re: AUTH_PROFILE_MODULE in "Definitive Guide" Second Edition?

2009-08-11 Thread Watts Martin

On Aug 11, 5:30 pm, James Bennett  wrote:
> Seeing as how Django's documentation still covers everything you need
> to know about it, it's unlikely there's something newer you're
> missing.

I didn't *think* so, but I am very good at making assumptions that
prove to be wrong in practice!

> It's true that the book doesn't quite cover everything everyone might
> ever do with every feature of every component of Django, but
> unfortunately people would complain if you threw a book that big at
> them.

To be sure -- it's simply that this is a component that was covered in
the first edition, and appears to be something that would come up
pretty commonly in development. It just strikes me as a curious thing
to have decided *not* to include this time around. What led me to go
looking for it earlier this afternoon, actually, was the documentation
for a quite useful-seeming little application called django-profiles,
which directs one to "Chapter 12 of the Django Book." :)

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



Re: AUTH_PROFILE_MODULE in "Definitive Guide" Second Edition?

2009-08-11 Thread James Bennett

On Tue, Aug 11, 2009 at 7:16 PM, Watts Martin wrote:
> I've noticed with some mild consternation that there's absolutely no
> documentation for using AUTH_PROFILE_MODULE in the new edition of
> _Definitive Guide to Django,_ nor is there any indication of something
> else I should be using instead of that if this is being deprecated.

Seeing as how Django's documentation still covers everything you need
to know about it, it's unlikely there's something newer you're
missing.

> So is this safe to use? And if so, should I be mildly concerned about
> other things the _Definitive Guide_ may, uh, not be so definitive on?
> I bought the eBook earlier today as a show of support for the project,
> but I confess this leaves me feeling some trepidation.

It's true that the book doesn't quite cover everything everyone might
ever do with every feature of every component of Django, but
unfortunately people would complain if you threw a book that big at
them (even the online Django documentation, which doesn't come close
managing this feat, weighs in at around a thousand pages).


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

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



Re: How to get this auto-field id value

2009-08-11 Thread David

Any tips/suggestions are highly appreciated...



On Aug 11, 9:26 am, David  wrote:
> Just a little more information. The autoField id is in the model
> class.  Model_Form is a form based on this model class.
>
> On Aug 11, 9:20 am, David  wrote:
>
>
>
> > Hello,
>
> > I am trying to retrieve an autoField id value in my following code
> > when I update records.
>
> > def update_record(request):
> >     if request.POST:
> >         form = Model_Form(request.POST)
> >         if form.is_valid():
> >             form.save(pk=form.id, force_update=True)
>
> > I got an error that "Model_Form" object has no attribute 'id'.
>
> > Model_Form is a model-based form class that has an autoField id that
> > increases one by one. When I update a record, I need to give this
> > value.
>
> > I even tried "pk=form.pk", however it did not work either.
>
> > Any suggestions how to fix this?
>
> > Thanks so much.- 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-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



AUTH_PROFILE_MODULE in "Definitive Guide" Second Edition?

2009-08-11 Thread Watts Martin

I've noticed with some mild consternation that there's absolutely no
documentation for using AUTH_PROFILE_MODULE in the new edition of
_Definitive Guide to Django,_ nor is there any indication of something
else I should be using instead of that if this is being deprecated.

So is this safe to use? And if so, should I be mildly concerned about
other things the _Definitive Guide_ may, uh, not be so definitive on?
I bought the eBook earlier today as a show of support for the project,
but I confess this leaves me feeling some trepidation.

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



Re: Date-based generic view not working

2009-08-11 Thread Thomas Jaggi

It was in fact the timezone. A few hours later it magically worked. ;)
Thanks for your help!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: inspectdb and postgresql schema

2009-08-11 Thread Russell Keith-Magee

On Tue, Aug 11, 2009 at 10:41 PM, Marek
Pietrucha wrote:
>
> Hello,
>
> I have a relational database written in PostgreSQL 8.4. I use
> different schemas - not default public schema. I tried to inspectdb my
> database but the output was clean. It looked like the inspectdb tool
> didn't look in my schemas. I thought it was the matter of the pg
> driver, so I changed it from postgresql-psycopg2 to postgresql.
> Nothing changed. The output was the same.
>
> Is it possible to generate models from my database?
>
> Am i doing something wrong?
>
You're not doing anything wrong; you've just hit the limitations of inspectdb.

Django doesn't currently support database-level schemas. As a result,
inspectdb won't look into schemas to find table definitions.

Adding support for schemas has been proposed in the past, and has
received support from the core team. This means schema support will
probably be added in some future version of Django. However, this
doesn't necessarily mean that they will automatically be fully
supported in inspectdb - inspectdb is intended as a crutch, not as a
major part of the Django development process. The capabilities of
inspectdb have always lagged behind those of Django itself, simply
because introspection of this kind is extremely difficult to achieve.

Yours,
Russ Magee %-)

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



Re: imitating a spreadsheet (kind of) with formsets

2009-08-11 Thread Chris Curvey



On Aug 10, 10:13 pm, Malcolm Tredinnick 
wrote:
> On Mon, 2009-08-10 at 19:07 -0700, Chris Curvey wrote:
> > What I want to do is have a series of forms, all next to each other in
> > table format, like this:
>
> > Car     Honda      Toyota       Chevy
> > Price   $12,000    $14,000   $10,000
> > MPG   30             28            26
> > Color  Blue          Red           Yellow
>
> > (I'm sure that's going to look like crap in a proportional font.)  But
> > the point is that Car, Price, MPG and Color are all labels, and
> > everything else (Honda, $12,000, 30, Blue, etc) is a form field.
>
> > I can create the formset and use as_table() to get the forms
> > generated, but I seem to either get the label repeated for every form,
> > or not at all.  Can someone point me in a direction to get the form
> > labels listed only once?
>
> At some point, when you're doing highly customised form layout, you have
> to switch from using the convenience methods for the simple cases and
> attend to all the little details yourself. This means laying out each
> form element appropriately. Maybe you write a template tag to do that,
> or maybe you can do it with some for-loops in the form. But as_table()
> and friends aren't designed for this kind of thing.
>

Thanks Malcolm.  Not the answer I was hoping for, but good to know
that I'm not missing something obvious.

So, is there a way for me to get a form field out of a form from
within the templating language?  I'd like to do something like this:

{% for field_name in field_names %}

  {{ field_name }}
  {% for form in formset %}
  {{ form[field_name] %} 
  {% endfor %}

{% endfor %}

But this does not work -- Django chokes at the opening "[" with a
syntax error.

My other thought would be that I could try to add something to my
formset (a method called as_grid()) that could do the iteration in
Python and return what I need...but I could use a pointer on how to
get started with that.

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



Re: Model example for simple family tree

2009-08-11 Thread Mike Dewhirst

sniper wrote:
> Hi,
> I am new to django and wanted to try it out.
> 
> I would like to create a table for family tree
> where Relation is a many to many table which contains Profile ids
> 
> profile_id, relative_id,type,priority.
> 
> RELATIVE_CHOICES = (
> (u'F', u'Father'),
> (u'M', u'Mother'),
> (u'B', u'Brother'),
> (u'S', u'Sister'),
> (u'N', u'Son'),
> (u'D', u'Daugter'),
> (u'H', u'Husband'),
> (u'W', u'Wife'),
> )
> 
> # Create your models here.
> class Profile(models.Model):
>   first_name = models.CharField(max_length=20)
>   last_name = models.CharField(max_length=20,null=True)
>   gender = models.CharField(max_length=2, choices=GENDER_CHOICES)
>   birth_date = models.DateTimeField('birth day',null=True)
>   notes = models.TextField(null=True)
> 
> 

Sniper

I did exactly the same thing at exactly the same stage of my own 
exposure to Django. It gets easier as the newness wears off a bit and 
you get to trust the error messages.

Good luck

> class Relation(models.Model):

 person = models.ForeignKey(Profile, related_name='person_set')

>   person = models.ForeignKey(Profile)

 relative = models.ForeignKey(Profile, related_name='relation_set')

>   relative = models.ForeignKey(Profile)
>   type=models.CharField(max_length=2, choices=RELATIVE_CHOICES)
>   priority = models.IntegerField(default=1)
> 
> how do i do that?
> right now i am getting this error
> 
> Error: One or more models did not validate:
> ftree.relation: Accessor for field 'person' clashes with related field
> 'Profile.relation_set'. Add a
>  related_name argument to the definition for 'person'.
> ftree.relation: Accessor for field 'relative' clashes with related
> field 'Profile.relation_set'. Add
>  a related_name argument to the definition for 'relative'.
> 
> thanks
> 
> 
> > 
> 
> 


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



Re: More Than Two Models With inlineformset_factory

2009-08-11 Thread Geraldo

Excellent, Matthias...  That should work nicely.  It does appear,
however, that there is no way to have more than 2 forms in a single
formset.  If inlineformset_factory had an append method things might
be a bit cleaner.

Thanks again for your help.
geraldo

On Aug 11, 3:55 pm, Matthias Kestenholz
 wrote:
> On Tue, Aug 11, 2009 at 10:04 PM, Geraldo wrote:
>
> > Hi,
>
> > I'm new to Django and am putting together a page for my new site.  I
> > want to be able to edit data that is contained in 3 models, organized
> > as follows:
> > Parent
> >  --> Child 1 (always one to one)
> >  --> Child 2 (one or more)
>
> > I understand I can do the following:
>
> > class Parent(models.Model):
> >    name = models.CharField(max_length=100)
> >    parent_type = models.CharField(max_length=10)
>
> > class Child1(models.Model):
> >    name = models.ForeignKey(Author)
> >    address = models.CharField(max_length=100)
>
> > class Child2(models.Model):
> >    name = models.ForeignKey(Author)
> >    gender = models.CharField(max_length=8)
>
> > # so I can do this to get a formset with Parent and Child1
> > Formset1 = inlineformset_factory(Parent, Child1)
> > dad = Parent.objects.get(name=u'Popeye')
> > formset = Formset1(instance=dad)
>
> > # or this to get a formset with Parent and Child2
> > Formset2 = inlineformset_factory(Parent, Child2)
> > dad = Parent.objects.get(name=u'Popeye')
> > formset = Formset2(instance=dad)
>
> > What I don't understand is how I get both child1 and child2 in my
> > formset?
>
> You can pass a prefix parameter when constructing the formsets (not
> the formset classes):
>
> Formset1 = inlineformset_factory(Parent, Child1)
> Formset2 = inlineformset_factory(Parent, Child2)
>
> if request.method == 'POST':
>     child1_formset = Formset1(request.POST, ..., prefix='child1')
>     child2_formset = Formset2(request.POST, ..., prefix='child2')
> else:
>     child1_formset = Formset1(..., prefix='child1')
>     child2_formset = Formset2(..., prefix='child2')
>
> This prefix will be added to all formset fields automatically. The
> browser and Django will be able to differentiate between the two
> formsets now.
>
> Matthias
>
> --http://spinlock.ch/pub/feincms/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Post matching query does not exist.

2009-08-11 Thread Daniel Roseman

On Aug 11, 8:27 pm, When ideas fail  wrote:
> After some more experiments i've decided its definetly some sort of
> problem with the URLs, if i comment one out the 2nd works and if i
> have them uncomment it doesn't.
>
> Can anyone help me with this please?
>
> On 11 Aug, 19:30, When ideas fail  wrote:
>
>
>
> > Hi, I have a strange error which i hope someone might be able to help
> > me with. Two of my urls seems to be conflicting somehow. i have these
> > two URLs:
>
> >     (r'^blog/(?P.+)/$', 'mysite.blog.views.title_view'),
> >     (r'^blog/category/(?P.+)/$',
> > 'mysite.blog.views.category_view'),

Your first regex is matching everything after /blog/ - including /blog/
category//. So your url is being dispatched to the first view,
which is trying to match a post with the title 'category/Andrew',
which obviously doesn't exist.

Either move the second URL above the first, or use \w+ instead of .+
to match only word characters within the slug, or preferably both.
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Model example for simple family tree

2009-08-11 Thread sniper

Hi,
I am new to django and wanted to try it out.

I would like to create a table for family tree
where Relation is a many to many table which contains Profile ids

profile_id, relative_id,type,priority.

RELATIVE_CHOICES = (
(u'F', u'Father'),
(u'M', u'Mother'),
(u'B', u'Brother'),
(u'S', u'Sister'),
(u'N', u'Son'),
(u'D', u'Daugter'),
(u'H', u'Husband'),
(u'W', u'Wife'),
)

# Create your models here.
class Profile(models.Model):
first_name = models.CharField(max_length=20)
last_name = models.CharField(max_length=20,null=True)
gender = models.CharField(max_length=2, choices=GENDER_CHOICES)
birth_date = models.DateTimeField('birth day',null=True)
notes = models.TextField(null=True)


class Relation(models.Model):
person = models.ForeignKey(Profile)
relative = models.ForeignKey(Profile)
type=models.CharField(max_length=2, choices=RELATIVE_CHOICES)
priority = models.IntegerField(default=1)

how do i do that?
right now i am getting this error

Error: One or more models did not validate:
ftree.relation: Accessor for field 'person' clashes with related field
'Profile.relation_set'. Add a
 related_name argument to the definition for 'person'.
ftree.relation: Accessor for field 'relative' clashes with related
field 'Profile.relation_set'. Add
 a related_name argument to the definition for 'relative'.

thanks


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



Re: Deploying django on apache - cant access database

2009-08-11 Thread Graham Dumpleton

For SQLite database, the directory the database is in must also be
writable to user that Apache runs as. The location of the database in
settings file must also be an absolute path, can't use a relative
path.

BTW, what is:

  Alias test.django.com "/Users/someone/djangoproject/appname"

for in configuration? It will have no effect and normall your wouldn't
have anything like that in configuration for Django.

Graham

On Aug 12, 4:45 am, consiglieri  wrote:
> Thanks for the tip, however it does not make a difference. I moved the
> app to another catalogue and made sure that the database file was
> chmod to 755 and also that all directories have the same permissions.
> The error remains.
>
> There is something happening that i dont understand. I'm beginning to
> think there is someting wrong with the django or mod_python
> installation but i am at a loss understanding what it can be.
>
> Thomas
>
> On 11 Aug, 19:04, Mike Ramirez  wrote:
>
>
>
> > On Tuesday 11 August 2009 09:43:38 am consiglieri wrote:
>
> > > Hi
>
> > > I'm new with django and have made a small test app which works as it
> > > should with the development server.
>
> > > However when i try and deploy it with apache and mod_python I cant get
> > > it to work. I have tested that mod_python works. I can do the
> > > recommended mod_python test. When i try to run the django app via
> > > apache it works well as long as the page being displayed does not
> > > actually try and access the database. In other words if I enter a url
> > > that just pops up an empty page with no django tags in it the page is
> > > displayed as it should.
>
> > > These are my settings.
>
> > > Apache 2.2.11
> > > mod_python 3.3.2-dev
> > > I am on a Mac (Leopard 10.5.8)
> > > I have the latest stable version of django 1.1
>
> > > When I start apache the following can be found in the logs
>
> > > Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.7l DAV/2 mod_python/
> > > 3.3.2-dev-20080819 Python/2.5.1 configured -- resuming normal
> > > operations
>
> > > The necessary settings in httpd.conf with regards to django is as
> > > follows
>
> > > Alias test.django.com "/Users/someone/djangoproject/appname"
>
> > > SetHandler python-program
> > > PythonHandler django.core.handlers.modpython
> > > SetEnv DJANGO_SETTINGS_MODULE appname.settings
> > > PythonDebug On
> > > PythonPath "['/Users/someone/djangoproject/'] + sys.path"
>
> > > When i run a url that invokes a function which tries to access the
> > > database (sqlite3 in this case) i receive the following error
>
> > You have to make sure the database file is also readable and writeable by 
> > the
> > user apache is running as.  The leading path should also be readable to the
> > apache user.  755 settings on the directories in the tree.  
>
> > Some ways of fixing this are making a group; say djangodevs and add both 
> > your
> > user and the apache user to that group and setting the sqlite file to be
> > rwxrwx---.
>
> > You could run apache as your user by changing the User/Group setting in your
> > httpd.conf/apache2.conf (see sample below) or a variation of this with the
> > above suggestion.
>
> > # User/Group: The name (or #number) of the user/group to run httpd as.      
> > #  . On SCO (ODT 3) use "User nouser" and "Group nogroup".                  
> > #  . On HPUX you may not be able to use shared memory as nobody, and the    
> > #    suggested workaround is to create a user www and use that user.        
> > #  NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)        
> > #  when the value of (unsigned)Group is above 6;                        
> > #  don't use Group #-1 on these systems!                                    
> > #                                                                          
> > User youruser                                                              
> > Group youruser
>
> > I would personally recommend that you store your project files outside of 
> > your
> > home directory, I believe/assume /Users/someone/ is your home directory. I
> > would use something like /srv/djangoproject and configure the settings so
> > both your user and the apache user can read write to the files through the
> > group settings.
>
> > With a database like mysql/postgres that you connect to over a network you
> > wouldn't need to worry about this since they have their own login.  
>
> > Mike
>
> > > TemplateSyntaxError at /appname/clients/
> > > Caught an exception while rendering: no such table:
> > > addressbook_contacts
>
> > > Original Traceback (most recent call last):
> > >   File "/Library/Python/2.5/site-packages/django/template/debug.py",
> > > line 71, in render_node
> > >     result = node.render(context)
> > >   File "/Library/Python/2.5/site-packages/django/template/
> > > defaulttags.py", line 126, in render
> > >     len_values = len(values)
> > >   File "/Library/Python/2.5/site-packages/django/db/models/query.py",
> > > 

Re: More Than Two Models With inlineformset_factory

2009-08-11 Thread Matthias Kestenholz

On Tue, Aug 11, 2009 at 10:04 PM, Geraldo wrote:
>
> Hi,
>
> I'm new to Django and am putting together a page for my new site.  I
> want to be able to edit data that is contained in 3 models, organized
> as follows:
> Parent
>  --> Child 1 (always one to one)
>  --> Child 2 (one or more)
>
> I understand I can do the following:
>
> class Parent(models.Model):
>    name = models.CharField(max_length=100)
>    parent_type = models.CharField(max_length=10)
>
> class Child1(models.Model):
>    name = models.ForeignKey(Author)
>    address = models.CharField(max_length=100)
>
> class Child2(models.Model):
>    name = models.ForeignKey(Author)
>    gender = models.CharField(max_length=8)
>
> # so I can do this to get a formset with Parent and Child1
> Formset1 = inlineformset_factory(Parent, Child1)
> dad = Parent.objects.get(name=u'Popeye')
> formset = Formset1(instance=dad)
>
> # or this to get a formset with Parent and Child2
> Formset2 = inlineformset_factory(Parent, Child2)
> dad = Parent.objects.get(name=u'Popeye')
> formset = Formset2(instance=dad)
>
> What I don't understand is how I get both child1 and child2 in my
> formset?
>

You can pass a prefix parameter when constructing the formsets (not
the formset classes):

Formset1 = inlineformset_factory(Parent, Child1)
Formset2 = inlineformset_factory(Parent, Child2)

if request.method == 'POST':
child1_formset = Formset1(request.POST, ..., prefix='child1')
child2_formset = Formset2(request.POST, ..., prefix='child2')
else:
child1_formset = Formset1(..., prefix='child1')
child2_formset = Formset2(..., prefix='child2')


This prefix will be added to all formset fields automatically. The
browser and Django will be able to differentiate between the two
formsets now.

Matthias

-- 
http://spinlock.ch/pub/feincms/

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



Re: is Django a good choice for a LAN app?

2009-08-11 Thread Matthias Kestenholz

On Tue, Aug 11, 2009 at 10:00 PM, Peterle wrote:
>
> Perhaps Zope-Plone is more suitable for that purpose.

Perhaps not.

Do you have anything to back this statement? (I'm not saying it's
untrue, I'm just trying to point out that this contribution wasn't
particularly helpful.

A bit more on topic: I've built an intranet application (sort of a
CRM) on Django, and I think it works great for this purpose.


Matthias

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



Django aggregates and having

2009-08-11 Thread lfrodrigues

Hi,

I'm having some problems with "having":

I want to group by date and restrict to a given week, in my tests I
can do this:
select_data = {"d": """date_format(date, '%%U')"""}
ScoreHistory.objects.extra(select=select_data).values('d').annotate
(l=Sum("points")).filter(l=2).query.as_sql()

sql:
SELECT (date_format(date, '%%U')) AS `d`, SUM
(`profile_scorehistory`.`points`) AS `l` FROM `profile_scorehistory`
GROUP BY date_format(date, '%%U') HAVING SUM
(`profile_scorehistory`.`points`) = 2

Good but what I want to get is this:
sql:
SELECT (date_format(date, '%%U')) AS `d`, SUM
(`profile_scorehistory`.`points`) AS `l` FROM `profile_scorehistory`
GROUP BY date_format(date, '%%U') HAVING  `d`= 2

How can I force using having when I can't define the param in
annotate?

Thanks in advance,

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



Re: Apache mod_wsgi Django setup - Forbidden You don't have permission to access /mysite on this server.

2009-08-11 Thread Graham Dumpleton



On Aug 12, 12:13 am, justin jools  wrote:
> Ive been the install instructions in 
> :http://wiki.thinkhole.org/howto:django_on_windows%E2%80%8F
> (with mod_wsgi)
>
> install python 26, Apache 2.2, modwsgi ap2.2 py26
>
> and apache loads modwsgi fine.
>
> when I check localhost: apache says - It works!
> when I check 127.0.0.1:8000: Django says - It worked!
>
> but when i try to open the Django directory mysite: localhost/mysite i
> get :
>
> Forbidden
>
> You don't have permission to access /mysite on this server.
>
> I have re-installed and installed this many times but still the same
> thing. The tutorial says should get: It worked
>
> httpd.conf
> LoadModule wsgi_module modules/mod_wsgi.so
> WSGIScriptAlias / /usr/local/mysite/django.ws
>
> runs fine, as in:http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
>
> could someone please help with this...

The instructions also say to have configuration:


Order deny,allow
Allow from all


as well as other configuration, that being the location where you put
the .wsgi fle. Why haven't you done similar thing for your setup?

You also need an Alias directive and access configuration to make
available the media files. Again, you appear not to have done that.
Please reread the instructions and if above isn't all your
configuration you duplicated from documented instructions, also show
the rest and detail where you installed things on the filesystem.

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



More Than Two Models With inlineformset_factory

2009-08-11 Thread Geraldo

Hi,

I'm new to Django and am putting together a page for my new site.  I
want to be able to edit data that is contained in 3 models, organized
as follows:
Parent
 --> Child 1 (always one to one)
 --> Child 2 (one or more)

I understand I can do the following:

class Parent(models.Model):
name = models.CharField(max_length=100)
parent_type = models.CharField(max_length=10)

class Child1(models.Model):
name = models.ForeignKey(Author)
address = models.CharField(max_length=100)

class Child2(models.Model):
name = models.ForeignKey(Author)
gender = models.CharField(max_length=8)

# so I can do this to get a formset with Parent and Child1
Formset1 = inlineformset_factory(Parent, Child1)
dad = Parent.objects.get(name=u'Popeye')
formset = Formset1(instance=dad)

# or this to get a formset with Parent and Child2
Formset2 = inlineformset_factory(Parent, Child2)
dad = Parent.objects.get(name=u'Popeye')
formset = Formset2(instance=dad)

What I don't understand is how I get both child1 and child2 in my
formset?

Any help would be greatly appreciated.  Thanks so much in advance!
geraldo


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



Re: is Django a good choice for a LAN app?

2009-08-11 Thread Peterle

Perhaps Zope-Plone is more suitable for that purpose.

_
On Aug 11, 9:06 pm, snfctech  wrote:
> I'm about to start a fairly large project for a mid-sized business
> with a lot of integration with other systems (POS, accounting,
> website, inventory, purchasing, etc.) The purpose of the system is to
> try to reduce current data siloing and give employees role-based
> access to the specific data entry and reports they need, as well as to
> replace some manual and redundant business processes. The system needs
> to be cross-platform (Windows/Linux), open source and is primarily for
> LAN use.
>
> My experience is mostly PHP/web/app development, but I have developed
> a few LAN apps using Java/Servoy (like Filemaker). I am leaning
> towards Python/Django - but wondering whether this may be
> unnecessarily web-specific. I really felt Servoy development was very
> rapid, and it was cross-paltform, but it was not open source (not to
> mention that anything custom needed to be Java which I find too
> verbose/ slow to develop in). Or maybe Open Office Base and some
> scripting is sufficient to handle my needs.
>
> So, my main question is: Does a web framework like Django sound like a
> reasonable platform to build a LAN Dashboard for a mid-sized company?
> Or am I thinking too much like a web developer?
>
> Any tips or suggestions would be greatly appreciated.

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



Re: Extending Django-cms Menu

2009-08-11 Thread odonnell

Try getting it to work with one blog first.

On Aug 11, 7:10 am, Alessandro Ronchi 
wrote:
> 2009/8/11 Alessandro Ronchi 
>
> > I have a django-cms app with this menu:
>
> I've partially solved my problem.
> but it doesn't get get_title from the model.
>
> It's very strange, because I've followed the documentation example 
> onhttp://github.com/digi604/django-cms-2.0/blob/18d184375fdf2e94a5c5a26...
>
> --
> Alessandro Ronchi
>
> SOASI
> Sviluppo Software e Sistemi Open Sourcehttp://www.soasi.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Extending Django-cms Menu

2009-08-11 Thread odonnell

Never mind, I read your question wrong.

On Aug 11, 7:10 am, Alessandro Ronchi 
wrote:
> 2009/8/11 Alessandro Ronchi 
>
> > I have a django-cms app with this menu:
>
> I've partially solved my problem.
> but it doesn't get get_title from the model.
>
> It's very strange, because I've followed the documentation example 
> onhttp://github.com/digi604/django-cms-2.0/blob/18d184375fdf2e94a5c5a26...
>
> --
> Alessandro Ronchi
>
> SOASI
> Sviluppo Software e Sistemi Open Sourcehttp://www.soasi.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django newbie, having problems with my first app. maybe in the urls.py?

2009-08-11 Thread ezulo...@gmail.com

AHA, both of those were the problem :)

got my hello world working, im sure i'll have many more questions!

Thanks!!!

On Aug 10, 5:06 am, gumbah  wrote:
> Whoops... i see now that it never even finds your urs.py so it must be
> something wrong with the configuration on webfaction...
>
> you have to look into your /webapps/PROJECT_NAME/apache/conf/
> httpd.conf file to see if everything is setup correctly.
>
> On Aug 10, 12:01 pm, gumbah  wrote:
>
>
>
> > I read "from mysite.views import hello " in your code...
>
> > are you sure your webapp is in the "mysite" folder?
>
> > best regards
>
> > On Aug 10, 1:45 am, "ezulo...@gmail.com"  wrote:
>
> > > So i am very new to django and have a little python experience. im
> > > using webfraction to host my application and followed their
> > > instructions on starting a django webapp. i have the server up and
> > > running and im using the 1.0 documentation at djangobook.com, and
> > > running django 1.0 for my webapp. I cannot seem to get my helloworld
> > > URL athttp://ezuloaga.webfactional.com/myproject/hello/todisplay
> > > anything other than the default django page. here are my views.py and
> > > urls.py files. according to the documentation, it should display my
> > > hello world page. Thanks for any help!
>
> > > [ezulo...@web93 myproject]$ cat views.py
> > > from django.http import HttpResponse
>
> > > def hello(request):
> > >     return HttpResponse("Hello world")
>
> > > 
>
> > > [ezulo...@web93 myproject]$ cat urls.py
> > > from django.conf.urls.defaults import *
> > > from mysite.views import hello
>
> > > urlpatterns = patterns('',
> > >     ('^hello/$', hello),
> > > )
>
> > >http://ezuloaga.webfactional.com/myproject/hello/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: is Django a good choice for a LAN app?

2009-08-11 Thread Joshua Russo
On Tue, Aug 11, 2009 at 6:06 PM, snfctech  wrote:

>
> I'm about to start a fairly large project for a mid-sized business
> with a lot of integration with other systems (POS, accounting,
> website, inventory, purchasing, etc.) The purpose of the system is to
> try to reduce current data siloing and give employees role-based
> access to the specific data entry and reports they need, as well as to
> replace some manual and redundant business processes. The system needs
> to be cross-platform (Windows/Linux), open source and is primarily for
> LAN use.
>
> My experience is mostly PHP/web/app development, but I have developed
> a few LAN apps using Java/Servoy (like Filemaker). I am leaning
> towards Python/Django - but wondering whether this may be
> unnecessarily web-specific. I really felt Servoy development was very
> rapid, and it was cross-paltform, but it was not open source (not to
> mention that anything custom needed to be Java which I find too
> verbose/ slow to develop in). Or maybe Open Office Base and some
> scripting is sufficient to handle my needs.
>
> So, my main question is: Does a web framework like Django sound like a
> reasonable platform to build a LAN Dashboard for a mid-sized company?
> Or am I thinking too much like a web developer?
>
> Any tips or suggestions would be greatly appreciated.


I'm going to second Antoni's take. Django and Python is probably about the
best choice you could make. Python has all the functionality you could
possibly need (and more if you really get into stuff like meta classes) and
Django just makes the entire development process a breeze.

With that said, it sounds like you want to connect to multiple DBs from a
single app. I don't have experience in the Django environment with multiple
db connections, though I know there is work being done in that direction.
Hopefully someone else here can shed more light on that.

What I would look at for now would be the connectivity availability to your
other systems. You can find info about Django direct support here:
http://docs.djangoproject.com/en/dev/ref/databases/#ref-databases

Though even if it's an odd type of storage system or the need for multiple
connections there should be way to do what needs to be done in Python.

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



Location of Change User admin template

2009-08-11 Thread bfrederi

I was browsing contrib/admin templates for the "Change User" template
that allows you to change the user's permissions and such. I can't
seem to find it though. Can anyone point me in the right direction?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: is Django a good choice for a LAN app?

2009-08-11 Thread Antoni Aloy

2009/8/11 snfctech :
>
> I'm about to start a fairly large project for a mid-sized business
> with a lot of integration with other systems (POS, accounting,
> website, inventory, purchasing, etc.) The purpose of the system is to
> try to reduce current data siloing and give employees role-based
> access to the specific data entry and reports they need, as well as to
> replace some manual and redundant business processes. The system needs
> to be cross-platform (Windows/Linux), open source and is primarily for
> LAN use.
>
> My experience is mostly PHP/web/app development, but I have developed
> a few LAN apps using Java/Servoy (like Filemaker). I am leaning
> towards Python/Django - but wondering whether this may be
> unnecessarily web-specific. I really felt Servoy development was very
> rapid, and it was cross-paltform, but it was not open source (not to
> mention that anything custom needed to be Java which I find too
> verbose/ slow to develop in). Or maybe Open Office Base and some
> scripting is sufficient to handle my needs.
>
> So, my main question is: Does a web framework like Django sound like a
> reasonable platform to build a LAN Dashboard for a mid-sized company?
> Or am I thinking too much like a web developer?
>

Well, in my oppinion web application has sense because you are going
to forget about upgrading the application each time there is a new
version of windows, and makes the updates a pleasure. You can make the
applications as complicated as you want, you can use Django and add a
javascript front end (Dojo, Extjs, jQuery UI, Qoodoxx, etc) or just
give the users a simple  interface to do they work, you have both
options.

Python means you can make a rapid development and that you have lots,
tons of libraries and routines that are goint to help you. Actually
developing web applications for internal use has lot of sense and
protects your inversion, as the actual application you're making today
for internal use, coud be accessible from outside the company with
nearly no effort.

Just my two cents.

-- 
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.net

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



Re: Post matching query does not exist.

2009-08-11 Thread When ideas fail

After some more experiments i've decided its definetly some sort of
problem with the URLs, if i comment one out the 2nd works and if i
have them uncomment it doesn't.

Can anyone help me with this please?

On 11 Aug, 19:30, When ideas fail  wrote:
> Hi, I have a strange error which i hope someone might be able to help
> me with. Two of my urls seems to be conflicting somehow. i have these
> two URLs:
>
>     (r'^blog/(?P.+)/$', 'mysite.blog.views.title_view'),
>     (r'^blog/category/(?P.+)/$',
> 'mysite.blog.views.category_view'),
>
> 
>
> which relate to two views which summarised are like this:
>
> def title_view(request, category):
>     blog_post = Post.objects.get(post_slug=slug)
>     ...
>     return render_to_response('blogSite/index.html', locals(),
> context_instance=RequestContext(request))
>
> def category_view(request, category):
>     blog_posts = Post.objects.filter
> (post_tags__tag_name='category').order_by("-post_date")
>     ...
>     return render_to_response('blogSite/index.html', locals(),
> context_instance=RequestContext(request))
>
> 
>
> Title view works fine but if i go on mysite.com/blog/category/General
> I get the following error:
>
> File "C:\ProgLangs\Python25\lib\site-packages\django\core\handlers
> \base.py" in get_response
>   86.                 response = callback(request, *callback_args,
> **calhttp://localhost:8080/akonline/blog/category/Andrew/lback_kwargs)
> File "C:/Program Files/Apache2.2\mysite\blog\views.py" in title_view
>   100.         blog_post = Post.objects.get(post_slug=slug)
> File "C:\ProgLangs\Python25\lib\site-packages\django\db\models
> \manager.py" in get
>   93.         return self.get_query_set().get(*args, **kwargs)
> File "C:\ProgLangs\Python25\lib\site-packages\django\db\models
> \query.py" in get
>   309.                     % self.model._meta.object_name)
>
> Exception Type: DoesNotExist at /blog/category/Andrew/
> Exception Value: Post matching query does not exist.
>
> The error mentions File "C:/Program Files/Apache2.2\mysite\blog
> \views.py" in title_view
>   100.         blog_post = Post.objects.get(post_slug=slug) but this
> line is in the first view which works.
>
> Category isn't going to match post)slug and it shouldn't so they seem
> to be conflicting somehow.
> I'd appreciate any help or even suggestion.
>
> Thank you
>
> Andrew
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



is Django a good choice for a LAN app?

2009-08-11 Thread snfctech

I'm about to start a fairly large project for a mid-sized business
with a lot of integration with other systems (POS, accounting,
website, inventory, purchasing, etc.) The purpose of the system is to
try to reduce current data siloing and give employees role-based
access to the specific data entry and reports they need, as well as to
replace some manual and redundant business processes. The system needs
to be cross-platform (Windows/Linux), open source and is primarily for
LAN use.

My experience is mostly PHP/web/app development, but I have developed
a few LAN apps using Java/Servoy (like Filemaker). I am leaning
towards Python/Django - but wondering whether this may be
unnecessarily web-specific. I really felt Servoy development was very
rapid, and it was cross-paltform, but it was not open source (not to
mention that anything custom needed to be Java which I find too
verbose/ slow to develop in). Or maybe Open Office Base and some
scripting is sufficient to handle my needs.

So, my main question is: Does a web framework like Django sound like a
reasonable platform to build a LAN Dashboard for a mid-sized company?
Or am I thinking too much like a web developer?

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



Re: Javascript with built-in templates tags

2009-08-11 Thread Michael
On Tue, Aug 11, 2009 at 2:53 PM, WilsonOfCanada  wrote:

>
> I want to access the string from the list that is in the dictionary:
>
> function changeArea()
> {
>alert({{list_areas.British_Columbia}});
> }
>
> I get what I want in the generated HTML:
>
> function changeArea()
> {
>alert(['Metro Vancouver', 'Metro Vancouver A', 'Sunshine Coast']);
> }
>
> However, when I tried using:
>
> function changeArea()
> {
>alert({{list_areas.British_Columbia.0}});
> }
>
> I get this:
>
> function changeArea()
> {
>alert(Metro Vancouver);
> }
> (it is not a string)
>
> Thanks


Django template language is just a template that is all done on the server
side of things. Javascript is client side and doesn't care about the django
template. It thinks (rightly so) that this is just a static web page.

So when you use variables from a Django template, you have to expect all the
output to be written literally. So the proper way to do this with the
javascript you gave is by putting quotes around the variable:
alert('{{ Your Variable }}')

Now when you view source, that is what Django is sending to your browser and
your browser then executes the javascript.

I hope that helps,

Michael

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



Re: syncdb with ForeignKey to_field outputs statements in wrong order

2009-08-11 Thread physicsnick

Actually they don't need to be unique (and I don't want them to be
unique). MySQL does not require that foreign keys be unique; only that
they be indexed.

I am actually using this for a temporal database. There are many
instances of an Author with the same code (an instance for each time
it was changed). In  relation to the above example I am having the
Author's default manager filter for live instances of the object, and
making it be used to resolve foreign keys via "use_for_related_fields
= True". This means the reverse relationship (book.author) gives one
object: the live version of the author with the referenced code. While
the foreign key itself is a many-to-many relation at the database
level, it is meant to be filtered to a specific revision of the
database to resolve its parent (hence many-to-one).

This already all works. The only problem is that syncdb is not
creating the tables properly; we have to manually create them all by
re-ordering the sql.

Nick


On Aug 10, 8:49 pm, Karen Tracey  wrote:
> On Mon, Aug 10, 2009 at 3:52 PM, physicsnick  wrote:
>
> > Hello,
>
> > I'm trying to use ForeignKey on a specific indexed column using the
> > to_field attribute. Unfortunately syncdb seems to be outputting the
> > ADD CONSTRAINT statement before the CREATE INDEX on the to_field, so
> > mysql refuses to add the constraint and syncdb quits with an
> > exception.
>
> > Here's a simple example:
>
> > from django.db import models
>
> > class Author(models.Model):
> >    code = models.CharField(max_length=10, db_index=True)
> >    first_name = models.CharField(max_length=30)
> >    last_name = models.CharField(max_length=40)
>
> > class Book(models.Model):
> >    title = models.CharField(max_length=100)
> >    author = models.ForeignKey(Author, to_field='code')
>
> > Here, the Author class has an indexed 'code' column, a short
> > alphanumeric string that identifies it; we want the Book's foreign key
> > to use this rather than the numeric id.
>
> > This is the output of "./manage.py sqlall books" using MySQL with
> > InnoDB default tables:
>
> > BEGIN;
> > CREATE TABLE `books_author` (
> >    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
> >    `code` varchar(10) NOT NULL,
> >    `first_name` varchar(30) NOT NULL,
> >    `last_name` varchar(40) NOT NULL
> > )
> > ;
> > CREATE TABLE `books_book` (
> >    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
> >    `title` varchar(100) NOT NULL,
> >    `author_id` varchar(10) NOT NULL
> > )
> > ;
> > ALTER TABLE `books_book` ADD CONSTRAINT `author_id_refs_code_36b0cc23`
> > FOREIGN KEY (`author_id`) REFERENCES `books_author` (`code`);
> > CREATE INDEX `books_author_code` ON `books_author` (`code`);
> > CREATE INDEX `books_book_author_id` ON `books_book` (`author_id`);
> > COMMIT;
>
> > This is not correct. The index on books_author(code) needs to be
> > created before the foreign key constraint is added, otherwise it will
> > fail because the target columns of foreign keys need to be indexed.
> > When I run syncdb, it fails with the following error (which you can
> > see if you just paste the above sql into a temporary database):
>
> > _mysql_exceptions.OperationalError: (1005, "Can't create table
> > 'testfk.#sql-12a3_81' (errno: 150)")
>
> > In my case I need to run syncdb and wait for it to fail, then manually
> > create the index I need, then run syncdb again (and repeat, since I
> > have many foreign keys with custom columns). Or I need to not use
> > syncdb at all, and instead use the sqlall command and reorder the
> > statements myself.
>
> > Is this a django bug? Am I doing something wrong?
>
> Why are you specifying db_index=True instead of unique=True on these fields
> that are targets of foreign keys?  They need to be unique if the many-to-one
> nature of ForeignKey is to be maintained.  If you use unique=True I do not
> think you will encounter the problem you are seeing.  (I think it is a bug
> that Django-level validation does not require that the to_field value be a
> field with unique=True.)
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Javascript with built-in templates tags

2009-08-11 Thread WilsonOfCanada

I want to access the string from the list that is in the dictionary:

function changeArea()
{
alert({{list_areas.British_Columbia}});
}

I get what I want in the generated HTML:

function changeArea()
{
alert(['Metro Vancouver', 'Metro Vancouver A', 'Sunshine Coast']);
}

However, when I tried using:

function changeArea()
{
alert({{list_areas.British_Columbia.0}});
}

I get this:

function changeArea()
{
alert(Metro Vancouver);
}
(it is not a string)

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



Re: Deploying django on apache - cant access database

2009-08-11 Thread consiglieri

Thanks for the tip, however it does not make a difference. I moved the
app to another catalogue and made sure that the database file was
chmod to 755 and also that all directories have the same permissions.
The error remains.

There is something happening that i dont understand. I'm beginning to
think there is someting wrong with the django or mod_python
installation but i am at a loss understanding what it can be.

Thomas


On 11 Aug, 19:04, Mike Ramirez  wrote:
> On Tuesday 11 August 2009 09:43:38 am consiglieri wrote:
>
>
>
>
>
> > Hi
>
> > I'm new with django and have made a small test app which works as it
> > should with the development server.
>
> > However when i try and deploy it with apache and mod_python I cant get
> > it to work. I have tested that mod_python works. I can do the
> > recommended mod_python test. When i try to run the django app via
> > apache it works well as long as the page being displayed does not
> > actually try and access the database. In other words if I enter a url
> > that just pops up an empty page with no django tags in it the page is
> > displayed as it should.
>
> > These are my settings.
>
> > Apache 2.2.11
> > mod_python 3.3.2-dev
> > I am on a Mac (Leopard 10.5.8)
> > I have the latest stable version of django 1.1
>
> > When I start apache the following can be found in the logs
>
> > Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.7l DAV/2 mod_python/
> > 3.3.2-dev-20080819 Python/2.5.1 configured -- resuming normal
> > operations
>
> > The necessary settings in httpd.conf with regards to django is as
> > follows
>
> > Alias test.django.com "/Users/someone/djangoproject/appname"
>
> > SetHandler python-program
> > PythonHandler django.core.handlers.modpython
> > SetEnv DJANGO_SETTINGS_MODULE appname.settings
> > PythonDebug On
> > PythonPath "['/Users/someone/djangoproject/'] + sys.path"
>
> > When i run a url that invokes a function which tries to access the
> > database (sqlite3 in this case) i receive the following error
>
> You have to make sure the database file is also readable and writeable by the
> user apache is running as.  The leading path should also be readable to the
> apache user.  755 settings on the directories in the tree.  
>
> Some ways of fixing this are making a group; say djangodevs and add both your
> user and the apache user to that group and setting the sqlite file to be
> rwxrwx---.
>
> You could run apache as your user by changing the User/Group setting in your
> httpd.conf/apache2.conf (see sample below) or a variation of this with the
> above suggestion.
>
> # User/Group: The name (or #number) of the user/group to run httpd as.      
> #  . On SCO (ODT 3) use "User nouser" and "Group nogroup".                  
> #  . On HPUX you may not be able to use shared memory as nobody, and the    
> #    suggested workaround is to create a user www and use that user.        
> #  NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)        
> #  when the value of (unsigned)Group is above 6;                        
> #  don't use Group #-1 on these systems!                                    
> #                                                                          
> User youruser                                                              
> Group youruser
>
> I would personally recommend that you store your project files outside of your
> home directory, I believe/assume /Users/someone/ is your home directory. I
> would use something like /srv/djangoproject and configure the settings so
> both your user and the apache user can read write to the files through the
> group settings.
>
> With a database like mysql/postgres that you connect to over a network you
> wouldn't need to worry about this since they have their own login.  
>
> Mike
>
>
>
>
>
> > TemplateSyntaxError at /appname/clients/
> > Caught an exception while rendering: no such table:
> > addressbook_contacts
>
> > Original Traceback (most recent call last):
> >   File "/Library/Python/2.5/site-packages/django/template/debug.py",
> > line 71, in render_node
> >     result = node.render(context)
> >   File "/Library/Python/2.5/site-packages/django/template/
> > defaulttags.py", line 126, in render
> >     len_values = len(values)
> >   File "/Library/Python/2.5/site-packages/django/db/models/query.py",
> > line 81, in __len__
> >     self._result_cache = list(self.iterator())
> >   File "/Library/Python/2.5/site-packages/django/db/models/query.py",
> > line 238, in iterator
> >     for row in self.query.results_iter():
> >   File "/Library/Python/2.5/site-packages/django/db/models/sql/
> > query.py", line 287, in results_iter
> >     for rows in self.execute_sql(MULTI):
> >   File "/Library/Python/2.5/site-packages/django/db/models/sql/
> > query.py", line 2369, in execute_sql
> >     cursor.execute(sql, params)
> >   File "/Library/Python/2.5/site-packages/django/db/backends/util.py",
> > line 19, in execute
> >     return 

Post matching query does not exist.

2009-08-11 Thread When ideas fail

Hi, I have a strange error which i hope someone might be able to help
me with. Two of my urls seems to be conflicting somehow. i have these
two URLs:

(r'^blog/(?P.+)/$', 'mysite.blog.views.title_view'),
(r'^blog/category/(?P.+)/$',
'mysite.blog.views.category_view'),



which relate to two views which summarised are like this:

def title_view(request, category):
blog_post = Post.objects.get(post_slug=slug)
...
return render_to_response('blogSite/index.html', locals(),
context_instance=RequestContext(request))


def category_view(request, category):
blog_posts = Post.objects.filter
(post_tags__tag_name='category').order_by("-post_date")
...
return render_to_response('blogSite/index.html', locals(),
context_instance=RequestContext(request))



Title view works fine but if i go on mysite.com/blog/category/General
I get the following error:

File "C:\ProgLangs\Python25\lib\site-packages\django\core\handlers
\base.py" in get_response
  86. response = callback(request, *callback_args,
**calhttp://localhost:8080/akonline/blog/category/Andrew/lback_kwargs)
File "C:/Program Files/Apache2.2\mysite\blog\views.py" in title_view
  100. blog_post = Post.objects.get(post_slug=slug)
File "C:\ProgLangs\Python25\lib\site-packages\django\db\models
\manager.py" in get
  93. return self.get_query_set().get(*args, **kwargs)
File "C:\ProgLangs\Python25\lib\site-packages\django\db\models
\query.py" in get
  309. % self.model._meta.object_name)

Exception Type: DoesNotExist at /blog/category/Andrew/
Exception Value: Post matching query does not exist.

The error mentions File "C:/Program Files/Apache2.2\mysite\blog
\views.py" in title_view
  100. blog_post = Post.objects.get(post_slug=slug) but this
line is in the first view which works.

Category isn't going to match post)slug and it shouldn't so they seem
to be conflicting somehow.
I'd appreciate any help or even suggestion.

Thank you

Andrew



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



Re: paginator for 0.96?

2009-08-11 Thread Mike Ramirez
On Tuesday 11 August 2009 10:45:53 am Bobby Roberts wrote:
> anyone have ideas on this?

Django Snippets has a couple

http://www.djangosnippets.org/snippets/394/ 

and

http://www.djangosnippets.org/snippets/219/



these import modules from this file:

http://code.djangoproject.com/svn/django/branches/0.96-bugfixes/django/core/paginator.py


Mike




-- 
I went to my first computer conference at the New York Hilton about 20
years ago.  When somebody there predicted the market for microprocessors
would eventually be in the millions, someone else said, "Where are they
all going to go? It's not like you need a computer in every doorknob!"

Years later, I went back to the same hotel.  I noticed the room keys had
been replaced by electronic cards you slide into slots in the doors.

There was a computer in every doorknob.
-- Danny Hillis


signature.asc
Description: This is a digitally signed message part.


Re: paginator for 0.96?

2009-08-11 Thread Bobby Roberts

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



Re: Date/time field styling?

2009-08-11 Thread mhulse

Hi!

> Look at the SplitDateTimeWidget in django.forms.widgets.

I am sorry to be a complete noob here, but I am not sure how I can use
SplitDateTimeWidget to break-up the two dat/time fields?

I am actually using django-schedule:



Looks like the author is already using SplitDateTimeWidget:



The docs:



Not much info there... Do I need to create my own widget for this?

All I want is to have separate control over the two input fields. :)

Again, sorry if noob question. I am new to Django and Python.

Thanks!
Micky


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



Re: Deploying django on apache - cant access database

2009-08-11 Thread Mike Ramirez
On Tuesday 11 August 2009 09:43:38 am consiglieri wrote:
> Hi
>
> I'm new with django and have made a small test app which works as it
> should with the development server.
>
> However when i try and deploy it with apache and mod_python I cant get
> it to work. I have tested that mod_python works. I can do the
> recommended mod_python test. When i try to run the django app via
> apache it works well as long as the page being displayed does not
> actually try and access the database. In other words if I enter a url
> that just pops up an empty page with no django tags in it the page is
> displayed as it should.
>
> These are my settings.
>
> Apache 2.2.11
> mod_python 3.3.2-dev
> I am on a Mac (Leopard 10.5.8)
> I have the latest stable version of django 1.1
>
> When I start apache the following can be found in the logs
>
> Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.7l DAV/2 mod_python/
> 3.3.2-dev-20080819 Python/2.5.1 configured -- resuming normal
> operations
>
> The necessary settings in httpd.conf with regards to django is as
> follows
>
> Alias test.django.com "/Users/someone/djangoproject/appname"
>
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE appname.settings
> PythonDebug On
> PythonPath "['/Users/someone/djangoproject/'] + sys.path"
>
> When i run a url that invokes a function which tries to access the
> database (sqlite3 in this case) i receive the following error
>

You have to make sure the database file is also readable and writeable by the 
user apache is running as.  The leading path should also be readable to the 
apache user.  755 settings on the directories in the tree.  

Some ways of fixing this are making a group; say djangodevs and add both your 
user and the apache user to that group and setting the sqlite file to be 
rwxrwx---.

You could run apache as your user by changing the User/Group setting in your 
httpd.conf/apache2.conf (see sample below) or a variation of this with the 
above suggestion.

# User/Group: The name (or #number) of the user/group to run httpd as.  
#  . On SCO (ODT 3) use "User nouser" and "Group nogroup".  
#  . On HPUX you may not be able to use shared memory as nobody, and the
#suggested workaround is to create a user www and use that user.
#  NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
#  when the value of (unsigned)Group is above 6;
#  don't use Group #-1 on these systems!
#   
User youruser  
Group youruser

I would personally recommend that you store your project files outside of your 
home directory, I believe/assume /Users/someone/ is your home directory. I 
would use something like /srv/djangoproject and configure the settings so 
both your user and the apache user can read write to the files through the 
group settings.

With a database like mysql/postgres that you connect to over a network you 
wouldn't need to worry about this since they have their own login.  

Mike



> TemplateSyntaxError at /appname/clients/
> Caught an exception while rendering: no such table:
> addressbook_contacts
>
> Original Traceback (most recent call last):
>   File "/Library/Python/2.5/site-packages/django/template/debug.py",
> line 71, in render_node
> result = node.render(context)
>   File "/Library/Python/2.5/site-packages/django/template/
> defaulttags.py", line 126, in render
> len_values = len(values)
>   File "/Library/Python/2.5/site-packages/django/db/models/query.py",
> line 81, in __len__
> self._result_cache = list(self.iterator())
>   File "/Library/Python/2.5/site-packages/django/db/models/query.py",
> line 238, in iterator
> for row in self.query.results_iter():
>   File "/Library/Python/2.5/site-packages/django/db/models/sql/
> query.py", line 287, in results_iter
> for rows in self.execute_sql(MULTI):
>   File "/Library/Python/2.5/site-packages/django/db/models/sql/
> query.py", line 2369, in execute_sql
> cursor.execute(sql, params)
>   File "/Library/Python/2.5/site-packages/django/db/backends/util.py",
> line 19, in execute
> return self.cursor.execute(sql, params)
>   File "/Library/Python/2.5/site-packages/django/db/backends/sqlite3/
> base.py", line 193, in execute
> return Database.Cursor.execute(self, query, params)
> OperationalError: no such table: addressbook_contacts
>
> Now i know for a fact that the database does contain a table called
> contacts. I have no problems whatsoever accessing this using the
> development server.
>
> As far as I can tell django seems unable to access the database when
> going through apache and mod_python.
> I have googled and I have searched to no avail. If anyone can give me
> a helping hand I would appreciate it very much.
>
> Thanks.
> 

Re: Apache mod_wsgi Django setup - Forbidden You don't have permission to access /mysite on this server.

2009-08-11 Thread Gustavo Henrique

Do you using a windows ou linux?
if it's linux, try:

create a dir: /home/user/django and put your project inside it and
create a file called mysite.wsgi in same dir containing:

import os, sys
sys.path.append('/usr/lib/python2.6/site-packages/django/')
sys.path.append('/home/user/myproject')
os.environ['DJANGO_SETTINGS_MODULE']='myproject.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()


and modofy the apache configuration (I'm using ubuntu):

# vim /etc/apache2/sites-enabled/000-default

WSGIRestrictStdout Off

LimitInternalRecursion 1000
ServerAdmin webmas...@localhost
ServerName localhost
DocumentRoot /home/user/django/
ErrorLog /home/user/django/apache.log
LogLevel warn
AddHandler wsgi-script .wsgi

AllowOverride FileInfo
Options ExecCGI MultiViews FollowSymLinks
MultiviewsMatch Handlers
Order deny,allow
Allow from all

Alias /media/ "/home/user/django/myproject/media/"

Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
allow from all







-- 
Gustavo Henrique
http://www.gustavohenrique.net
http://blog.gustavohenrique.net

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



Re: How do I show generic relationship items with my generic inline on Django Admin page?

2009-08-11 Thread chyea

Oops. I don't mean to triple post, here, but I think the original post
might be slightly confusing.

When I say that I'd like to be able to select from existing
RelatedLinks, I don't mean that I'd like to view the existing
relationships between the new Entry model and the RelatedLinks model.
The generic.GenericTabularInline class already does this - it shows
existing relationships and allows you to add a new one.

What I mean is that I'd like to display what I mentioned above, which
is already there, PLUS be able to select from any existing RelatedLink
models, because they might be the "related link" that I want, instead
of having to just add a new one and duplicate the existing one.

Hope this clarifies this a bit.

Ryan

On Aug 10, 10:58 pm, chyea  wrote:
> Hi all,
>
> I've just finished reading through the docs, and following
> ubernostrum's blog post about generic inlines. Generic relationships
> and generic inlines are exactly what I'm looking for. They're working
> as intended, but is it possible for me to view existing related items
> when creating a new entry, which is part of the generic relationship,
> instead of always creating a new one? The blog post I'm referencing is
> here:http://www.b-list.org/weblog/2008/dec/04/generic-inlines/
>
> For example, I've got RelatedLink setup as a generic relationship with
> any other model, per the blog post. I've got an Entry model setup
> using generic inlines to allow me to add new RelatedLinks for this
> Entry. Am I able to somehow view existing RelatedLinks, though, to
> select from as part of this collection of RelatedLinks?
>
> This would be the general purpose for this type of generic
> relationship, I'd think. How can I allow the admin page to show me
> these existing items?
>
> Thanks,
> Ryan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to show the email field in a UserCreationForm?

2009-08-11 Thread Berco Beute

To reply to my own question...I've extended UserCreationForm as
follows:

==
class UserCreationFormExtended(UserCreationForm):

def __init__(self, *args, **kwargs):
super(UserCreationFormExtended, self).__init__(*args,
**kwargs)
self.fields['first_name'].required = True
self.fields['last_name'].required = True

class Meta:
model = User
fields = ('username', 'email', 'first_name', 'last_name')
==

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



Deploying django on apache - cant access database

2009-08-11 Thread consiglieri

Hi

I'm new with django and have made a small test app which works as it
should with the development server.

However when i try and deploy it with apache and mod_python I cant get
it to work. I have tested that mod_python works. I can do the
recommended mod_python test. When i try to run the django app via
apache it works well as long as the page being displayed does not
actually try and access the database. In other words if I enter a url
that just pops up an empty page with no django tags in it the page is
displayed as it should.

These are my settings.

Apache 2.2.11
mod_python 3.3.2-dev
I am on a Mac (Leopard 10.5.8)
I have the latest stable version of django 1.1

When I start apache the following can be found in the logs

Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.7l DAV/2 mod_python/
3.3.2-dev-20080819 Python/2.5.1 configured -- resuming normal
operations

The necessary settings in httpd.conf with regards to django is as
follows

Alias test.django.com "/Users/someone/djangoproject/appname"

SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE appname.settings
PythonDebug On
PythonPath "['/Users/someone/djangoproject/'] + sys.path"

When i run a url that invokes a function which tries to access the
database (sqlite3 in this case) i receive the following error

TemplateSyntaxError at /appname/clients/
Caught an exception while rendering: no such table:
addressbook_contacts

Original Traceback (most recent call last):
  File "/Library/Python/2.5/site-packages/django/template/debug.py",
line 71, in render_node
result = node.render(context)
  File "/Library/Python/2.5/site-packages/django/template/
defaulttags.py", line 126, in render
len_values = len(values)
  File "/Library/Python/2.5/site-packages/django/db/models/query.py",
line 81, in __len__
self._result_cache = list(self.iterator())
  File "/Library/Python/2.5/site-packages/django/db/models/query.py",
line 238, in iterator
for row in self.query.results_iter():
  File "/Library/Python/2.5/site-packages/django/db/models/sql/
query.py", line 287, in results_iter
for rows in self.execute_sql(MULTI):
  File "/Library/Python/2.5/site-packages/django/db/models/sql/
query.py", line 2369, in execute_sql
cursor.execute(sql, params)
  File "/Library/Python/2.5/site-packages/django/db/backends/util.py",
line 19, in execute
return self.cursor.execute(sql, params)
  File "/Library/Python/2.5/site-packages/django/db/backends/sqlite3/
base.py", line 193, in execute
return Database.Cursor.execute(self, query, params)
OperationalError: no such table: addressbook_contacts

Now i know for a fact that the database does contain a table called
contacts. I have no problems whatsoever accessing this using the
development server.

As far as I can tell django seems unable to access the database when
going through apache and mod_python.
I have googled and I have searched to no avail. If anyone can give me
a helping hand I would appreciate it very much.

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



How to show the email field in a UserCreationForm?

2009-08-11 Thread Berco Beute

Hi,

I'm using the UserCreationForm for creating users, but I would like to
show the email, firstname and lastname fields as well (and they should
be required). Much like the view you get when adding a user through
the admin interface. What's the best way to do this? Extend
UserCreationForm? Or create my own forms from scratch?

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



Re: How do I show generic relationship items with my generic inline on Django Admin page?

2009-08-11 Thread chyea

I'm still a little lost, here. I'm not sure how I'd do this.

On Aug 10, 10:58 pm, chyea  wrote:
> Hi all,
>
> I've just finished reading through the docs, and following
> ubernostrum's blog post about generic inlines. Generic relationships
> and generic inlines are exactly what I'm looking for. They're working
> as intended, but is it possible for me to view existing related items
> when creating a new entry, which is part of the generic relationship,
> instead of always creating a new one? The blog post I'm referencing is
> here:http://www.b-list.org/weblog/2008/dec/04/generic-inlines/
>
> For example, I've got RelatedLink setup as a generic relationship with
> any other model, per the blog post. I've got an Entry model setup
> using generic inlines to allow me to add new RelatedLinks for this
> Entry. Am I able to somehow view existing RelatedLinks, though, to
> select from as part of this collection of RelatedLinks?
>
> This would be the general purpose for this type of generic
> relationship, I'd think. How can I allow the admin page to show me
> these existing items?
>
> Thanks,
> Ryan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to get this auto-field id value

2009-08-11 Thread David

Just a little more information. The autoField id is in the model
class.  Model_Form is a form based on this model class.



On Aug 11, 9:20 am, David  wrote:
> Hello,
>
> I am trying to retrieve an autoField id value in my following code
> when I update records.
>
> def update_record(request):
>     if request.POST:
>         form = Model_Form(request.POST)
>         if form.is_valid():
>             form.save(pk=form.id, force_update=True)
>
> I got an error that "Model_Form" object has no attribute 'id'.
>
> Model_Form is a model-based form class that has an autoField id that
> increases one by one. When I update a record, I need to give this
> value.
>
> I even tried "pk=form.pk", however it did not work either.
>
> Any suggestions how to fix this?
>
> Thanks so much.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to get this auto-field id value

2009-08-11 Thread David

Hello,

I am trying to retrieve an autoField id value in my following code
when I update records.

def update_record(request):
if request.POST:
form = Model_Form(request.POST)
if form.is_valid():
form.save(pk=form.id, force_update=True)

I got an error that "Model_Form" object has no attribute 'id'.

Model_Form is a model-based form class that has an autoField id that
increases one by one. When I update a record, I need to give this
value.

I even tried "pk=form.pk", however it did not work either.

Any suggestions how to fix this?

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



dropping django admin change password urls

2009-08-11 Thread David De La Harpe Golden

I'm using a simple ldap authentication backend, and the admin password
change functionality may need to be disabled or mangled to do the right
thing (currently going for disabled, can just redirect to different
password change form), as it  changes the django User model password,
which at best will have no effect.

I can sneakily drop the URLs with something like the following

admin_site_urls_except_password = (
filter(lambda x: getattr(x, 'name', None) not in ('password_change',
'password_change_done'), site.urls[0]),
site.urls[1],
site.urls[2],
)

# urlpatterns ...
(r'^admin/', include(admin_site_urls_except_password)),


... but maybe I've missed some obvious setting or approach I should be
using that might be ...less brittle?

(I then need to clone the relevant admin template to hide the
change_password link - Haven't worked out how to inject an alternative
named url, just merrily setting name='admin:password_change' on a url
doesn't work...)











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



dates with a different format in the db

2009-08-11 Thread Vokial

Hi!
In a db i have, already filled up with data, i have a varchar field
which contains dates formatted like "mmdd". Is there a way to make
Django recognise that field as a proper DateField even if the
formatting is different than the usual "-mm-dd" ?
Because i can't alter the data in that db and i have to order the
entries by date...
...maybe by defining a function that automatically decodes the string
into a datetime python object like strptime?

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



Re: Django, CMS, CSS newbie question

2009-08-11 Thread Juan Hernandez
you can start here

www.djangobook.com

On Tue, Aug 11, 2009 at 10:58 AM, eldonp2  wrote:

> I would like to start my own website. I
> figured, since I don't know much, that I would start with a CSS
> template and work back. How can I use a free template and then
> integrate Django-Cms and Django into it?
>

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



Re: can't get comment moderation working, following docs

2009-08-11 Thread shannon

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



can't get comment moderation working, following docs

2009-08-11 Thread smcoll

i was having trouble enabling comment moderation in my app, so i
decided to make a test app that would follow the docs at
http://docs.djangoproject.com/en/dev/ref/contrib/comments/moderation/
as closely as possible.

Unfortunately, moderation still isn't working for me:

- If i create an Entry with `enable_comments=False` i can post a
comment to it anyway.
- If i set the moderator's allow() method to always be False, i expect
every comment to be in the moderation queue.  None are.

It's as if the Entry model isn't registered with the moderator at all.

http://dpaste.com/78253/

Did i set something up wrong?  Are the docs incorrect/incomplete?  Is
there a bug in the moderation code?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django, CMS, CSS newbie question

2009-08-11 Thread eldonp2

Hi,

I'm new to programming. I would like to start my own website. I
figured, since I don't know much, that I would start with a CSS
template and work back. How can I use a free template and then
integrate Django-Cms and Django into it?

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



Re: Question about request.user

2009-08-11 Thread David

This fixes the problem. Thanks Gustavo!


On Aug 11, 6:07 am, Gustavo Henrique  wrote:
> maybe a problem with cache.
> try this:
>
> from django.views.decorators.cache import never_cache
> @never_cache
> def yourview(request):
>    # your code here
>
> --
> Gustavo Henriquehttp://www.gustavohenrique.nethttp://blog.gustavohenrique.net
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: connectiong querysets

2009-08-11 Thread Luke Seelenbinder

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects

Luke Seelenbinder

luke.seelenbin...@gmail.com
http://www.google.com/profiles/luke.seelenbinder



On Tue, Aug 11, 2009 at 9:38 AM, elminio wrote:
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkqBiQwACgkQXQrGVCncjPyeTwCdF4GGYBU62n/R6Gjw86aRSGUL
1tMAnRvdOjSgTQFD6oL7Hak8EZ9x6GLz
=qiHK
-END PGP SIGNATURE-

>
> Hello,
> Is it possiblo to merge Querystets into one big Queryset?
> >
>

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



Re: How-to use SelectMultiple widget with CommaSeparatedIntegerField ?

2009-08-11 Thread nono

I wrote a clean_csi() method and I call it in each clean_()
method passing the field name and
and it's working now

Here is the code

def clean_csi(self, field):
data = self.cleaned_data[field]
data.sort()
csi_list = []
first_element = True
for element in data:
if not first_element:
csi_list.append(",")
else:
first_element = False
csi_list.append(str(element))
return "".join(csi_list)

def clean_hour(self):
return self.clean_csi('hour')

Thank you for your help !


On 7 août, 03:52, Malcolm Tredinnick  wrote:
> On Thu, 2009-08-06 at 07:35 -0700, nono wrote:
> > I was reading my post and though it was not very clear
>
> > My model uses CommaSeparatedIntegerField to store some integer values.
> > I want my users to use SelectMultiple widget to create/update those
> > integer so I put a ChoiceField with widget=SelectMultiple in my form.
> > My problem is that all I can get from this is a list of values (for
> > example [u'2', u'3']) where I expect comma separated values ("2, 3").
>
> > I hope this is a better explanation and somebody could help me
>
> If you want to normalise the values that are submitted to something
> other than what happens automatically, write a clean_()
> method for that form field. Have a look at
>
> http://docs.djangoproject.com/en/dev/ref/forms/validation/
>
> for details.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Sort by output of arbitrary method

2009-08-11 Thread Javier Guerra

On Tue, Aug 11, 2009 at 2:47 AM, Harish wrote:
> s there any other way of doing this?

read the whole result set and use Python sorting.

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



Re: unique_together with None

2009-08-11 Thread Karen Tracey
On Tue, Aug 11, 2009 at 10:40 AM, Alex Gaynor  wrote:

>
> On Tue, Aug 11, 2009 at 8:25 AM, gentlestone
> wrote:
> >
> > On 11. Aug, 15:01 h., Gustavo Henrique  wrote:
> >> Try also: null=True, blank=True
> >>
> >> --
> >> Gustavo Henriquehttp://www.gustavohenrique.nethttp://
> blog.gustavohenrique.net
> >
> > blank=True ... I have had, but this one doesn't solve the problem,
> > maybe the problem is in postgresql, the associated SQL code for
> > postgresql is
> >
> > CREATE TABLE ...
> > ...
> > UNIQUE ("some_fk_field_id", "some_plain_field"),
> >
> > and this apparently doesn't work
> > >
> >
>
> You are talking about in the forms/admin validation correct?  Thinking
> to how this is implemented there likely is a bug where this doesn't
> use the SQL concept of NULL != NULL and uses the Python None == None
> instead, which of these behaviors is correct I'm not sure of (though I
> lean towards the SQL interpretation).
>

I don't believe there is a bug.  The original description of the problem
confused me because I thought it was trying so specify unique_together for a
field in one model and a field in another model related by a nullable
foreign key, and I didn't think you could do that.  In fact you can't -- all
the fields have to be in the same model/table and I see now that the
original report wasn't saying that.  (The _field in the unique_together spec
is what confused me as I read that as having a double underscore.)

Anyway, form validation allows multiple allows multiple None/NULL values
here since most of the database backends interpret NULL != NULL at the SQL
level to mean that (NULL, v1) != (NULL, v1) when doing multiple field unique
checks.  The one exception I know of is Oracle, it apparently will raise an
IntegrityError for this case.  See the discussion here:

http://code.djangoproject.com/ticket/9039#comment:10

Karen

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



quick django gig $300

2009-08-11 Thread Bobby Roberts

contact me privately for more information.  A friend needs help
wrapping up a project.  I'll provide his email address to interested
parties.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



inspectdb and postgresql schema

2009-08-11 Thread Marek Pietrucha

Hello,

I have a relational database written in PostgreSQL 8.4. I use
different schemas - not default public schema. I tried to inspectdb my
database but the output was clean. It looked like the inspectdb tool
didn't look in my schemas. I thought it was the matter of the pg
driver, so I changed it from postgresql-psycopg2 to postgresql.
Nothing changed. The output was the same.

Is it possible to generate models from my database?

Am i doing something wrong?

Thanks for help :)

best regards,
mark

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



Re: unique_together with None

2009-08-11 Thread Alex Gaynor

On Tue, Aug 11, 2009 at 8:25 AM, gentlestone wrote:
>
> On 11. Aug, 15:01 h., Gustavo Henrique  wrote:
>> Try also: null=True, blank=True
>>
>> --
>> Gustavo Henriquehttp://www.gustavohenrique.nethttp://blog.gustavohenrique.net
>
> blank=True ... I have had, but this one doesn't solve the problem,
> maybe the problem is in postgresql, the associated SQL code for
> postgresql is
>
> CREATE TABLE ...
> ...
> UNIQUE ("some_fk_field_id", "some_plain_field"),
>
> and this apparently doesn't work
> >
>

You are talking about in the forms/admin validation correct?  Thinking
to how this is implemented there likely is a bug where this doesn't
use the SQL concept of NULL != NULL and uses the Python None == None
instead, which of these behaviors is correct I'm not sure of (though I
lean towards the SQL interpretation).

Alex

-- 
"I disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you
want" -- Me

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



Re: IE problems w. admin save

2009-08-11 Thread Jesper Rasmussen

I've just updated my IE from 7 to 8 and the problem is gone ... :o)

Only problem left is that the customers are currently all using
IE7 ... sigh :o(

Cheers,
Jesper




On 11 Aug., 12:59, Jesper Rasmussen  wrote:
> I've made some more experiments, and it does seem to be a (database?)
> timing issue: About once in 10 it shows the right page :o|
>
> My model is quite big ... about 40 entries of mixed types many having
> both blank and null.
>
> If nothing else works ... and good ideas of where to put in some pause
> to "solve" the problem?
>
> Jesper
>
> On 10 Aug., 18:17, Jeff Green  wrote:
>
> > I am having similar problems with IE using formsets and the admin
> > functionality. I tend to believe it is an issue with IE but I haven't been
> > able to determine what the issue is.
>
> > On Mon, Aug 10, 2009 at 10:42 AM,JesperRasmussen wrote:
>
> > > Hi there,
>
> > > I'm developing a simple Django system (Sqlite) -- using Firefox
> > > everything works.
>
> > > When using IE (7) the save button on the admin pages workes strangely:
> > > If there is some error in the entered data it just displays a blank
> > > page, if no errors is made it displays an "Internet Explorer cannot
> > > display the webpage" page ... but on reload it displays the proper
> > > page.
>
> > > Could this be tied to the database not being done updating before the
> > > data is being read?
>
> > > Cheers,
> > >JesperRasmussen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Dumping Large Databases

2009-08-11 Thread Alex Gaynor

On Tue, Aug 11, 2009 at 5:37 AM, Chris Spencer wrote:
>
> I guess I should have prefixed that by saying my goal is to migrate
> from MySQL to PostgreSQL. However, I'm having trouble finding a tool
> to do this, so I thought I'd try Django's backend neutral
> dumpdata/loaddata feature.
>
> Chris
>
> On Mon, Aug 10, 2009 at 9:48 PM, Malcolm
> Tredinnick wrote:
>>
>> On Mon, 2009-08-10 at 17:02 -0700, Chris wrote:
>>> I'm trying to dump a 3GB MySQL database using manage.py dumpdata, but
>>> it's getting killed after 2 hours. Is there any way to get it to use
>>> less memory/cpu so it doesn't get killed and completes the dump?
>>
>> Is there some particular reason you need to use dumpdata for this? At
>> some point, using the database's native tools is going to be a lot more
>> efficient and robust. Dumpdata is great for the sweet spot, but it isn't
>> designed to completely replace all existing database tools.
>>
>> Regards,
>> Malcolm
>>
>>
>>
>> >
>>
>
> >
>

Unless the majority of your data is from 1 table I'd try dumping each
application seperately into a few fixture files and loading them up
individually.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you
want" -- Me

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



Concurrent Web Access and Edits

2009-08-11 Thread Doug Blank

New Django user here with a question about the client side: Is there
built-in support for dealing with concurrent edits? I'm not referring
to the database issues (locking, etc) but is there Django support for
handling a request to access or edit data for which another user is
editing?

I'm thinking about simple timestamps, detection of changed data, and
showing the user options to abort, overwrite, or re-edit.

Does one have to implement this for saving data? Anything I should
read that covers this or related topic? I couldn't find anything on
the Django site, nor in this forum.

Thanks for any pointers!

-Doug

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



Apache mod_wsgi Django setup - Forbidden You don't have permission to access /mysite on this server.

2009-08-11 Thread justin jools

Ive been the install instructions in : 
http://wiki.thinkhole.org/howto:django_on_windows%E2%80%8F
(with mod_wsgi)

install python 26, Apache 2.2, modwsgi ap2.2 py26

and apache loads modwsgi fine.

when I check localhost: apache says - It works!
when I check 127.0.0.1:8000: Django says - It worked!

but when i try to open the Django directory mysite: localhost/mysite i
get :

Forbidden

You don't have permission to access /mysite on this server.

I have re-installed and installed this many times but still the same
thing. The tutorial says should get: It worked

httpd.conf
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias / /usr/local/mysite/django.ws

runs fine, as in: http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

could someone please help with this...

thanks

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



Re: Extending Django-cms Menu

2009-08-11 Thread Alessandro Ronchi
2009/8/11 Alessandro Ronchi 

> I have a django-cms app with this menu:


I've partially solved my problem.
but it doesn't get get_title from the model.

It's very strange, because I've followed the documentation example on
http://github.com/digi604/django-cms-2.0/blob/18d184375fdf2e94a5c5a26bbe57a2b980a6addd/cms/docs/navigation.md



-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com

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



session management problem

2009-08-11 Thread Oguz Yarimtepe


Hi all,

In my application i have a login screen. The view is simple as below:

loginform=None
formvalid=True

if request.method == "POST":
   
username = request.POST['username']
password = request.POST['password']
loginform=LoginForm(request.POST)

formvalid=loginform.is_valid()

if formvalid:

user = authenticate(username=username, password=password)
if user is not None:
if user.is_active:
login(request, user)
return render_to_response("menu.html", 
{"somekey":somevalue})

...


menu.html has some menus. One of them had the address of "localhost/add" which 
is defined in urls.py also. The view for add, is also add. But at my add 
function it seems i lost my session. 
if not request.user.is_authenticated():
return HttpResponse("nok")
else:
return HttpResponse("ok")

So i am gettig alwasy nok on the screen. How can i keep accesing session values 
from not posted sites? 

-- 
Oguz Yarimtepe 

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



Extending Django-cms Menu

2009-08-11 Thread Alessandro Ronchi
I have a django-cms app with this menu:
- Apples
 -> Red Apples
 -> Green Apples
- Oranges
  -> Big oranges
- Lemons
  - New Lemon types

I must add another link (a blog category) to Apples and Oranges first level
menu, to achieve this result:

- Apples
 -> Red Apples
 -> Green Apples
 -> Blog (apples)
- Oranges
  -> Big oranges
  -> Blog (Oranges)
- Lemons
  - New Lemon types

I've tried to extend the category of my blog putting this code:
http://dpaste.com/78219/

this utils:
http://dpaste.com/78220/

and added this setting:

CMS_NAVIGATION_EXTENDERS = (('blog.utils.get_nodes', gettext('Blog')),)

But it doesn't work.

Any ideas?

Any other working example?

Is there a django-cms dedicated mailing list?


-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com

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



connectiong querysets

2009-08-11 Thread elminio

Hello,
Is it possiblo to merge Querystets into one big Queryset?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: unique_together with None

2009-08-11 Thread gentlestone

On 11. Aug, 15:01 h., Gustavo Henrique  wrote:
> Try also: null=True, blank=True
>
> --
> Gustavo Henriquehttp://www.gustavohenrique.nethttp://blog.gustavohenrique.net

blank=True ... I have had, but this one doesn't solve the problem,
maybe the problem is in postgresql, the associated SQL code for
postgresql is

CREATE TABLE ...
...
UNIQUE ("some_fk_field_id", "some_plain_field"),

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



Re: django 0.96.4 does not has django.utils._os

2009-08-11 Thread Russell Keith-Magee

On Tue, Aug 11, 2009 at 8:37 PM, dongua wrote:
>
> /django/core/servers/basehttp.py
> code:
> from django.utils._os import safe_join
>
> but there does not has any _os.py in pacakge, and after install 0.96.4
> will can't runserver

It appears that the security fix that was committed in r11354 was
missing a file. I have committed the missing file in r11430.

As a temporary workaround, you can download the missing file
(django/utils/_os.py) from the Django source code browser [1]. If you
drop this file into the django/utils directory wherever you have
installed Django, you will be able to run the development server
again.

A new release that includes this missing file will be made in the near
future (time permitting, within a few days).

I deeply apologize for any inconvenience this has caused.

[1] 
http://code.djangoproject.com/browser/django/branches/0.96-bugfixes/django/utils/_os.py

Yours,
Russ Magee %-)

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



Re: Question about request.user

2009-08-11 Thread Gustavo Henrique

maybe a problem with cache.
try this:

from django.views.decorators.cache import never_cache
@never_cache
def yourview(request):
   # your code here




-- 
Gustavo Henrique
http://www.gustavohenrique.net
http://blog.gustavohenrique.net

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



Re: unique_together with None

2009-08-11 Thread Gustavo Henrique

Try also: null=True, blank=True


-- 
Gustavo Henrique
http://www.gustavohenrique.net
http://blog.gustavohenrique.net

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



Re: Django for smaller sites

2009-08-11 Thread Gustavo Henrique

Django is the best option for websites. It's very good for e-commerce,
cms, ERP, CRM, etc.
IMHO, the bests frameworks are:

1. Django
2. Rails
3. CakePHP
4. Code Igniter

PS.: I tried all php frameworks, but python frameworks only django.
See about web2py too.


-- 
Gustavo Henrique
http://www.gustavohenrique.net
http://blog.gustavohenrique.net

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



Re: django 0.96.4 does not has django.utils._os

2009-08-11 Thread Karen Tracey
On Tue, Aug 11, 2009 at 8:37 AM, dongua  wrote:

>
> /django/core/servers/basehttp.py
> code:
> from django.utils._os import safe_join
>
> but there does not has any _os.py in pacakge, and after install 0.96.4
> will can't runserver
>

Ugh, indeed this is broken.  Fix is being looked into.

Karen

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



Re: Default value for fields

2009-08-11 Thread AG

Thank you very much for all the responses.
I found the source of the problem in my code.

I was adding a property to Model
Model.revision = property(fget=XXX, fset=YYY)
which conflicted with the revision field I was having trouble with.
Sorry for the confusion.

Best,

AG


On Aug 10, 2:22 pm, Karen Tracey  wrote:
> On Mon, Aug 10, 2009 at 2:13 PM, ankit rai  wrote:
> > check ur db table ,is null=true present.And in ur model write
> > revision = models.IntegerField(default=0,balnk=true,null=true)
> > and if u donont want to change the value from 0 at all then there is no
> > need to diplay it in fields
>
> null=True should not be present.  AG doesn't want null values allows but
> rather wants them to be set to a default value.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django 0.96.4 does not has django.utils._os

2009-08-11 Thread dongua

/django/core/servers/basehttp.py
code:
from django.utils._os import safe_join

but there does not has any _os.py in pacakge, and after install 0.96.4
will can't runserver

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



Re: Dynamic/complex forms

2009-08-11 Thread Ludwik Trammer

Hi,

I haven't tried it myself, but look at django-ajax-validation
(http://github.com/alex/django-ajax-validation).

Ludwik

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



Django for smaller sites

2009-08-11 Thread moesian

Hi,

I'm looking at using django for building my sites. I want to be able
to build sites of varying size but the likelyhood is i'll be creating
a number smaller low traffic sites. I was wondering if django is
suitable for smaller sites ( simple cms, contact forms etc ) or would
it be overkill ?

Would I be able to host as many sites on a 256 slice from slicehosts
using django as I would if the equivilent sites were built using
something else (php codeigniter for example) ?

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



Re: looping over forms in a formset

2009-08-11 Thread bnl

Thanks.

Before I suggest anything concrete for the docs, let's see if my
understanding  is now right:

The problem from my point of view was that I didn't think I had any
hidden fields. Hence I didn't loop over them, and didn't think of
them  - yes, despite the massive hint in the error message ... :-(

I think the hidden field in question was in fact the id of the
instance (which exists for the previously saved objects) and was zero
for a "blank" form in the formset ... and I think this only shows up
as an issue when looping over forms in a formset, because the formset
machinery has set up, modified, and uses this hidden field - and I
didn't know it was there.

(Or is it always there for anything generated by a ModelForm, and I've
never spotted it because I always get my id from my url?)

(Is this really an edge case? It seems like something one would want
to do for nearly any interesting formset ... lay it out nicely ...)

Cheers
Bryan

On Aug 11, 9:45 am, Malcolm Tredinnick 
wrote:
> On Tue, 2009-08-11 at 01:12 -0700,bnlwrote:
>
> [...]
>
> > Apologies that I'm not asking my questions in the way you'd like,
> > but believe me, I am cutting it down a lot ... and I appreciate that
> > it's still not obvious where the errors are (I would have found
> > them otherwise). In this case, I had cut it down to just field, and
> > it
> > exhibited the problem ... I shouldn't have included the extra line
> > which was just to show why I wanted to do it ...
>
> Trimming a problem report to the minimum required and no further is part
> science and part black art, so there are going to be times when you just
> get unlucky. In this case, however, the problem is you aren't including
> details so that I or anybody else can actually reproduce the problem. So
> you end up in a position where you have to hope the particular error
> message triggers a "we've seen that before" thought in somebody's head.
>
> A good problem report or request for help contains enough information to
> repeat the problem. Which means, in this case, the form class containing
> the field.
>
>
>
> > It would seem that the advice to loop over hidden fields in the
> > template could be promoted to the documentation.
>
> Well, we already document, in the main formset documentation, including
> the management form if you're doing manual template layout
> (http://docs.djangoproject.com/en/dev/topics/forms/formsets/#using-a-f...) 
> and we document including hidden fields if you're doing iteration over form 
> fields, in the main forms documentation, 
> (http://docs.djangoproject.com/en/dev/topics/forms/#looping-over-hidde...) so 
> this isn't undocumented territory.
>
> However, if you feel there's a clearer way to do this without giving it
> undue prominence -- bearing in mind it's an edge case, so shouldn't
> obscure the more regular usage cases or weigh those sections down with
> heavy details -- then please do create a patch and attach it to a
> ticket. Many of our documentation improvements are generated by people
> trying to make something clearer.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



unique_together with None

2009-08-11 Thread gentlestone

if I have

unique_together = ('some_fk_field', 'some_plain_field')

and

some_fk = ...(null = True)

the system allows put more intsances with some_fk_field=None and the
same some_plain_field value

I think, this is a bug. Or how can I manage to allow just one instance
with null fk and the same other field value?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: IE problems w. admin save

2009-08-11 Thread Jesper Rasmussen

I've made some more experiments, and it does seem to be a (database?)
timing issue: About once in 10 it shows the right page :o|

My model is quite big ... about 40 entries of mixed types many having
both blank and null.

If nothing else works ... and good ideas of where to put in some pause
to "solve" the problem?

Jesper



On 10 Aug., 18:17, Jeff Green  wrote:
> I am having similar problems with IE using formsets and the admin
> functionality. I tend to believe it is an issue with IE but I haven't been
> able to determine what the issue is.
>
> On Mon, Aug 10, 2009 at 10:42 AM, Jesper Rasmussen wrote:
>
>
>
> > Hi there,
>
> > I'm developing a simple Django system (Sqlite) -- using Firefox
> > everything works.
>
> > When using IE (7) the save button on the admin pages workes strangely:
> > If there is some error in the entered data it just displays a blank
> > page, if no errors is made it displays an "Internet Explorer cannot
> > display the webpage" page ... but on reload it displays the proper
> > page.
>
> > Could this be tied to the database not being done updating before the
> > data is being read?
>
> > Cheers,
> > Jesper Rasmussen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Standalone script with django's ORM and multiprocessing

2009-08-11 Thread Spajderix

prabhu S pisze:
> Solution appears like a hack to me. Why do you close the connection in
> every process? Can you not just close once in parent? Execute commits
> alone in each process.
>   
I've checked that. Unfortunately, in my case, it won't work. I have a 
loop looking like this:

for job in joblist:
p = Process(target=self.run_job)
p.start()

When i close connection before this loop i get errors like at the 
beggining. When i close connection just before creating a new process i 
get: 'lost connection while performing a query' (or something like that 
:)). Finally when i close connection just right after this loop it 
starts to behave weirdly. One time it works fine, but next time i launch 
it i get mysql has gone away errors. I suppose this happens because 
sometimes subprocesses fire up queries after parent finishes this loop, 
but sometimes they're faster and still use parent's connection.

Closing connections in subprocesses might look a bit hacky. I could try 
to somehow reinitialize db connection, but simply closing it, and 
leaving the rest to django is a lot easier :)

Thank you for your replies. I appreciate it.

Regards
Spajderix

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



Re: Django: Add SET DATESTYLE

2009-08-11 Thread Bdfy



class ModelForm(forms.Form):
test_date = forms.DateField(required=False)

,,,

INSERT INTO SQL:

 obj.test_date = test_date

All OK for default format ( 2009-12-31 ). But for InputFormat
"30.12.2009" - error. How to change InputFormat for all forms in
application ?



On 10 авг, 20:08, Karen Tracey  wrote:
> On Mon, Aug 10, 2009 at 12:00 PM, Bdfy  wrote:
>
> > How to add a phrase "SET DATESTYLE =" bla-bla-bla "" for everyone SQL
> > query ?
>
> Why do you think you want to do that?  The Django ORM takes the date(time)
> values coming from the database and converts them do Python date(time)
> objects.  You can then control how they are formatted for output using
> Python date formatting mechanisms.  If you are using forms, the widgets for
> date and time allow you to specify the format for output.  Similarly for
> input, you have control over what formats are accepted.  The format that is
> used for communication between the database and the Django ORM should not
> matter to your code at all.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Dumping Large Databases

2009-08-11 Thread Chris Spencer

I guess I should have prefixed that by saying my goal is to migrate
from MySQL to PostgreSQL. However, I'm having trouble finding a tool
to do this, so I thought I'd try Django's backend neutral
dumpdata/loaddata feature.

Chris

On Mon, Aug 10, 2009 at 9:48 PM, Malcolm
Tredinnick wrote:
>
> On Mon, 2009-08-10 at 17:02 -0700, Chris wrote:
>> I'm trying to dump a 3GB MySQL database using manage.py dumpdata, but
>> it's getting killed after 2 hours. Is there any way to get it to use
>> less memory/cpu so it doesn't get killed and completes the dump?
>
> Is there some particular reason you need to use dumpdata for this? At
> some point, using the database's native tools is going to be a lot more
> efficient and robust. Dumpdata is great for the sweet spot, but it isn't
> designed to completely replace all existing database tools.
>
> Regards,
> Malcolm
>
>
>
> >
>

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



Re: Standalone script with django's ORM and multiprocessing

2009-08-11 Thread Malcolm Tredinnick

On Tue, 2009-08-11 at 03:12 -0700, prabhu S wrote:
[...]
> Why do you close the connection in
> every process? Can you not just close once in parent?

That would also work.

Regards,
Malcolm



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



  1   2   >