Re: Collapsible fields

2009-11-09 Thread Lars Stavholm

Daniel Roseman wrote:
> On Nov 9, 8:47 am, Lars Stavholm <st...@telcotec.se> wrote:
>> Hi All,
>>
>> I'm looking to implement collapsible fields in a django powered
>> page, so far with no luck.
>>
>> Any hints on the best way of doing it?
>>
>> In the mean time, I checked out how it's done in the admin interface,
>> and came up with a simple test page as follows:
>>
>> 
>>   
>> >   href="http://localhost:8000/media/css/forms.css; />
>> > src="<a  rel="nofollow" href="http://localhost:8000/media/js/core.js&quot">http://localhost:8000/media/js/core.js&quot</a>;>
>> 
>> >  src="<a  rel="nofollow" href="http://localhost:8000/media/js/admin/CollapsedFieldsets.js&quot">http://localhost:8000/media/js/admin/CollapsedFieldsets.js&quot</a>;>
>> 
>>   
>>   
>> 
>>   Job Details
>>   
>> 
>>   Jdate:
>>   >  class="vTextField" maxlength="30"
>>  type="text" id="id_jdate" />
>> 
>>   
>> 
>>   
>> 
>>
>> But for some reason, it does not work. The collapsed
>> field shows up (I guess) by ways of the Job Details
>> showing up, but nothing else.
>>
>> Any hints?
>>
>> I admit, I'm a newbie at these things, but still.
>>
>> Any advice appreciated.
>>
>> R
>> /Lars
> 
> None of the admin scripts will work without the 'jsi18n' script, which
> is actually accessed via an admin view. Include this line before the
> other scripts:
> http://localhost:8000/admin/</a>
> jsi18n/">
> and it should work.
> 
> Firebug is great for debugging this sort of thing - it would have told
> you 'gettext is not defined' which would have helped track down the
> problem.

Great advice, thank you.Just started using firebug and of course
encountered the gettext error. I put the script link in there as
you suggested, and it's all working very nicely now.

Many thanks
/Lars


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



Collapsible fields

2009-11-09 Thread Lars Stavholm

Hi All,

I'm looking to implement collapsible fields in a django powered
page, so far with no luck.

Any hints on the best way of doing it?

In the mean time, I checked out how it's done in the admin interface,
and came up with a simple test page as follows:


  
http://localhost:8000/media/css/forms.css; />
http://localhost:8000/media/js/core.js";>

http://localhost:8000/media/js/admin/CollapsedFieldsets.js";>

  
  

  Job Details
  

  Jdate:
  

  

  


But for some reason, it does not work. The collapsed
field shows up (I guess) by ways of the Job Details
showing up, but nothing else.

Any hints?

I admit, I'm a newbie at these things, but still.

Any advice appreciated.

R
/Lars


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



django + mod_python + apache2 config problem

2009-10-19 Thread Lars Stavholm

Bit of an annoying problem with apache2 + mod_python configuration.

I've got my django site setup and working. When adding a 
directive in the apache config which then includes authentication,
the SetHandler None directive doesn't seem to work, i.e. I get a
"Page not found" error in my django site, rather than the broswer
login popup that I was expecting.

The django site is running (fine) as a virtual host, and within the
virtual host I've defined...


  SetHandler mod_python
  PythonInterpreter main_interpreter
  PythonHandler trac.web.modpython_frontend
  PythonOption TracEnv /var/trac/bfact
  PythonOption TracParentEnv /var/trac
  PythonOption TracUriRoot /trac
  PythonOption PYTHON_EGG_CACHE /var/tmp


...which works fine, whereas...


  SetHandler None
  AuthType Digest
  AuthName "MBF Trac"
  AuthDigestProvider file
  AuthUserFile /var/trac/.users
  Require valid-user


...send me back to the django application with a "Page not found" error.

Any ideas?



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Flatpage on first page of a website

2009-10-16 Thread Lars Stavholm

Alessandro Ronchi wrote:
> I need to put a flatpage on /
> and make www.example.com
> return the flatpage.
> 
> Is it possible? What url must I put in flatpage admin?

No flatpages in admin as far as I know.

At the frontend (your web site www.example.com) however:

1. Create a flatpage for with URL /
2. Add django.contrib.flatpages.middleware.FlatpageFallbackMiddleware
   to MIDDLEWARE_CLASSES in settings.py
3. Add django.contrib.flatpages to INSTALLED_APPS.

That should do it.

/L


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



Re: Very bad experience in Django...

2009-06-26 Thread Lars Stavholm

Chris Withers wrote:
> steveneo wrote:
>> I try to use Django in a new project. Honestly, it is very bad
>> experience. It looks not boosting my development speed. Today, I
>> almost give up and begin to look up another Python framework
> 
> Go for it :-)

+1
/L

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



django-navbar

2009-06-18 Thread Lars Stavholm

Has anyone been able to use django-navbar successfully
in latest Django 1.1 (from trunk)?

Any ideas on how to use it appreciated.

Or maybe there's a better navigation bar plugin?

/Lars Stavholm


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

2009-06-12 Thread Lars Stavholm

Lars Stavholm wrote:
> Hi All,
> 
> got a problem that's slowly driving me crazy:
> 
> http://mbf takes me to my apache+mod_python+django application.
> 
> However, if I click a link, e.g. http://mbf/jobs, I get the
> following exception:
> 
> TypeError at jobs/
> 'NoneType' object is not iterable
> Request Method: GET
> Request URL: http://mbfjobs/
> [snip]
> 
> Notice the Request URL, there's a slash missing,
> something along the way removed the slash.
> 
> If I try http://mbf//jobs, I end up at the right place.
> 
> Can anyone tell me what it is that is removing that slash?

Found the culprit in httpd.conf: PythonOption django.root /

Commenting out that line solved the problem. We're using
a VirtualHost definition, so it seems django.root should
not be set for a VirtualHost.
/L


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



Weird URL problem

2009-06-12 Thread Lars Stavholm

Hi All,

got a problem that's slowly driving me crazy:

http://mbf takes me to my apache+mod_python+django application.

However, if I click a link, e.g. http://mbf/jobs, I get the
following exception:

TypeError at jobs/
'NoneType' object is not iterable
Request Method: GET
Request URL: http://mbfjobs/
[snip]

Notice the Request URL, there's a slash missing,
something along the way removed the slash.

If I try http://mbf//jobs, I end up at the right place.

Can anyone tell me what it is that is removing that slash?

Any input appreciated
/Lars Stavholm


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

2009-05-02 Thread Lars Stavholm

mamco wrote:
> Hi,
> In attempting to get a better grasp of Django, I'm attempting a fairly
> simple timecard app.  Multiple users of a small chain of retail
> stores, where occasionally the employees jump between stores(company),
> and between projects and activities.
> 
> The interesting model is something like this:
> 
> class Timecard(models.Model):
>  employee = models.ForeignKey(Employee)
>  company = models.ForeignKey(Company)
>  project = models.ForeignKey(Project)
>  activity = models.ForeignKey(Activity)
>  start = models.DateTimeField('The start time of the shift')
>  duration = models.DecimalField('The duration of the shift in
> hours',max_digits=4, decimal_places=2)
>  notes = models.TextField('Special Notes on the shift')
> 
> I've populated it with some data from a previous system (trying to
> reproduce with Django), and I'm now trying to display a form which, 
> shows a week at a time given a particular start date (which for now is
> always a Sunday).
> 
> I'm trying to show
> employee, company, project  on a single line followed by the totals
> (summing the activity as its always 'default' for now) for Sun to Sat
> and a total.
> 
> So something like the following (pipes show columns for this post
> purpose only):
> J Smith | BranchA | Admin | 0.0 | 4.5 | 8.0 | 8.0 | 8.0 | 8.0 | 0.0 |
> 36.5
> J Smith | BranchA | Training | 0.0 | 3.5 | 8.0 | 8.0 | 8.0 | 8.0 | 0.0
> | 36.5
> 
> Being new to Python and Django, I can't seem to get a function written
> to kick this output out.  Any pointers?

I'm new to both python and django as well, but how about writing
a presentation method and mention that method in the list_display
of the admin interface, something like...

class Timecard(models.Model):
employee...
...
notes...

def get_week_result(self):
# make a result string like '0.0 4.5 8.0 8.0 ...etc.
# The 'start' field contains the weekday.
# or maybe one method for each day of the week.
return result

class TimecardAdmin(admin.ModelAdmin):
...
list_display = ('employee', ..., 'get_week_result')
...

However, the model you defined is slightly askew from your
presentation, if you want to look at a week at a time,
maybe you'd be better of defining the model/record as
being a week. Simply make things easier on yourself.

Just my 2c
/Lars Stavholm


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



graph tools

2009-04-23 Thread Lars Stavholm

Hi All,

looking to produce graphs within a django application,
preferably within the admin site.

django-graphs might be a contender, but it seems to be
not fully completed yet. Anyone using it?

Other django graph app's?

Any advice appreciated
/Lars Stavholm

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

2009-04-17 Thread Lars Stavholm

patrickk wrote:
> # stable release:
> an "official release" won´t be there until reordering of edit-inlines
> is possible.
> we are using grappelli for most of our clients - so I´m considering
> the trunk "stable". with stable I mean that for all _our_ usecases it
> works fine. bookmarks & navigation is pretty new, so there could be
> issues here.

Sounds good to me.

> # django-1.1
> yes. pretty soon ...

Right so.

> # mailing-list
> kind of. I´m not reading this list on a regular basis. I´m thinking of
> having an own grappelli google-group in the near future. until that,
> use either this list or the google-code issue tracker.

Good enough for me.

I'm happy you were reading this list when helping me out.

Thanks!
/Lars

> On Apr 17, 8:18 am, Lars Stavholm <st...@telcotec.se> wrote:
>> patrickk wrote:
>>> I´m working with the request-context-processor. I´ll change that for
>>> the user (because the auth-processor is required for the admin
>>> anyway). nevertheless, without the request-processor, bookmarks
>>> probably doesn´t work.
>>> simple fix:
>>> just add "django.core.context_processors.request", to your template
>>> context processors.
>> Ah, thanks Patrick, I have it up and running and this is more
>> or less exactly what I've been looking for for my intranet
>> application. I have a feeling that grappelli will save me a
>> bundle of time and the look and feel is brilliant as well.
>> I still have a lot to try, but the first impression is great.
>>
>> However, as I'm looking ahead at deadlines, I need to ask:
>>
>> o do you know if there's going to be a stable release at some
>>   point, or am I looking at a moving target?
>>
>> o will django-1.1 be supported at some point in time?
>>
>> o is this mailing list the proper place for this conversation?
>>
>> Thanks!
>> /L
>>
>>> however, I´ll take another look at that in order to simplify.
>>> thanks,
>>> patrick
>>> On 16 Apr., 21:44, Lars Stavholm <st...@telcotec.se> wrote:
>>>> patrickk wrote:
>>>>> it´s really easy to debug here:
>>>>> line 60 of index.html is {% get_navigation request.user %}.
>>>>> check the templatetag (navigation.py) and see if the user is there and
>>>>> if the navigation is loaded (e.g. using "print object_list" when the
>>>>> dev-server is started). if there are problems, use the shell (python
>>>>> manage.py shell) to do some testing.
>>>>> shouldn´t be hard to find the "error" ...
>>>> Well, error or not, I've managed to get the Bookmarks and
>>>> Navigation to show nicely. However, this happened only after
>>>> replacing request.user with user in {% get_navigation request.user %}
>>>> on line 60 in index.html (and then the same kind of hoopla in
>>>> base.html with didn't work out for request.path). Then I remembered
>>>> that django forced me to add the django.core.context_processors.auth
>>>> to the TEMPLATE_CONTEXT_PROCESSORS in my settings.py. This apparently
>>>> makes "request.user" useless, but allows you to use "user" instead.
>>>> However, I get the feeling that there's something fishy going on here,
>>>> since you don't seem to use the django context processor for auth.
>>>> How do you get away with that? Or maybe there's a mismatch of versions
>>>> here. I use django-1.0.2 and I was led to believe that django-grappelli
>>>> was developed towards the latest release of django, i.e. 1.0.2.
>>>> /L
>>>>> On 16 Apr., 18:44, Lars Stavholm <st...@telcotec.se> wrote:
>>>>>> So that all went well. Now all I need now is the bookmarks
>>>>>> and the sidebar navigation box. They're not visible as of
>>>>>> right now and I'm not sure what to do about it. The recommended
>>>>>> fixtures are loaded.
>>>>>> Any ideas anyone?
>>>>>> /L
>>>>>> Lars Stavholm wrote:
>>>>>>> patrickk wrote:
>>>>>>>> line 53 of base.html is {% get_help request.path %}.
>>>>>>>> I´m not exactly sure what´s happening here and I´m not able to
>>>>>>>> reproduce this error.
>>>>>>>> you might wanna try to debug ... request.user seems to work (because
>>>>>>>> that´s a couple of lines before), so request.path should also work.
>>

Re: django-grappelli setup problem

2009-04-17 Thread Lars Stavholm

patrickk wrote:
> I´m working with the request-context-processor. I´ll change that for
> the user (because the auth-processor is required for the admin
> anyway). nevertheless, without the request-processor, bookmarks
> probably doesn´t work.
> 
> simple fix:
> just add "django.core.context_processors.request", to your template
> context processors.

Ah, thanks Patrick, I have it up and running and this is more
or less exactly what I've been looking for for my intranet
application. I have a feeling that grappelli will save me a
bundle of time and the look and feel is brilliant as well.
I still have a lot to try, but the first impression is great.

However, as I'm looking ahead at deadlines, I need to ask:

o do you know if there's going to be a stable release at some
  point, or am I looking at a moving target?

o will django-1.1 be supported at some point in time?

o is this mailing list the proper place for this conversation?

Thanks!
/L

> however, I´ll take another look at that in order to simplify.
> 
> thanks,
> patrick
> 
> 
> On 16 Apr., 21:44, Lars Stavholm <st...@telcotec.se> wrote:
>> patrickk wrote:
>>> it´s really easy to debug here:
>>> line 60 of index.html is {% get_navigation request.user %}.
>>> check the templatetag (navigation.py) and see if the user is there and
>>> if the navigation is loaded (e.g. using "print object_list" when the
>>> dev-server is started). if there are problems, use the shell (python
>>> manage.py shell) to do some testing.
>>> shouldn´t be hard to find the "error" ...
>> Well, error or not, I've managed to get the Bookmarks and
>> Navigation to show nicely. However, this happened only after
>> replacing request.user with user in {% get_navigation request.user %}
>> on line 60 in index.html (and then the same kind of hoopla in
>> base.html with didn't work out for request.path). Then I remembered
>> that django forced me to add the django.core.context_processors.auth
>> to the TEMPLATE_CONTEXT_PROCESSORS in my settings.py. This apparently
>> makes "request.user" useless, but allows you to use "user" instead.
>>
>> However, I get the feeling that there's something fishy going on here,
>> since you don't seem to use the django context processor for auth.
>> How do you get away with that? Or maybe there's a mismatch of versions
>> here. I use django-1.0.2 and I was led to believe that django-grappelli
>> was developed towards the latest release of django, i.e. 1.0.2.
>> /L
>>
>>> On 16 Apr., 18:44, Lars Stavholm <st...@telcotec.se> wrote:
>>>> So that all went well. Now all I need now is the bookmarks
>>>> and the sidebar navigation box. They're not visible as of
>>>> right now and I'm not sure what to do about it. The recommended
>>>> fixtures are loaded.
>>>> Any ideas anyone?
>>>> /L
>>>> Lars Stavholm wrote:
>>>>> patrickk wrote:
>>>>>> line 53 of base.html is {% get_help request.path %}.
>>>>>> I´m not exactly sure what´s happening here and I´m not able to
>>>>>> reproduce this error.
>>>>>> you might wanna try to debug ... request.user seems to work (because
>>>>>> that´s a couple of lines before), so request.path should also work.
>>>>>> but I´ve never tested this locally, so I´m not sure if that can cause
>>>>>> the error (we´re having test/development-servers to do this).
>>>>>> if you dig a little depper and you think you´ve found a bug - then
>>>>>> please report it using the google-code issue tracker.
>>>>> No bug (as far as I can see), just newbie-ness. Turns out that
>>>>> there's some sort of conflict with other apps, namely the batchadmin
>>>>> app, possibly more (I removed them all). In addition, being a newbie,
>>>>> I neglected to tell you that I'm running the development server. I
>>>>> followed the instructions by Chris Scott, and after a bit of fiddling,
>>>>> presto, I can see the light:)
>>>>> It looks brilliant!
>>>>> /L
>>>>>> On 15 Apr., 20:14, Lars Stavholm <st...@telcotec.se> wrote:
>>>>>>> patrickk wrote:
>>>>>>>> in order to use the admin, just use /admin/ (grappelli doesn´t change
>>>>>>>> the admin-urls).
>>>>>>> Thanks, but that got me in to some other problem:
>>>>>>> TemplateSyntaxError at /admin/
>>>>>>> Caught an exc

Re: django-grappelli setup problem

2009-04-16 Thread Lars Stavholm

patrickk wrote:
> it´s really easy to debug here:
> line 60 of index.html is {% get_navigation request.user %}.
> check the templatetag (navigation.py) and see if the user is there and
> if the navigation is loaded (e.g. using "print object_list" when the
> dev-server is started). if there are problems, use the shell (python
> manage.py shell) to do some testing.
> 
> shouldn´t be hard to find the "error" ...


Well, error or not, I've managed to get the Bookmarks and
Navigation to show nicely. However, this happened only after
replacing request.user with user in {% get_navigation request.user %}
on line 60 in index.html (and then the same kind of hoopla in
base.html with didn't work out for request.path). Then I remembered
that django forced me to add the django.core.context_processors.auth
to the TEMPLATE_CONTEXT_PROCESSORS in my settings.py. This apparently
makes "request.user" useless, but allows you to use "user" instead.

However, I get the feeling that there's something fishy going on here,
since you don't seem to use the django context processor for auth.
How do you get away with that? Or maybe there's a mismatch of versions
here. I use django-1.0.2 and I was led to believe that django-grappelli
was developed towards the latest release of django, i.e. 1.0.2.
/L

> On 16 Apr., 18:44, Lars Stavholm <st...@telcotec.se> wrote:
>> So that all went well. Now all I need now is the bookmarks
>> and the sidebar navigation box. They're not visible as of
>> right now and I'm not sure what to do about it. The recommended
>> fixtures are loaded.
>>
>> Any ideas anyone?
>> /L
>>
>> Lars Stavholm wrote:
>>> patrickk wrote:
>>>> line 53 of base.html is {% get_help request.path %}.
>>>> I´m not exactly sure what´s happening here and I´m not able to
>>>> reproduce this error.
>>>> you might wanna try to debug ... request.user seems to work (because
>>>> that´s a couple of lines before), so request.path should also work.
>>>> but I´ve never tested this locally, so I´m not sure if that can cause
>>>> the error (we´re having test/development-servers to do this).
>>>> if you dig a little depper and you think you´ve found a bug - then
>>>> please report it using the google-code issue tracker.
>>> No bug (as far as I can see), just newbie-ness. Turns out that
>>> there's some sort of conflict with other apps, namely the batchadmin
>>> app, possibly more (I removed them all). In addition, being a newbie,
>>> I neglected to tell you that I'm running the development server. I
>>> followed the instructions by Chris Scott, and after a bit of fiddling,
>>> presto, I can see the light:)
>>> It looks brilliant!
>>> /L
>>>> On 15 Apr., 20:14, Lars Stavholm <st...@telcotec.se> wrote:
>>>>> patrickk wrote:
>>>>>> in order to use the admin, just use /admin/ (grappelli doesn´t change
>>>>>> the admin-urls).
>>>>> Thanks, but that got me in to some other problem:
>>>>> TemplateSyntaxError at /admin/
>>>>> Caught an exception while rendering: Failed lookup for key [request] in
>>>>> u"[{'root_path': u'/admin/', 'app_list': [{'app_url': 'asset/',
>>>>> [snip]
>>>>> Request Method: GET
>>>>> Request URL:http://localhost:8000/admin/
>>>>> Exception Type: TemplateSyntaxError
>>>>> Exception Value:
>>>>> Caught an exception while rendering: Failed lookup for key [request] in
>>>>> [snip]
>>>>> Exception Location:
>>>>> /usr/lib/python2.6/site-packages/django/template/debug.py in
>>>>> render_node, line 81
>>>>> Python Executable:  /usr/bin/python
>>>>> Python Version: 2.6.0
>>>>> Python Path:['/home/stava/proj/bfact',
>>>>> '/home/stava/lib/Trac-0.11.1-py2.5.egg', '/home/stava/lib',
>>>>> '/home/stava/proj', '/usr/lib/python26.zip', '/usr/lib/python2.6',
>>>>> '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk',
>>>>> '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload',
>>>>> '/usr/lib/python2.6/site-packages',
>>>>> '/usr/lib/python2.6/site-packages/Numeric',
>>>>> '/usr/lib/python2.6/site-packages/PIL',
>>>>> '/usr/local/lib/python2.6/site-packages',
>>>>> '/usr/lib/python2.6/site-packages/gtk-2.0',
>>>>> '/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode']
>>>>> S

Re: django-grappelli setup problem

2009-04-16 Thread Lars Stavholm

So that all went well. Now all I need now is the bookmarks
and the sidebar navigation box. They're not visible as of
right now and I'm not sure what to do about it. The recommended
fixtures are loaded.

Any ideas anyone?
/L


Lars Stavholm wrote:
> patrickk wrote:
>> line 53 of base.html is {% get_help request.path %}.
>>
>> I´m not exactly sure what´s happening here and I´m not able to
>> reproduce this error.
>> you might wanna try to debug ... request.user seems to work (because
>> that´s a couple of lines before), so request.path should also work.
>>
>> but I´ve never tested this locally, so I´m not sure if that can cause
>> the error (we´re having test/development-servers to do this).
>>
>> if you dig a little depper and you think you´ve found a bug - then
>> please report it using the google-code issue tracker.
> 
> No bug (as far as I can see), just newbie-ness. Turns out that
> there's some sort of conflict with other apps, namely the batchadmin
> app, possibly more (I removed them all). In addition, being a newbie,
> I neglected to tell you that I'm running the development server. I
> followed the instructions by Chris Scott, and after a bit of fiddling,
> presto, I can see the light:)
> 
> It looks brilliant!
> 
> /L
> 
>> On 15 Apr., 20:14, Lars Stavholm <st...@telcotec.se> wrote:
>>> patrickk wrote:
>>>> in order to use the admin, just use /admin/ (grappelli doesn´t change
>>>> the admin-urls).
>>> Thanks, but that got me in to some other problem:
>>>
>>> TemplateSyntaxError at /admin/
>>> Caught an exception while rendering: Failed lookup for key [request] in
>>> u"[{'root_path': u'/admin/', 'app_list': [{'app_url': 'asset/',
>>>
>>> [snip]
>>>
>>> Request Method: GET
>>> Request URL:http://localhost:8000/admin/
>>> Exception Type: TemplateSyntaxError
>>> Exception Value:
>>>
>>> Caught an exception while rendering: Failed lookup for key [request] in
>>>
>>> [snip]
>>>
>>> Exception Location:
>>> /usr/lib/python2.6/site-packages/django/template/debug.py in
>>> render_node, line 81
>>> Python Executable:  /usr/bin/python
>>> Python Version: 2.6.0
>>> Python Path:['/home/stava/proj/bfact',
>>> '/home/stava/lib/Trac-0.11.1-py2.5.egg', '/home/stava/lib',
>>> '/home/stava/proj', '/usr/lib/python26.zip', '/usr/lib/python2.6',
>>> '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk',
>>> '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload',
>>> '/usr/lib/python2.6/site-packages',
>>> '/usr/lib/python2.6/site-packages/Numeric',
>>> '/usr/lib/python2.6/site-packages/PIL',
>>> '/usr/local/lib/python2.6/site-packages',
>>> '/usr/lib/python2.6/site-packages/gtk-2.0',
>>> '/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode']
>>> Server time:    Wed, 15 Apr 2009 20:07:53 +0200
>>> Template error
>>>
>>> In template /home/stava/proj/bfact/templates/admin/base.html, error at
>>> line 53
>>>
>>> My ursl.py looks like this:
>>>
>>> from django.conf.urls.defaults import *
>>> from django.contrib import admin
>>> admin.autodiscover()
>>>
>>> urlpatterns = patterns('',
>>>   (r'^grappelli/', include('grappelli.urls')),
>>>   (r'^admin/(.*)', admin.site.root),
>>> )
>>>
>>> /L
>>>
>>>> On 15 Apr., 10:06, Lars Stavholm <st...@telcotec.se> wrote:
>>>>> patrickk wrote:
>>>>>> which URL causes that error?
>>>>> http://localhost:8000/grappelli/admin/
>>>>>> please note that in order to use grappelli you have to setup the admin-
>>>>>> site before, 
>>>>>> seehttp://docs.djangoproject.com/en/dev/ref/contrib/admin/#ref-contrib-a
>>>>>> maybe this should be mentioned in the docs, but I guess it´s pretty
>>>>>> obvious.
>>>>> I guess it is, admin up and running nicely without grappelli.
>>>>> /L
>>>>>> On Apr 14, 8:36 pm, Lars Stavholm <st...@telcotec.se> wrote:
>>>>>>> Hi All,
>>>>>>> I'm trying to get django-grappelli running, but after following
>>>>>>> the installation instructions, I end up with a 404 and the following:
>>>>>>> Using the URLconf defined in bfact.urls, Django tried these URL
>>>>>>> patterns, in this orde

Re: django-grappelli setup problem

2009-04-15 Thread Lars Stavholm

patrickk wrote:
> line 53 of base.html is {% get_help request.path %}.
> 
> I´m not exactly sure what´s happening here and I´m not able to
> reproduce this error.
> you might wanna try to debug ... request.user seems to work (because
> that´s a couple of lines before), so request.path should also work.
> 
> but I´ve never tested this locally, so I´m not sure if that can cause
> the error (we´re having test/development-servers to do this).
> 
> if you dig a little depper and you think you´ve found a bug - then
> please report it using the google-code issue tracker.

No bug (as far as I can see), just newbie-ness. Turns out that
there's some sort of conflict with other apps, namely the batchadmin
app, possibly more (I removed them all). In addition, being a newbie,
I neglected to tell you that I'm running the development server. I
followed the instructions by Chris Scott, and after a bit of fiddling,
presto, I can see the light:)

It looks brilliant!

/L

> On 15 Apr., 20:14, Lars Stavholm <st...@telcotec.se> wrote:
>> patrickk wrote:
>>> in order to use the admin, just use /admin/ (grappelli doesn´t change
>>> the admin-urls).
>> Thanks, but that got me in to some other problem:
>>
>> TemplateSyntaxError at /admin/
>> Caught an exception while rendering: Failed lookup for key [request] in
>> u"[{'root_path': u'/admin/', 'app_list': [{'app_url': 'asset/',
>>
>> [snip]
>>
>> Request Method: GET
>> Request URL:http://localhost:8000/admin/
>> Exception Type: TemplateSyntaxError
>> Exception Value:
>>
>> Caught an exception while rendering: Failed lookup for key [request] in
>>
>> [snip]
>>
>> Exception Location:
>> /usr/lib/python2.6/site-packages/django/template/debug.py in
>> render_node, line 81
>> Python Executable:  /usr/bin/python
>> Python Version: 2.6.0
>> Python Path:['/home/stava/proj/bfact',
>> '/home/stava/lib/Trac-0.11.1-py2.5.egg', '/home/stava/lib',
>> '/home/stava/proj', '/usr/lib/python26.zip', '/usr/lib/python2.6',
>> '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk',
>> '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload',
>> '/usr/lib/python2.6/site-packages',
>> '/usr/lib/python2.6/site-packages/Numeric',
>> '/usr/lib/python2.6/site-packages/PIL',
>> '/usr/local/lib/python2.6/site-packages',
>> '/usr/lib/python2.6/site-packages/gtk-2.0',
>> '/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode']
>> Server time:Wed, 15 Apr 2009 20:07:53 +0200
>> Template error
>>
>> In template /home/stava/proj/bfact/templates/admin/base.html, error at
>> line 53
>>
>> My ursl.py looks like this:
>>
>> from django.conf.urls.defaults import *
>> from django.contrib import admin
>> admin.autodiscover()
>>
>> urlpatterns = patterns('',
>>   (r'^grappelli/', include('grappelli.urls')),
>>   (r'^admin/(.*)', admin.site.root),
>> )
>>
>> /L
>>
>>> On 15 Apr., 10:06, Lars Stavholm <st...@telcotec.se> wrote:
>>>> patrickk wrote:
>>>>> which URL causes that error?
>>>> http://localhost:8000/grappelli/admin/
>>>>> please note that in order to use grappelli you have to setup the admin-
>>>>> site before, 
>>>>> seehttp://docs.djangoproject.com/en/dev/ref/contrib/admin/#ref-contrib-a
>>>>> maybe this should be mentioned in the docs, but I guess it´s pretty
>>>>> obvious.
>>>> I guess it is, admin up and running nicely without grappelli.
>>>> /L
>>>>> On Apr 14, 8:36 pm, Lars Stavholm <st...@telcotec.se> wrote:
>>>>>> Hi All,
>>>>>> I'm trying to get django-grappelli running, but after following
>>>>>> the installation instructions, I end up with a 404 and the following:
>>>>>> Using the URLconf defined in bfact.urls, Django tried these URL
>>>>>> patterns, in this order:
>>>>>>1. ^admin/(.*)
>>>>>>2. ^grappelli/ ^bookmark/add/$
>>>>>>3. ^grappelli/ ^bookmark/remove/$
>>>>>>4. ^grappelli/ ^help/(?P\d+)/$
>>>>>>5. ^grappelli/ ^help
>>>>>>6. ^grappelli/ ^obj_lookup/$
>>>>>>7. ^grappelli/ ^related_lookup/$
>>>>>>8. ^grappelli/ ^m2m_lookup/$
>>>>>>9. ^accounts/login/$
>>>>>>   10. ^accounts/logout/$
>>>>>> Notice the space after "grappelli/".
>>>>>> Anyone else out there using django-grappelli?
>>>>>> Any ideas as to what causes this?
>>>>>> I'm using django-1.0.2 on Linux with latest grappelli from trunk.
>>>>>> Any ideas appreciated
>>>>>> /Lars
>>
> > 
> 


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



Re: django-grappelli setup problem

2009-04-15 Thread Lars Stavholm

patrickk wrote:
> in order to use the admin, just use /admin/ (grappelli doesn´t change
> the admin-urls).

Thanks, but that got me in to some other problem:

TemplateSyntaxError at /admin/
Caught an exception while rendering: Failed lookup for key [request] in
u"[{'root_path': u'/admin/', 'app_list': [{'app_url': 'asset/',

[snip]

Request Method: GET
Request URL:http://localhost:8000/admin/
Exception Type: TemplateSyntaxError
Exception Value:

Caught an exception while rendering: Failed lookup for key [request] in

[snip]

Exception Location:
/usr/lib/python2.6/site-packages/django/template/debug.py in
render_node, line 81
Python Executable:  /usr/bin/python
Python Version: 2.6.0
Python Path:['/home/stava/proj/bfact',
'/home/stava/lib/Trac-0.11.1-py2.5.egg', '/home/stava/lib',
'/home/stava/proj', '/usr/lib/python26.zip', '/usr/lib/python2.6',
'/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk',
'/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload',
'/usr/lib/python2.6/site-packages',
'/usr/lib/python2.6/site-packages/Numeric',
'/usr/lib/python2.6/site-packages/PIL',
'/usr/local/lib/python2.6/site-packages',
'/usr/lib/python2.6/site-packages/gtk-2.0',
'/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode']
Server time:Wed, 15 Apr 2009 20:07:53 +0200
Template error

In template /home/stava/proj/bfact/templates/admin/base.html, error at
line 53

My ursl.py looks like this:

from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
  (r'^grappelli/', include('grappelli.urls')),
  (r'^admin/(.*)', admin.site.root),
)

/L

> On 15 Apr., 10:06, Lars Stavholm <st...@telcotec.se> wrote:
>> patrickk wrote:
>>> which URL causes that error?
>> http://localhost:8000/grappelli/admin/
>>
>>> please note that in order to use grappelli you have to setup the admin-
>>> site before, 
>>> seehttp://docs.djangoproject.com/en/dev/ref/contrib/admin/#ref-contrib-a
>>> maybe this should be mentioned in the docs, but I guess it´s pretty
>>> obvious.
>> I guess it is, admin up and running nicely without grappelli.
>>
>> /L
>>
>>> On Apr 14, 8:36 pm, Lars Stavholm <st...@telcotec.se> wrote:
>>>> Hi All,
>>>> I'm trying to get django-grappelli running, but after following
>>>> the installation instructions, I end up with a 404 and the following:
>>>> Using the URLconf defined in bfact.urls, Django tried these URL
>>>> patterns, in this order:
>>>>1. ^admin/(.*)
>>>>2. ^grappelli/ ^bookmark/add/$
>>>>3. ^grappelli/ ^bookmark/remove/$
>>>>4. ^grappelli/ ^help/(?P\d+)/$
>>>>5. ^grappelli/ ^help
>>>>6. ^grappelli/ ^obj_lookup/$
>>>>7. ^grappelli/ ^related_lookup/$
>>>>8. ^grappelli/ ^m2m_lookup/$
>>>>9. ^accounts/login/$
>>>>   10. ^accounts/logout/$
>>>> Notice the space after "grappelli/".
>>>> Anyone else out there using django-grappelli?
>>>> Any ideas as to what causes this?
>>>> I'm using django-1.0.2 on Linux with latest grappelli from trunk.
>>>> Any ideas appreciated
>>>> /Lars
>>
> > 
> 


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



Re: django-grappelli setup problem

2009-04-15 Thread Lars Stavholm

patrickk wrote:
> which URL causes that error?

http://localhost:8000/grappelli/admin/

> please note that in order to use grappelli you have to setup the admin-
> site before, see 
> http://docs.djangoproject.com/en/dev/ref/contrib/admin/#ref-contrib-admin.
> maybe this should be mentioned in the docs, but I guess it´s pretty
> obvious.

I guess it is, admin up and running nicely without grappelli.

/L

> On Apr 14, 8:36 pm, Lars Stavholm <st...@telcotec.se> wrote:
>> Hi All,
>>
>> I'm trying to get django-grappelli running, but after following
>> the installation instructions, I end up with a 404 and the following:
>>
>> Using the URLconf defined in bfact.urls, Django tried these URL
>> patterns, in this order:
>>
>>1. ^admin/(.*)
>>2. ^grappelli/ ^bookmark/add/$
>>3. ^grappelli/ ^bookmark/remove/$
>>4. ^grappelli/ ^help/(?P\d+)/$
>>5. ^grappelli/ ^help
>>6. ^grappelli/ ^obj_lookup/$
>>7. ^grappelli/ ^related_lookup/$
>>8. ^grappelli/ ^m2m_lookup/$
>>9. ^accounts/login/$
>>   10. ^accounts/logout/$
>>
>> Notice the space after "grappelli/".
>>
>> Anyone else out there using django-grappelli?
>> Any ideas as to what causes this?
>>
>> I'm using django-1.0.2 on Linux with latest grappelli from trunk.
>>
>> Any ideas appreciated
>> /Lars
> > 
> 



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



django-grappelli setup problem

2009-04-14 Thread Lars Stavholm

Hi All,

I'm trying to get django-grappelli running, but after following
the installation instructions, I end up with a 404 and the following:

Using the URLconf defined in bfact.urls, Django tried these URL
patterns, in this order:

   1. ^admin/(.*)
   2. ^grappelli/ ^bookmark/add/$
   3. ^grappelli/ ^bookmark/remove/$
   4. ^grappelli/ ^help/(?P\d+)/$
   5. ^grappelli/ ^help
   6. ^grappelli/ ^obj_lookup/$
   7. ^grappelli/ ^related_lookup/$
   8. ^grappelli/ ^m2m_lookup/$
   9. ^accounts/login/$
  10. ^accounts/logout/$

Notice the space after "grappelli/".

Anyone else out there using django-grappelli?
Any ideas as to what causes this?

I'm using django-1.0.2 on Linux with latest grappelli from trunk.

Any ideas appreciated
/Lars

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



Re: db API where ...or...

2008-12-15 Thread Lars Stavholm

Thanks Tim, works like a charm.
/L

Tim Chase wrote:
>> when combining Django ORM criteria you get
>> the "...WHERE...AND..." clauses.
>>
>> How do I get the "...WHERE...OR..." clauses?
>>
>> Resorting to raw SQL?
> 
> 
> Use Q objects and OR them together:
> 
> http://www.djangoproject.com/documentation/models/or_lookups/
> 
> 
> Foo.objects.filter(
>Q(field1='baz') |
>Q(field1='bar') |
>Q(field2='spatula')
>)
> 
> 
> They should be groupable as well, so you can use
> 
>filter(
>  (Q(field1='foo') & Q(field2='bar'))
>  | Q(field1='baz')
>  )
> 
> -tim
> 
> 
> 
> 
> > 
> 



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



Re: Django Forms Date Format

2008-12-15 Thread Lars Stavholm

Aldo wrote:
> Yes I have tried that but still nothing - thats what lead me to
> looking at this!

Try with "USE_I18N = False" in settings.py.
Some sort of known issue, I do believe there's
a ticket somewhere confirming this.
/L

> On Dec 15, 3:28 pm, Lars Stavholm <st...@telcotec.se> wrote:
>> Aldo wrote:
>>> I am using django forms. I have created a model/form with 2 fields,
>>> name and date.
>>> Prior to saving the form i check if the form is_valid?
>>> if form.is_valid():
>>> form.save()
>>> My problem is it wants the date in the format - MM/DD/
>>> Otherwise it will not see the form as valid - and not save.
>>> How can i change this I want the date in the format DD/MM/
>> Maybe setting DATE_FORMAT in settings.py could help.
>>
>> http://docs.djangoproject.com/en/dev/ref/settings/?from=olddocs#date-...
>>
>> /Lars
> > 
> 



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



db API where ...or...

2008-12-15 Thread Lars Stavholm

Hi all,

when combining Django ORM criteria you get
the "...WHERE...AND..." clauses.

How do I get the "...WHERE...OR..." clauses?

Resorting to raw SQL?

Kinda' lost, any input appreciated
/Lars


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



Re: Django Forms Date Format

2008-12-15 Thread Lars Stavholm

Aldo wrote:
> I am using django forms. I have created a model/form with 2 fields,
> name and date.
> 
> Prior to saving the form i check if the form is_valid?
> 
> if form.is_valid():
> form.save()
> 
> My problem is it wants the date in the format - MM/DD/
> Otherwise it will not see the form as valid - and not save.
> 
> How can i change this I want the date in the format DD/MM/

Maybe setting DATE_FORMAT in settings.py could help.

http://docs.djangoproject.com/en/dev/ref/settings/?from=olddocs#date-format

/Lars


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



Re: Overriding admin templates

2008-11-27 Thread Lars Stavholm

bfrederi wrote:
> It turns out I am having the same issue. I just added on batchadmin
> and I can't seem to override templates across the entire project (I
> wanted to add some JQuery to filters.html). How did you solve your
> problem?

Apologies, I don't clearly remember, but I just checked my settings.py,
and batchadmin is last in the list of installed app's, and now it works.
/L

> On Nov 3, 5:02 am, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>> Lars Stavholm wrote:
>>> Karen Tracey wrote:
>>>> On Sat, Nov 1, 2008 at 5:54 PM, Lars Stavholm <[EMAIL PROTECTED]
>>>> <mailto:[EMAIL PROTECTED]>> wrote:
>>>> Low Kian Seong wrote:
>>>> >http://www.djangobook.com/en/1.0/chapter17/
>>>> Yes, thank you, that's it.
>>>> It worked nicely for the change_form.html example given in that
>>>> chapter. However, for the change_list.html it still doesn't work.
>>>> Seems to me I've hit a django bug. Anyone else?
>>>> I just tried this, and it works for me for change_list.html. So I'm not
>>>> sure what is going on in your case.  For me it just works, overriding
>>>> change_list on a per-model basis using a file:
>>>> templates/admin///change_list.html
>>> Hm, I'm using django from svn trunk revision 9208.
>>> What version are you using?
>>> /L
>> As it turns out, it was a conflict with an addon, the batchadmin addon,
>> that caused the confusion. Django truly works as advertised. My setup
>> of batchadmin however, needs more tweaking.
>>
>> Thanks for all your help.
>> /Lars
>>
>>>> > On Sat, Nov 1, 2008 at 6:20 PM, Lars Stavholm <[EMAIL PROTECTED]
>>>> <mailto:[EMAIL PROTECTED]>> wrote:
>>>> >> Low Kian Seong wrote:
>>>> >>> You are supposed to put the admin template you want to override in
>>>> >>> your own template directory definition in settings.py
>>>> >>> So, if you defined it as /home/stava/>>> >>> name>/template/admin/change_list.html
>>>> >> Huh?
>>>> >> /L
>>>> >>> On Sat, Nov 1, 2008 at 5:32 PM, Lars Stavholm <[EMAIL PROTECTED]
>>>> <mailto:[EMAIL PROTECTED]>> wrote:
>>>> >>>> I'd like to override part of an admin change_list template.
>>>> >>>> Reading the documentation, my understanding is that I can place
>>>> >>>> a template in a certain place in the templates directory 
>>>> hierarchy,
>>>> >>>> and django will look for it and use it, i.e.:
>>>> >>>> templates/admin/build/job/change_list.html
>>>> >>>> ...where "build" is my application and "job" is my model class.
>>>> >>>> The change_list.html file only contains the part I want to
>>>> override,
>>>> >>>> i.e. the extrahead block. It contains:
>>>> >>>> {% extends "admin/change_list.html" %}
>>>> >>>> {% block extrahead %}
>>>> >>>>   
>>>> >>>> {% endblock %}
>>>> >>>> However, this does not work for me, so I'm expecting it to be some
>>>> >>>> mistake on my part, I just can't figure out what the mistake is.
>>>> >>>> Now, if I put the file in ./templates/admin/build/change_list.html
>>>> >>>> it still wont work. On the other hand, this would be overriding 
>>>> all
>>>> >>>> "build" application change lists, which is not what I was
>>>> looking for.
>>>> >>>> Only way I've found is to copy the change_list.html from the 
>>>> django
>>>> >>>> installation in contrib/admin/templates/admin, and then modify
>>>> it to
>>>> >>>> my needs, using "if" statements to figure out which application
>>>> model
>>>> >>>> class is being rendered, and the put the change_list.html in my
>>>> app's
>>>> >>>> templates/admin directory, which doesn't feel right.
>>>> >>>> Any input appreciated
>>>> >>>> /Lars Stavholm
> > 
> 


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



Re: mark_safe() not working for me

2008-11-25 Thread Lars Stavholm

Right you are Daniel, works like a charm, thank you!
/L

Daniel Roseman wrote:
> On Nov 25, 4:50 pm, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>> I'm trying to influence one of the admin interface change list
>> fields by using the below get_progress() method in list_display,
>> and using mark_safe().
>>
>> However, I can't get this to work:
>>
>> class Job(models.Model):
>>  progress = models.PositiveSmallIntegerField()
>>
>>  def get_progress(self):
>>  snippet = u"Progress is %d" % self.progress
>>  return mark_safe(snippet)
>>
>> What happens is that the "" and "" gets translated into
>> "p" and "/p" in the output. I thought mark_safe()
>> would help me to avoid that. Obviously not right.
>>
>> Is there another way to tell django not to escape the output?
>>
>> Any ideas appreciated
>> /Lars
> 
> To get HTML into the change_list view, you need to use allow_tags:
> 
>  def get_progress(self):
>  snippet = u"Progress is %d" % self.progress
>  return mark_safe(snippet)
> get_progress.allow_tags=True
> 
> --
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



mark_safe() not working for me

2008-11-25 Thread Lars Stavholm

I'm trying to influence one of the admin interface change list
fields by using the below get_progress() method in list_display,
and using mark_safe().

However, I can't get this to work:

class Job(models.Model):
 progress = models.PositiveSmallIntegerField()

 def get_progress(self):
 snippet = u"Progress is %d" % self.progress
 return mark_safe(snippet)

What happens is that the "" and "" gets translated into
"p" and "/p" in the output. I thought mark_safe()
would help me to avoid that. Obviously not right.

Is there another way to tell django not to escape the output?

Any ideas appreciated
/Lars


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



Progress bar widget

2008-11-24 Thread Lars Stavholm

Hi all,

apologies for the newbie question, but...

does anyone now if there's any progress bar widget available
for a model to be displayed in the admin change list?

I'm looking for something that can display for example a
PositiveSmallIntegerField (0-100) as a progress bar (or
something visually similar) in the admin change list.
The progress bar needs no Ajax, the change list gets
refreshed every now and then (it visualizes a queue).

Failing that, is a custom widget the right way to go?

Any input appreciated
/Lars


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



Re: Keeping fields out of the Admin

2008-11-20 Thread Lars Stavholm

Epinephrine wrote:
> I have a field that should never be edited by hand.  It is basically
> date_letter_sent, and it should be filled in by a view function when
> it sends a letter.
> 
> How can I keep the field from being editable in the Admin edit page
> for that class?

editable = False in the model definition.
/L

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



Re: admin site problem

2008-11-17 Thread Lars Stavholm

Vicky wrote:
> I tried to add some values to my table from admin site. Table has 3
> columns one of integer type and other two of string type. When i tried
> to save my entries it giving an error as:
> 
>  "coercing to Unicode: need string or buffer, int found"
> 
> How to solve it?

That all depends on what your model looks like?
/L


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



Re: Date Field question -

2008-11-16 Thread Lars Stavholm

Mahesh Vaidya wrote:
> Hi,
> I am going to used "DateField" in my model. Which format does date
> field user is it DD/MM/ (European) or MM/DD/ (American) style
> ?  and is it customizable ?

Have a look at...
http://docs.djangoproject.com/en/dev/ref/settings/?from=olddocs#date-format

But beware, there seems to be an open ticket suggesting that you need...

USE_I18N = False

...in your settings.py in order for the DATE_FORMAT to work as expected.

/L


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



Re: Overriding admin templates

2008-11-03 Thread Lars Stavholm

Lars Stavholm wrote:
> Karen Tracey wrote:
>> On Sat, Nov 1, 2008 at 5:54 PM, Lars Stavholm <[EMAIL PROTECTED]
>> <mailto:[EMAIL PROTECTED]>> wrote:
>>
>> Low Kian Seong wrote:
>> > http://www.djangobook.com/en/1.0/chapter17/
>>
>> Yes, thank you, that's it.
>>
>> It worked nicely for the change_form.html example given in that
>> chapter. However, for the change_list.html it still doesn't work.
>> Seems to me I've hit a django bug. Anyone else?
>>
>> I just tried this, and it works for me for change_list.html. So I'm not
>> sure what is going on in your case.  For me it just works, overriding
>> change_list on a per-model basis using a file:
>>
>> templates/admin///change_list.html
> 
> Hm, I'm using django from svn trunk revision 9208.
> What version are you using?
> /L

As it turns out, it was a conflict with an addon, the batchadmin addon,
that caused the confusion. Django truly works as advertised. My setup
of batchadmin however, needs more tweaking.

Thanks for all your help.
/Lars

>> > On Sat, Nov 1, 2008 at 6:20 PM, Lars Stavholm <[EMAIL PROTECTED]
>> <mailto:[EMAIL PROTECTED]>> wrote:
>> >> Low Kian Seong wrote:
>> >>> You are supposed to put the admin template you want to override in
>> >>> your own template directory definition in settings.py
>> >>>
>> >>> So, if you defined it as /home/stava/> >>> name>/template/admin/change_list.html
>> >> Huh?
>> >> /L
>> >>
>> >>> On Sat, Nov 1, 2008 at 5:32 PM, Lars Stavholm <[EMAIL PROTECTED]
>> <mailto:[EMAIL PROTECTED]>> wrote:
>> >>>> I'd like to override part of an admin change_list template.
>> >>>>
>> >>>> Reading the documentation, my understanding is that I can place
>> >>>> a template in a certain place in the templates directory hierarchy,
>> >>>> and django will look for it and use it, i.e.:
>> >>>>
>> >>>> templates/admin/build/job/change_list.html
>> >>>>
>> >>>> ...where "build" is my application and "job" is my model class.
>> >>>>
>> >>>> The change_list.html file only contains the part I want to
>> override,
>> >>>> i.e. the extrahead block. It contains:
>> >>>>
>> >>>> {% extends "admin/change_list.html" %}
>> >>>> {% block extrahead %}
>> >>>>   
>> >>>> {% endblock %}
>> >>>>
>> >>>> However, this does not work for me, so I'm expecting it to be some
>> >>>> mistake on my part, I just can't figure out what the mistake is.
>> >>>>
>> >>>> Now, if I put the file in ./templates/admin/build/change_list.html
>> >>>> it still wont work. On the other hand, this would be overriding all
>> >>>> "build" application change lists, which is not what I was
>> looking for.
>> >>>>
>> >>>> Only way I've found is to copy the change_list.html from the django
>> >>>> installation in contrib/admin/templates/admin, and then modify
>> it to
>> >>>> my needs, using "if" statements to figure out which application
>> model
>> >>>> class is being rendered, and the put the change_list.html in my
>> app's
>> >>>> templates/admin directory, which doesn't feel right.
>> >>>>
>> >>>> Any input appreciated
>> >>>> /Lars Stavholm
>> >>>>
>> >>>>
>> >>
>> >>
>> >
>> >
>> >
>>
>>
>>
>>
>>
>>
> 
> 
> 
> > 
> 



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



Re: Overriding admin templates

2008-11-03 Thread Lars Stavholm

Karen Tracey wrote:
> On Sat, Nov 1, 2008 at 5:54 PM, Lars Stavholm <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> 
> 
> Low Kian Seong wrote:
> > http://www.djangobook.com/en/1.0/chapter17/
> 
> Yes, thank you, that's it.
> 
> It worked nicely for the change_form.html example given in that
> chapter. However, for the change_list.html it still doesn't work.
> Seems to me I've hit a django bug. Anyone else?
> 
> 
> I just tried this, and it works for me for change_list.html. So I'm not
> sure what is going on in your case.  For me it just works, overriding
> change_list on a per-model basis using a file:
> 
> templates/admin///change_list.html

Hm, I'm using django from svn trunk revision 9208.
What version are you using?
/L

> > On Sat, Nov 1, 2008 at 6:20 PM, Lars Stavholm <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> >> Low Kian Seong wrote:
> >>> You are supposed to put the admin template you want to override in
> >>> your own template directory definition in settings.py
> >>>
> >>> So, if you defined it as /home/stava/ >>> name>/template/admin/change_list.html
> >> Huh?
> >> /L
> >>
> >>> On Sat, Nov 1, 2008 at 5:32 PM, Lars Stavholm <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> >>>> I'd like to override part of an admin change_list template.
> >>>>
> >>>> Reading the documentation, my understanding is that I can place
> >>>> a template in a certain place in the templates directory hierarchy,
> >>>> and django will look for it and use it, i.e.:
> >>>>
> >>>> templates/admin/build/job/change_list.html
> >>>>
> >>>> ...where "build" is my application and "job" is my model class.
> >>>>
> >>>> The change_list.html file only contains the part I want to
> override,
> >>>> i.e. the extrahead block. It contains:
> >>>>
> >>>> {% extends "admin/change_list.html" %}
> >>>> {% block extrahead %}
> >>>>   
> >>>> {% endblock %}
> >>>>
> >>>> However, this does not work for me, so I'm expecting it to be some
> >>>> mistake on my part, I just can't figure out what the mistake is.
> >>>>
> >>>> Now, if I put the file in ./templates/admin/build/change_list.html
> >>>> it still wont work. On the other hand, this would be overriding all
> >>>> "build" application change lists, which is not what I was
> looking for.
> >>>>
> >>>> Only way I've found is to copy the change_list.html from the django
> >>>> installation in contrib/admin/templates/admin, and then modify
> it to
> >>>> my needs, using "if" statements to figure out which application
> model
> >>>> class is being rendered, and the put the change_list.html in my
> app's
> >>>> templates/admin directory, which doesn't feel right.
> >>>>
> >>>> Any input appreciated
> >>>> /Lars Stavholm
> >>>>
> >>>>
> >>
> >>
> >
> >
> >
> 
> 
> 
> 
> 
> 
> > 



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



Re: Overriding admin templates

2008-11-01 Thread Lars Stavholm

Low Kian Seong wrote:
> http://www.djangobook.com/en/1.0/chapter17/

Yes, thank you, that's it.

It worked nicely for the change_form.html example given in that
chapter. However, for the change_list.html it still doesn't work.
Seems to me I've hit a django bug. Anyone else?
/L

> On Sat, Nov 1, 2008 at 6:20 PM, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>> Low Kian Seong wrote:
>>> You are supposed to put the admin template you want to override in
>>> your own template directory definition in settings.py
>>>
>>> So, if you defined it as /home/stava/>> name>/template/admin/change_list.html
>> Huh?
>> /L
>>
>>> On Sat, Nov 1, 2008 at 5:32 PM, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>>>> I'd like to override part of an admin change_list template.
>>>>
>>>> Reading the documentation, my understanding is that I can place
>>>> a template in a certain place in the templates directory hierarchy,
>>>> and django will look for it and use it, i.e.:
>>>>
>>>> templates/admin/build/job/change_list.html
>>>>
>>>> ...where "build" is my application and "job" is my model class.
>>>>
>>>> The change_list.html file only contains the part I want to override,
>>>> i.e. the extrahead block. It contains:
>>>>
>>>> {% extends "admin/change_list.html" %}
>>>> {% block extrahead %}
>>>>   
>>>> {% endblock %}
>>>>
>>>> However, this does not work for me, so I'm expecting it to be some
>>>> mistake on my part, I just can't figure out what the mistake is.
>>>>
>>>> Now, if I put the file in ./templates/admin/build/change_list.html
>>>> it still wont work. On the other hand, this would be overriding all
>>>> "build" application change lists, which is not what I was looking for.
>>>>
>>>> Only way I've found is to copy the change_list.html from the django
>>>> installation in contrib/admin/templates/admin, and then modify it to
>>>> my needs, using "if" statements to figure out which application model
>>>> class is being rendered, and the put the change_list.html in my app's
>>>> templates/admin directory, which doesn't feel right.
>>>>
>>>> Any input appreciated
>>>> /Lars Stavholm
>>>>
>>>>
>>
>>
> 
> 
> 



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



Re: Overriding admin templates

2008-11-01 Thread Lars Stavholm

Low Kian Seong wrote:
> You are supposed to put the admin template you want to override in
> your own template directory definition in settings.py
> 
> So, if you defined it as /home/stava/ name>/template/admin/change_list.html

Huh?
/L

> On Sat, Nov 1, 2008 at 5:32 PM, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>> I'd like to override part of an admin change_list template.
>>
>> Reading the documentation, my understanding is that I can place
>> a template in a certain place in the templates directory hierarchy,
>> and django will look for it and use it, i.e.:
>>
>> templates/admin/build/job/change_list.html
>>
>> ...where "build" is my application and "job" is my model class.
>>
>> The change_list.html file only contains the part I want to override,
>> i.e. the extrahead block. It contains:
>>
>> {% extends "admin/change_list.html" %}
>> {% block extrahead %}
>>   
>> {% endblock %}
>>
>> However, this does not work for me, so I'm expecting it to be some
>> mistake on my part, I just can't figure out what the mistake is.
>>
>> Now, if I put the file in ./templates/admin/build/change_list.html
>> it still wont work. On the other hand, this would be overriding all
>> "build" application change lists, which is not what I was looking for.
>>
>> Only way I've found is to copy the change_list.html from the django
>> installation in contrib/admin/templates/admin, and then modify it to
>> my needs, using "if" statements to figure out which application model
>> class is being rendered, and the put the change_list.html in my app's
>> templates/admin directory, which doesn't feel right.
>>
>> Any input appreciated
>> /Lars Stavholm
>>
>>
> 
> > 
> 



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



Overriding admin templates

2008-11-01 Thread Lars Stavholm

I'd like to override part of an admin change_list template.

Reading the documentation, my understanding is that I can place
a template in a certain place in the templates directory hierarchy,
and django will look for it and use it, i.e.:

templates/admin/build/job/change_list.html

...where "build" is my application and "job" is my model class.

The change_list.html file only contains the part I want to override,
i.e. the extrahead block. It contains:

{% extends "admin/change_list.html" %}
{% block extrahead %}
   
{% endblock %}

However, this does not work for me, so I'm expecting it to be some
mistake on my part, I just can't figure out what the mistake is.

Now, if I put the file in ./templates/admin/build/change_list.html
it still wont work. On the other hand, this would be overriding all
"build" application change lists, which is not what I was looking for.

Only way I've found is to copy the change_list.html from the django
installation in contrib/admin/templates/admin, and then modify it to
my needs, using "if" statements to figure out which application model
class is being rendered, and the put the change_list.html in my app's
templates/admin directory, which doesn't feel right.

Any input appreciated
/Lars Stavholm


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



Re: customize TimeField

2008-10-27 Thread Lars Stavholm

Arash wrote:
> Hi Everybody,
> Could you tell me please how can I customize TimeField. I need to get
> ride of the seconds. I don't want seconds to appear on admin interface

settings.py: TIME_FORMAT maybe.

/L


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



Re: admin DATE_FORMAT not working?

2008-10-24 Thread Lars Stavholm

Low Kian Seong wrote:
> Maybe this would shed some light:
> http://code.djangoproject.com/ticket/2203

Yup, that explains it, thanks.
/L

> On Fri, Oct 24, 2008 at 4:57 PM, Lars Stavholm <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> 
> I've got...
> 
> TIME_ZONE = 'Europe/Stockholm'
> DATE_FORMAT = "Y-m-d"
> TIME_FORMAT = "H:i"
> DATETIME_FORMAT = DATE_FORMAT + " " + TIME_FORMAT
> 
> ...in my settings.py file, but no joy, these definitions are not
> used in the admin interface when running the development server.
> Instead I get the US format or whatever it is, something like
> "Oct. 24, 2008, 10:51 a.m.".
> 
> Any hints on what I am doing wrong here?
> Maybe there's more settings needed that I'm not aware off?
> 
> Any input appreciated
> /Lars


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



admin DATE_FORMAT not working?

2008-10-24 Thread Lars Stavholm

I've got...

TIME_ZONE = 'Europe/Stockholm'
DATE_FORMAT = "Y-m-d"
TIME_FORMAT = "H:i"
DATETIME_FORMAT = DATE_FORMAT + " " + TIME_FORMAT

...in my settings.py file, but no joy, these definitions are not
used in the admin interface when running the development server.
Instead I get the US format or whatever it is, something like
"Oct. 24, 2008, 10:51 a.m.".

Any hints on what I am doing wrong here?
Maybe there's more settings needed that I'm not aware off?

Any input appreciated
/Lars


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



Re: Foreign key with tons of items

2008-10-23 Thread Lars Stavholm

Fabio Natali wrote:
> Fabio Natali wrote:
> [...]
>> class Prod2(models.Model):
>> name = models.CharField(max_length=30)
>>
>> class Prod1(models.Model):
>> name = models.CharField(max_length=30)
>> belongs_to = models.ForeignKey(Prod2)
>>
>> class Prod0(models.Model):
>> name = models.CharField(max_length=30)
>> belongs_to = models.ForeignKey(Prod2)
> 
> That's obviously:
>  belongs_to = models.ForeignKey(Prod1)
> 
>> price = models.DecimalField(max_digits=10, decimal_places=2)
>> #...some more details...
>>
>> class Purchase(models.Model):
>> product = models.ForeignKey(Prod0)
>> amount = models.DecimalField(max_digits=10, decimal_places=2)
>> #...some more details...
> 
> Sorry for the typo, bye, Fabio.
> 

Have you tried filter_horizontal?
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#filter-horizontal
/L


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



Newbie help with limit_choices_to on ManyToMany

2008-10-06 Thread Lars Stavholm

Hi All,

I'm rather new to django (and python) so I tend to get lost sometimes:

I'm looking to limit the choices in a ManyToMany relationship:

class Computer(models.Model):
host = models.CharField(max_length = 20, unique = True)
def __unicode__(self):
return self.host

class Configuration(models.Model):
name   = models.CharField(max_length = 20, unique = True)
hosts  = models.ManyToManyField(Computer)
def __unicode__(self):
return self.name

admin.py has a "filter_horizontal = ('hosts',)" in the
ConfigurationAdmin class. So, in the admin interface, for each
Configuration I create, I can populate the "Chosen hosts" form
table from the "Available hosts" form table.

So far so good, now I would like the "Available hosts" form table
to show only hosts that's not part in *any* previous Configuration,
i.e. when I've used up all hosts, the "Available hosts" form table
should be empty. What's the best way to solve this? By using
limit_choices_to somehow I guess.

Any ideas appreciated
/Lars


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



disable help_text

2008-10-05 Thread Lars Stavholm

Hi All,

does anyone know of a way to turn off (disable/replace)
the rather long help text message for ManyToManyField's,
starting with "Hold down..."?

Any input appreciated
/Lars


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



Re: UserProfile problem

2008-09-25 Thread Lars Stavholm

Denis Morozov wrote:
> Look at this post, it seems to be what you need:
> http://pyxx.org/2008/08/18/how-to-extend-user-model-in-django-and-enable-new-fields-in-newforms-admin/
> 
> And you have to read comments to that page, where is some fix to the
> code in the comments.

And that, of course, worked just fine:)
Thanks
/Lars

> On Sep 24, 7:03 pm, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>> Running django-1.0 out of svn trunk, just updated today (9084).
>>
>> I've defined my UserProfile according to the latest documentation:
>>
>> class UserProfile(models.Model):
>>  user  = models.ForeignKey(User, unique=True)
>>  dep   = models.CharField("Department", max_length=20, blank=True)
>>  phone = models.CharField(max_length=20, blank=True)
>>  notes = models.TextField(blank=True)
>>
>> I've added the following to my settings.py:
>>
>> AUTH_PROFILE_MODULE = 'app.userprofile'
>>
>> But I still don't get any extra fields in the admin.
>>
>> What am I missing?
>>
>> Any input appreciated
>> /Lars
> > 
> 



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



UserProfile problem

2008-09-24 Thread Lars Stavholm

Running django-1.0 out of svn trunk, just updated today (9084).

I've defined my UserProfile according to the latest documentation:

class UserProfile(models.Model):
 user  = models.ForeignKey(User, unique=True)
 dep   = models.CharField("Department", max_length=20, blank=True)
 phone = models.CharField(max_length=20, blank=True)
 notes = models.TextField(blank=True)

I've added the following to my settings.py:

AUTH_PROFILE_MODULE = 'app.userprofile'

But I still don't get any extra fields in the admin.

What am I missing?

Any input appreciated
/Lars


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



Re: remove ^M: project moved from window to linux

2008-01-12 Thread Lars Stavholm

crybaby wrote:
> What is the fastest way to remove ^M from every files in main project
> folder and apps folders.  Doing it by hand seems time consuming.  Is
> there a simple script take care of this?  if I just leave the ^M in
> python code,  would it cause problems?

If you're on a Linux box (you might want to mention
details like that:) you could try to apply the dos2unix
command on each file.

find . -type f | xargs dos2unix

/L



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



Re: #! ??

2008-01-11 Thread Lars Stavholm

kbochert wrote:
> I must be blind!!
> 
> I have 2 files  (screen capture from pico)
> 
> 
>   GNU nano 1.3.12   File: tmp2
> 
> #!/usr/local/bin/python2.5
> 
> print "Hello"
> 
> 
> 
> 
>   GNU nano 1.3.12   File: tmp3
> 
> #!/usr/local/bin/python2.5
> 
> print "Hi!"
> 
> 
> Both are executable:
> 
> [EMAIL PROTECTED] public_html]# ls -l tmp*
> -rwxr-xr-x 1 root root 493 Jan 11 21:37 tmp1
> -rwxr-xr-x 1 root root  43 Jan 11 21:41 tmp2
> -rwxr-xr-x 1 root root  43 Jan 11 21:39 tmp3
> 
> So why does only one work??
> 
> [EMAIL PROTECTED] public_html]# ./tmp2
> Hello
> 
> [EMAIL PROTECTED] public_html]# ./tmp3
> -bash: ./tmp3: /usr/local/bin/python2.5^M: bad interpreter: No such
> file or directory

There's an invisible character, CR - Carriage Return
(denoted by ^M in vi), at the end of the tmp3 bash line.
Try dos2unix.
/L


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



Re: spam

2007-11-06 Thread Lars Stavholm

Michael Best wrote:
> Jay Klehr wrote:
>> Are the other lists powered by Google Groups?  Are they as active as 
>> Django's list?
>>
>> Perhaps you should direct your complaints to Google, as I don't think 
>> the people on this list (or even the owners of the list) can do much 
>> about it (aside from moderating every new user/post).
>>
>> Jay
> 
> This is one of the few lists where I get spam in my gmail account at 
> all.  I don't know why that is, it almost feels like there is no 
> filtering on the list by Google at all.

That's not right. There's a lot o filtering going on.
What we see is the few that slips through. After a bit
of spam filter training, these will be gone as well.
After that, the spam senders will figure out a new way
to slip through the filter(s), the filter(s) will learn
and improve, the spam'ers will figure out a new way, the
filter's..., and so on. I get a few spam's now and then
on other lists as well, including Google Groups lists.
Nevertheless, the latest porno spam's are appalling.
/L


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



Re: spam

2007-11-06 Thread Lars Stavholm

Jeffrey Johnson wrote:
> This is the ONE list where I consistently get porn spam in gmail. What gives?

The format of these porn spam's is new,
I do believe the filtering will take care
of it soon enough. Takes a few of these to
train the spam filter(s).
/L

> On Nov 6, 2007 9:52 AM, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>> Derek Anderson wrote:
>>> ok, seriously, is there not something we can do about the porn spam?
>>> some of us read this list at work on machine's we don't own.  the image
>>> stuff is becoming a serious problem.
>> I do believe that Google groups are filtering out close to 99%
>> of all spam (sign up for a gmail.com account and see for yourself).
>> I too find this greatly disturbing, but the fact is that it is,
>> to my understanding, difficult or even impossible to filter out
>> 100% of the spam.
>> /L
>>
>>
>>
> 
> > 
> 



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



Re: spam

2007-11-06 Thread Lars Stavholm

Derek Anderson wrote:
> ok, seriously, is there not something we can do about the porn spam? 
> some of us read this list at work on machine's we don't own.  the image 
> stuff is becoming a serious problem.

I do believe that Google groups are filtering out close to 99%
of all spam (sign up for a gmail.com account and see for yourself).
I too find this greatly disturbing, but the fact is that it is,
to my understanding, difficult or even impossible to filter out
100% of the spam.
/L


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



Re: problem with svn checkout

2007-10-27 Thread Lars Stavholm

Kenneth Gonsalves wrote:
> hi,
> 
> I am having problems checking out the latest head (it could be due to  
> my present flaky internet connection). The failure message is:
> 
> svn: REPORT request failed on '/svn/!svn/vcc/default'
> svn: REPORT of '/svn/!svn/vcc/default': 200 OK (http:// 
> code.djangoproject.com)
> 
> I have got this three times at the same place

Just tested, works nicely for me.
/L



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



Re: Multiple primary keys

2007-09-05 Thread Lars Stavholm

Leo wrote:
> Lars, have you made any progress on this?  I agree that only the

Sorry to say: no progress at all:(

> numeric types are interesting as multiple keys, so worrying about
> URL encoding is pointless (i.e., there's no reason to worry about
> supporting multiple arbitrary-string keys).

Well, pointless may be a little bit harsh. One of the previous
arguments was that a lot of effort has been spent on figuring
out a good way of using the URL's to match the django datamodel
and the human user, and the changes for the multiple primary key
would destroy the (pretty nice) URL scheme used today.

So I'd say: yes there's reason to worry about *how* to support
multiple primary keys (including arbitrary string keys), but
there's no reason what-so-ever not to implement it. The multiple
primary key feature would open up for loads of legacy database
applications. The possibilities for django on top of legacy
databases would be endless instead of gravely limited, as is
the case today.

Also, I've seen some work on a native GUI interface being
generated on top of a django db model, and sure enough, from
my point of view, with for example WxWindows, you could with
relative ease create native (multiplatform) GUI interfaces
using django.

Django + webappl + native GUI + python: does it get any better?

Except of course, for the multiple primary keys:(

> I'm trying to convince a team to use Django for new development
> on a large (1M+ records) existing database. The truth is it won't
> happen due to lack of this exact feature -- the existing database
> uses multiple (numeric) keys widely, in very conventional ways.

Well, it's common enough in the RDBMS world.

> When there are other non-Django interfaces still in use by users,
> adding special database id columns for Django's sake is unfeasible.

Very true. I've tried to figure out ways of cheating, finding some
sort of intermediate solution or what-not. No such luck. The only
solution here is to have django handle the typical multiple primary
keys situation.

Sorry to say, I'm not fluent in python, and definitely not in
django internals, otherwise I would have gone for it myself.

Short of that, if anyone's listening, I could do tests on this
subject. I have a good few both smaller and bigger legacy
databases that I would have loved to django-ify.

Cheers
/Lars


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



Re: Multiple primary keys

2007-08-14 Thread Lars Stavholm

Thanks, Michael, I'll give it a try.
/Lars

Michael Radziej wrote:
> Hi Lars,
> 
> I found myself in a similar position, and I'm also coming from the database
> side ... funny ;-)
> 
> I have attached a small patch that solved the problem for me and might be a
> start for you, but be aware, it's more a crutch than a solution.
> 
> - this patch won't make it into the project, so you have to maintain it on
>   your own
> 
> - it doesn't try to work for the admin or for newforms (but made be working
>   for it), so I didn't have to deal with the admin URLs at all.
> 
> - it does not deal with creating databases or database introspection.
> 
> For a model with multiple primary keys, add an Meta class attribute
> `has_composite_primary_key_key=True`. Here's an example model with 
> multiple primary keys:
> 
> class Kundemail(UpdatelogMixin, models.Model):
> kunde = models.ForeignKey(Kunde, db_column='kunde', primary_key = True)
> dienst = DescriptorField(Descr, "dienst", db_column="dienst", primary_key 
> = True)
> person = models.ForeignKey(Person, db_column='person', primary_key = True)
> 
> class Meta:
> db_table = 'kundemail'
> has_composite_primary_key = True
> 
> So long,
> 
> Michael
> 
> 
> 
> 
> 
> From nobody Mon Sep 17 00:00:00 2001
> From: Michael Radziej <[EMAIL PROTECTED]>
> Date: Mon Aug 13 16:03:06 2007 +0200
> Subject: [PATCH] composite pkey
> 
> Refreshed patch composite-pkey.
> (Base: da455ae19930af1b4513b37de8bd8e9f68ec6c3d)
> (Last: 22c5ecf0407989824916f6b1676a4632c336a9d1)
> 
> ---
> 
>  django/core/management.py   |9 -
>  django/db/models/options.py |4 +++-
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> base 0f7580c29c7e992e9a071d3df62260e0609c2c68
> last f7b6a55742bbf1ff867d841cdc17942fff357470
> diff --git a/django/core/management.py b/django/core/management.py
> index 
> 882ff6de323a45a718c4d84b592da8a1ecc7357e..7f11101e69490faca4dcaac1b6acd29454a6ab0b
>  100644
> --- a/django/core/management.py
> +++ b/django/core/management.py
> @@ -157,6 +157,7 @@ def _get_sql_model_create(model, known_models=set()):
>  opts = model._meta
>  final_output = []
>  table_output = []
> +composite_pkeys = []
>  pending_references = {}
>  for f in opts.fields:
>  col_type = f.db_type()
> @@ -172,7 +173,10 @@ def _get_sql_model_create(model, known_models=set()):
>  if f.unique and (not f.primary_key or backend.allows_unique_and_pk):
>  field_output.append(style.SQL_KEYWORD('UNIQUE'))
>  if f.primary_key:
> -field_output.append(style.SQL_KEYWORD('PRIMARY KEY'))
> +if opts.has_composite_primary_key:
> +composite_pkeys.append(f)
> +else:
> +field_output.append(style.SQL_KEYWORD('PRIMARY KEY'))
>  if tablespace and backend.supports_tablespaces and (f.unique or 
> f.primary_key) and backend.autoindexes_primary_keys:
>  # We must specify the index tablespace inline, because we
>  # won't be generating a CREATE INDEX statement for this field.
> @@ -196,6 +200,9 @@ def _get_sql_model_create(model, known_models=set()):
>  for field_constraints in opts.unique_together:
>  table_output.append(style.SQL_KEYWORD('UNIQUE') + ' (%s)' % \
>  ", 
> ".join([backend.quote_name(style.SQL_FIELD(opts.get_field(f).column)) for f 
> in field_constraints]))
> +if opts.has_composite_primary_key:
> +table_output.append(style.SQL_KEYWORD('PRIMARY KEY')+ ' (%s)' % \
> +", ".join([backend.quote_name(style.SQL_FIELD(f.column)) for f 
> in composite_pkeys]))
>  
>  full_statement = [style.SQL_KEYWORD('CREATE TABLE') + ' ' + 
> style.SQL_TABLE(backend.quote_name(opts.db_table)) + ' (']
>  for i, line in enumerate(table_output): # Combine and add commas.
> diff --git a/django/db/models/options.py b/django/db/models/options.py
> index 
> 7cccb611cf354d5e9d5288a05f7c788ee6a4fa52..60e050b2ddd3a26a4941ba5fb1706338699137a7
>  100644
> --- a/django/db/models/options.py
> +++ b/django/db/models/options.py
> @@ -15,7 +15,8 @@ get_verbose_name = lambda class_name: 
> re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|
>  
>  DEFAULT_NAMES = ('verbose_name', 'db_table', 'ordering',
>   'unique_together', 'permissions', 'get_latest_by',
> - 'order_with_respect_to', 'app_label', 'db_tablespace')
> + 'order_with_respect_to', 'app_label', 'db_tablespace',
> + 'has_composite_primary_key')
>  
>  class Options(object):
>  def __init__(self, meta):
> @@ -36,6 +37,7 @@ class Options(object):
>  self.has_auto_field = False
>  self.one_to_one_field = None
>  self.parents = []
> +self.has_composite_primary_key = False
>  
>  def contribute_to_class(self, cls, name):
>  cls._meta = self




Re: Multiple primary keys

2007-08-13 Thread Lars Stavholm

Malcolm Tredinnick wrote:
> On Tue, 2007-08-14 at 06:51 +0200, Lars Stavholm wrote:
>> Malcolm Tredinnick wrote:
>>> On Tue, 2007-08-14 at 08:47 +0800, Russell Keith-Magee wrote:
>>> [...]
>>>> You will have more difficulty with the Admin application and generic
>>>> views. Both of these features rely upon the ability to install URLs
>>>> like:
>>>>
>>>> /path/to/object/42/ -> edit object 42
>>>>
>>>> This works fine if you have a single column primary key; however, if
>>>> you have multiple column primary keys, this isn't so easy to do. To
>>>> date, every proposed syntax for URL spaces supporting multiple primary
>>>> keys has either been syntactically ambiguous (e.g.,
>>>> /path/to/object/42,37 - which works unless the primary key has a comma
>>>> in it), or very inelegant (/path/to/object/42/37/ - which implies a
>>>> heirarchy where there isn't one). Any proposal for adding multiple
>>>> primary keys would need to address this very large issue.
>>> Remembering that primary keys are not just integers, so *any* string
>>> construct you come up with could also be the value of a single primary
>>> key. (e.g. "42/37/", in Russell's second example, could be a primary key
>>> value, too).
>> I see, not that simple.
>>
>> I guess the following idea has been discussed already then:
>>
>> Something like...
>>
>> /path/to/object/42,37
>>
>> ...where we use a setting like...
>>
>> PRIMARY_KEY_SEPARATOR = ','
>>
>> So, if the application needs to use another character to
>> separate the primary key fields, we could use, for example...
>>
>> /path/to/object/[EMAIL PROTECTED]
>>
>> PRIMARY_KEY_SEPARATOR = '@'
>>
>> ...maybe with a built in restriction of the allowed values
>> for  PRIMARY_KEY_SEPARATOR.
> 
> How will you know what your users will enter in the primary key? If it's

Well, all of the databases I've been looking at are sort
of professionally built, and don't really use arbitrary
strings for any primary key field. The usual case is a
combinations of integers, and in some cases a combination
of integers and simple/short strings, like unix usernames,
invoice number characters and integers mixed in a single
string field, and such. One could even assume that there's
no strange characters within the primary key field. I've
been working with RDBMSs for a good while, and I've never
seen any arbitrary-string-in-primary-key-field requirement,
no commas, no dots, no semicolons, nothing like that. It's
simply bad practice to have primary keys like that.

> something like a title or any other arbitrary field, aren't you out of
> luck? So then you end up looking at escaping mechanisms and it rapidly
> leads to ugly looking URLs.

I'm not really looking for the arbitrary string case, and
definitely not putting stuff like a title in the primary key.
It's a question of a primary key for an RDBMS, a couple of
best practice limitations fits in nicely, e.g. integers
(mostly) and short strings, like order number as a string,
invoice number as a string, stuff like that.

> Periodically, I wonder if it's worth implementing this anyway, just for
> fun, and then saying if you have multiple primary keys, you can't use
> those models in the admin. The mechanics are not that hard in most
> places (it's not entirely trivial, since we can't break existing code
> that uses the 'pk' attribute on models, etc). Current users would be no
> worse of. People using the new feature will do it with their eyes open
> and accepting the consequences of their decision (except therein lies
> the problem). I haven't gotten as far as pulling the trigger yet,
> though, since I always have other stuff to do.

Yes, well, I think it might be worth the effort. Imagine how many
legacy databases would benefit from a user interface built with
django, web or native. However, I do believe that the admin interface
should be an integral part of this, it's essential in getting your
application up and running quickly.

Just my 2c worth
/Lars


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



Re: Multiple primary keys

2007-08-13 Thread Lars Stavholm

Malcolm Tredinnick wrote:
> On Tue, 2007-08-14 at 08:47 +0800, Russell Keith-Magee wrote:
> [...]
>> You will have more difficulty with the Admin application and generic
>> views. Both of these features rely upon the ability to install URLs
>> like:
>>
>> /path/to/object/42/ -> edit object 42
>>
>> This works fine if you have a single column primary key; however, if
>> you have multiple column primary keys, this isn't so easy to do. To
>> date, every proposed syntax for URL spaces supporting multiple primary
>> keys has either been syntactically ambiguous (e.g.,
>> /path/to/object/42,37 - which works unless the primary key has a comma
>> in it), or very inelegant (/path/to/object/42/37/ - which implies a
>> heirarchy where there isn't one). Any proposal for adding multiple
>> primary keys would need to address this very large issue.
> 
> Remembering that primary keys are not just integers, so *any* string
> construct you come up with could also be the value of a single primary
> key. (e.g. "42/37/", in Russell's second example, could be a primary key
> value, too).

I see, not that simple.

I guess the following idea has been discussed already then:

Something like...

/path/to/object/42,37

...where we use a setting like...

PRIMARY_KEY_SEPARATOR = ','

So, if the application needs to use another character to
separate the primary key fields, we could use, for example...

/path/to/object/[EMAIL PROTECTED]

PRIMARY_KEY_SEPARATOR = '@'

...maybe with a built in restriction of the allowed values
for  PRIMARY_KEY_SEPARATOR.

> Our other big goal is not to break the existing single primary key case.

Well, if that's a goal, I'm afraid I'm out of luck:|

> Preferably no change to existing URLs.

I see.

My conclusion is that the multiple primary key fields is not
going to happen, which is a pity, since introspection then
is of limited use.

Thanks for your input
/Lars


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



Multiple primary keys

2007-08-13 Thread Lars Stavholm

Hi all,

first of all: django rocks! I'm a database application developer
and not a web developer. I'm not even fluent in python. Despite
that, the django framework has made it possible for me to develop
web based database applications with relative ease. And, I can
use the model and the database api for native applications using
WxPython. This is really great and this got to be the most productive
environment ever. This is what the 4GL languages tried to accomplish
back in the 90's, and they all failed miserably.

However, there's one significant piece I'm missing when introspecting
old database applications and trying to create new user interfaces
for them, and that's the lack of multiple fields in the primary key
for a table.

I know that this has been discussed on this list, but what I would
like to know now is: is there any effort going into creating the
"multiple fields in the primary key" feature at all? If so, is there
anything I could do to help, short of trying to implement it myself,
which I doubt that I'll be able to?

Any input appreciated.
/Lars


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



Re: model subclassing

2007-07-13 Thread Lars Stavholm

Carl Karsten wrote:
> I am experimenting with subclassing a model.  The parent class will be an 
> abstract class that does not get 'managed' by django.  Only the subclass 
> will, 
> and the table the subclass works with will have all the fields.
> 
> syncdb was able to create the table I expected, the admin let me add and save 
> it, but then when I went to view it, error:
> 
> ProgrammingError at /admin/core/message/1/
> (1146, "Table 'djangodb.msg_abmessage' doesn't exist")
> 
> (full details below)
> 
> So is this just a small bug in the Admin, or is this totally unsupported and 
> I 
> should give up now?

Sorry, bad news, look for the word "subclassing"
at http://code.djangoproject.com.
/L


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



The Book

2007-06-19 Thread Lars Stavholm

Just wanted to let you know that the Django Book seems
to be due out June 26th, just got a mail from Amazon.
/Lars

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



Re: Is composite primary key possible?

2007-06-07 Thread Lars Stavholm

Russell Keith-Magee wrote:
> On 6/7/07, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>> And then I hit a snag: there's one table that uses a composite
>> primary key made up of three fields. (the attachment table in trac.db)
>>
>> I've scanned the doco and I've googled, this is what I came up with:
>>
>> o define one of the fields as a primary
>> o add the unique_together Meta constraint
>>
>> Is there another/better way?
> 
> Unfortunately, no. That's about the best you can do at the moment.

OK.

> Composite primary keys are a frequently requested feature, but there
> is one major problem - specifying a URL for an object with a composite
> key in the Admin application (or any other application for that
> matter).
> 
> Suggestions are welcome, but search the archives first, beacuse this
> isn't the first time it has been suggested, and there are problems
> with many of the obvious ideas.

I can see the difficulties.

Thanks
/Lars

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



Is composite primary key possible?

2007-06-06 Thread Lars Stavholm

Hi All,

I'm trying to get a django model created from an already existing
database using the inspectdb feature of django. (it's the trac db
if anyone's interested).

At the first look: brilliant!

And then I hit a snag: there's one table that uses a composite
primary key made up of three fields. (the attachment table in trac.db)

I've scanned the doco and I've googled, this is what I came up with:

o define one of the fields as a primary
o add the unique_together Meta constraint

Is there another/better way?

Any input appreciated.
/Lars Stavholm

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



Re: SQLite - unsupported file format

2007-05-15 Thread Lars Stavholm

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

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

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

Cheers
/Lars

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



Re: ERD

2007-05-12 Thread Lars Stavholm

Nowell wrote:
> I believe you are referring to 
> http://code.djangoproject.com/wiki/DjangoGraphviz

That's the one!

Thanks
/Lars

> On May 12, 3:08 pm, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>> Hi all,
>>
>> I'm going bananas looking for a ERD tool that was available on 
>> thewww.djangoproject.comsite a year ago. I think it was mentioned together
>> with a link in one of the comments on one of the pages soewhere (yeah,
>> that's vague:). I remember trying it out and it worked just fine, taking
>> the django model and producing a brilliant ER-Diagram of said model.
>> It was a simple python file, .py.
>>
>> Any one know where it can be found?
>>
>> Alternatives?
>>
>> Any help appreciated
>> /Lars Stavholm
> 
> 
> > 
> 


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



ERD

2007-05-12 Thread Lars Stavholm

Hi all,

I'm going bananas looking for a ERD tool that was available on the
www.djangoproject.com site a year ago. I think it was mentioned together
with a link in one of the comments on one of the pages soewhere (yeah,
that's vague:). I remember trying it out and it worked just fine, taking
the django model and producing a brilliant ER-Diagram of said model.
It was a simple python file, .py.

Any one know where it can be found?

Alternatives?

Any help appreciated
/Lars Stavholm

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



Re: building a django rpm, probs with adding documentation

2007-03-25 Thread Lars Stavholm

Paul Rauch wrote:
> Hello,
> 
> I'm currently building a rpm of django for suse.
> 
> But I can't figure out how to add the documentation, it doesn't get
> added, when running "python setup.py build"

Assuming that you've unpacked your source with...

%prep
%setup -q

...you should be able to do...

%files
%doc AUTHORS docs examples extras INSTALL LICENSE README

...where the doc directory contains the documentation files
that comes with the distribution.

If need be, download and install

and have a look at the spec file.

I haven't had time to test the package yet, but still.

Good Luck
/Lars

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



Re: Django Cheat Sheet

2007-02-13 Thread Lars Stavholm

John Sutherland wrote:
> Hi all,
> 
> Firstly, sorry for the cross-post.
> 
> My employer, Mercurytide [1], as some of you may have seen in the
> past, publishes white-papers on a monthly basis. This month it's
> another Django themed one: a Django cheat sheet:
> 
> 
> 
> We've spent a fair bit of time on it and would really appreciate the 
> following:
> 
> 1. That you download it; try it out and enjoy it!
> 2. Give us feedback, we know it's not going to be perfect first time,
> so let us know: [EMAIL PROTECTED]
> 3. You publicise it: it would be awesome to get it on the digg front
> page [2]; but put it on your blog, your del.icio.us or where ever...

Brilliant!
/L

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



Re: Django on a server with thin clients

2006-12-14 Thread Lars Stavholm

Joseph Heck wrote:
> You can avoid the test database issue by having the students use SQLite as
> the database backend. They can store the database in their home directories
> and be good to go.
> 
> -joe

In addition, depending on your thin client solution, if you start
tracd locally on your thin client (the actual binary file is on the
server, but the process runs on the local CPU), then it is of course
local and you can use the default port number for each student.
This method of starting applications is available in the LTSP thin
client solution, and it might/should be available in other solutions.
/L

> On 12/13/06, Todd O'Bryan <[EMAIL PROTECTED]> wrote:
>>
>> This is going to sound like an odd question, but I'm hoping people will
>> have some ideas.
>>
>> I teach CS in a high school, and next semester my lab is going to be
>> replaced with a thin client lab running on Ubuntu. My seniors and I are
>> working on a Django project and will all be trying to run the
>> development server on different clients of what is, for all practical
>> purposes, the same box.
>>
>> I've identified two potential problems:
>>
>> * everyone will need to be assigned a port number to use (I'm
>> thinking 8000 + n, where n is the computer number in the lab)
>>
>> * we'll need to set up separate test databases for each developer
>> (not sure how to do that so that Subversion doesn't get annoyed
>> at having settings.py changed every 2 seconds, yet, but I'll get
>> it)
>>
>> Are there any other gotchas that people can think of offhand?
>>
>> I have some time over break to try to get some infrastructure in place
>> to forestall potential problems, so any heads-up anyone can give me
>> would be very appreciated.
>>
>> Thanks,
>> Todd
>>
>>
> 
> 
> > 


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



Re: How about a real django installer?

2006-11-14 Thread Lars Stavholm

Eugene Lazutkin wrote:
> James Bennett wrote:
>>> * Windows is apparently a horror story. I don't personally have access
>>> to a Windows box (everything I work with is OS X or a Debian-derived
>>> Linux distribution), so I don't even know where to begin.
>>>
>>> Anybody with experience on these platforms want to step up and help
>>> out with easier install processes?
> 
> As soon as we released 0.95 I've built an installer for Windows and
> e-mailed it to Jacob. I never heard back. Since then I am distributing
> it privately.

Can that installer it be downloaded from somewhere?
Are you by any chance using NSIS?

As far as the CentOS goes, I do believe it's rpm
based so I've got an rpm available for download at
. If anyone
would care to test it on CentOS (or RHEL) or any other
rpm based distro, I'm willing to make sure it works.
I've tested it myself on SuSE Linux 9.3 and 10.1.

Thanks
/[EMAIL PROTECTED]

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



Re: How to svn -co Django sources

2006-11-14 Thread Lars Stavholm

telenieko wrote:
> Hi,
> From: http://www.djangoproject.com/documentation/install/
>  [Installing the
> development version],
> 
> svn co 
> http://code.djangoproject.com/svn/django/trunk/ django_src
> ln -s `pwd`/django_src/django /usr/lib/python2.3/site-packages/django
> 
> Better do that in another fresh new folder.

And then, when you want the updates, you'll do:

$ cd .../django_src
$ svn update

/stava

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