Re: in Admin mode search_fields error

2005-10-27 Thread fatbobman

sorry. I forget def the search field



in Admin mode search_fields error

2005-10-27 Thread fatbobman

i can see the search_fields in admin mode.but i can't use it.
error message:
There's been an error:

Traceback (most recent call last):

  File "C:\Python24\lib\site-packages\django\core\handlers\base.py",
line 71, in get_response
response = callback(request, **param_dict)

  File
"C:\Python24\lib\site-packages\django\contrib\admin\views\decorators.py",
line 49, in _checklogin
return view_func(request, *args, **kwargs)

  File
"C:\Python24\lib\site-packages\django\contrib\admin\views\main.py",
line 154, in change_list
for field_name in lookup_opts.admin.search_fields:

TypeError: iteration over non-sequence



Re: 'Site administration' heading in django admin interface

2005-10-27 Thread Emanuele

OK, solved!
I copied contrib/admin/templates/admin/base.html to my local admin
directory of templates and commented out this line:
 {% if title %}{{ title }}{% endif %}
and that's it.

Thanks a lot,

Emanuele



Re: 'Site administration' heading in django admin interface

2005-10-27 Thread Ian Holsman

Have you tried modifying/copying the file
$SRC//django/contrib/admin/templates/admin/base.html

if you modifiy your project settings file you can override this by
simply placing a file called
admin/base.html into your own template directory (before the standard one)

Cheers
Ian

On 10/28/05, Emanuele <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I'm using django automatic admin interface as (only) web-interface for
> a little application already in production/testing [*]. I customized a
> bit the main admin page using "django-admin.py adminindex" output but
> I'm not able to remove the heading "Site administration" on top of it
> because it is embedded in django code,
> contrib/admin/views/main.py :
> ...
> def index(request):
> return render_to_response('admin/index', {'title': 'Site
> administration'}, context_instance=Context
> ...
>
> I don't like touching django code code for now, so is it possible to
> remove or customize that heading from user side?
>
> Thanks,
>
> Emanuele
>
> [*]: I hope to release it freely soon, just as an example of django
> capabilities for newbies like me. Stay tuned.
>
>


--
[EMAIL PROTECTED] -- ++61-3-9877-0909
If everything seems under control, you're not going fast enough. -
Mario Andretti


strange values in ManyToManyField

2005-10-27 Thread stava

I get some strange values from auth.users that I hope someone can
explain.

I've extended the auth.users like so:

class User(auth.User):
  primary_group = meta.ForeignKey(auth.Group, default = 1,
verbose_name = 'primary group')
  new_password  = meta.CharField(maxlength = 40, blank = True)
  department= meta.ForeignKey(Department, default = 1)
  country   = meta.ForeignKey(Country, default = 1,
help_text = 'Country the user belongs to')
  available = meta.IntegerField(maxlength = 3, default = 100,
verbose_name = 'available (%)',
help_text = 'Percentage of hours per week')
  cost  = meta.IntegerField(maxlength = 4, default = 500,
help_text = 'SEK per hour')
  employee  = meta.PositiveSmallIntegerField(unique = True,
help_text = 'Employee number')
  notes = meta.TextField(blank = True)

  def __repr__(self):
return "%s" % self.username

  class META:
replaces_module = 'auth.users'

Then I created a model using the auth.User in a ManyToManyField:

class SubProject(meta.Model):
  project= meta.ForeignKey(Project)
  subproject = meta.CharField(maxlength = 12, help_text = 'Short name')
  name   = meta.CharField(maxlength = 40, help_text = 'Full name')
  manager= meta.ForeignKey(auth.User, verbose_name = 'manager',
 limit_choices_to = { 'primary_group__id__exact' : '3'
},
 help_text = 'Subproject manager')
  state  = meta.ForeignKey(ProjectState, default = 'Open',
 verbose_name = 'state')
  type   = meta.ForeignKey(SubProjectType, verbose_name = 'type')
  members= meta.ManyToManyField(auth.User,
 verbose_name = 'members', related_name = 'username',
 filter_interface = meta.HORIZONTAL)

  def __repr__(self):
return "%s" % self.subproject

The admin seems to work fine for both objects.
However, when I play with the objects it looks really strange:

Python 2.3.4 (#1, Feb  7 2005, 15:50:45)
[GCC 3.3.4 (pre 3.3.5 20040809)] on linux2
>>> from django.models.ttime import *
>>> auth.users.get_list()
[admin, anders, fredrik, jocke, madde, martin, mattias, nils, pia,
stava, uffe]
>>> for sp in subprojects.get_list(id__in = [1,2,3]):
...   sp.get_user_list()
...
[2005-10-27 00:00:00, 2005-10-27 00:00:00, 2005-10-27 00:00:00]
[2005-10-27 00:00:00, 2005-10-27 00:00:00, 2005-10-27 00:00:00,
2005-10-27 00:00:00, 2005-10-27 00:00:00, 2005-10-27 00:00:00]
[2005-10-27 00:00:00, 2005-10-27 00:00:00, 2005-10-27 00:00:00]

A "mysql> select * from auth_users;" reveals that it's either the
date_joined, or last_login field that is displayed.

What gives? Anyone seen this strange behaviour?

/LarS



Custom Manipulator Save

2005-10-27 Thread Brant Harris

I can't seem to figure out how to rig my custom manipulator to save on
an object.  It keeps telling me:  AttributeError: 'Document' object
has no attribute 'id'
when it saves.

I'm confusored.


getting id of logged user in admin site

2005-10-27 Thread Flavio Curella

hi all, I've this model:

from django.core import meta
from django.models.auth import User

class Article(meta.Model):
title = meta.CharField(maxlength=255)
content = meta.TextField()
author = meta.ForeignKey(User) // problem is here, I think
categories = meta.ManyToManyField(Category)
creation_date = meta.DateTimeField('creation date', auto_now_add=True)
mod_date = meta.DateTimeField('modification date', auto_now=True)
file = meta.FileField(upload_to='/Users/go/Sites/django/files/')

class META:
admin = meta.Admin(
fields = (
(None, {'fields': ('title', 'content', 
'categories')
}),
),
)

How can I save the field 'author' with the id of current user? I think
to use 'default' attribute, something like this:
author = meta.ForeignKey(User, default=???)
but how can I get current uesre's id? (user.id doesn't work)

Thanks,
Flavio Curella



Re: meta.OneToOneField() problemo

2005-10-27 Thread Ian Maurer

Adrian,

http://code.djangoproject.com/ticket/527

Any progress with this issue? I am going to try and dig through the
code myself this weekend but I wanted to make sure I wasn't repeating
any effort. Also, let me know if there are any tips or ideas on where
to start obviously meta/__init__.py is probably a good place ;).

thanks-
Ian

On 9/19/05, Adrian Holovaty <[EMAIL PROTECTED]> wrote:
>
> On 9/19/05, Ian Maurer <[EMAIL PROTECTED]> wrote:
> > But, I have a multitude of problems that I don't believe I had before
> > the recent model overhaul. Here are some example things I tried doing
> > with my Waiter class that I believe should work:
>
> Hey Ian,
>
> It'd be a huge help if you could add some unit tests to
> tests/testapp/models/one_to_one.py and post them back to the list.
>
> Adrian
>
> --
> Adrian Holovaty
> holovaty.com | djangoproject.com | chicagocrime.org
>


Re: create object

2005-10-27 Thread Grigory Fateyev

Hello Grigory Fateyev!
On Thu, 27 Oct 2005 19:43:45 +0400 you wrote:

> 
> Hello!
> 
> http://django.pastebin.com/407800 
> 
> Somebody can explane why this app could not create object? Any advice
> ...
> 
Problem was fixed!

-- 
Всего наилучшего!
greg [at] anastasia [dot] ru Григорий.


create object

2005-10-27 Thread Grigory Fateyev

Hello!

http://django.pastebin.com/407800 

Somebody can explane why this app could not create object? Any advice
...

-- 
Всего наилучшего!
greg [at] anastasia [dot] ru Григорий.


'Site administration' heading in django admin interface

2005-10-27 Thread Emanuele

Hi,
I'm using django automatic admin interface as (only) web-interface for
a little application already in production/testing [*]. I customized a
bit the main admin page using "django-admin.py adminindex" output but
I'm not able to remove the heading "Site administration" on top of it
because it is embedded in django code,
contrib/admin/views/main.py :
...
def index(request):
return render_to_response('admin/index', {'title': 'Site
administration'}, context_instance=Context
...

I don't like touching django code code for now, so is it possible to
remove or customize that heading from user side?

Thanks,

Emanuele

[*]: I hope to release it freely soon, just as an example of django
capabilities for newbies like me. Stay tuned.



Openings for WebFOCUS, Cold Fusion, or Microsoft .NET developer

2005-10-27 Thread mandar

Title of Services: WebFOCUS, Cold Fusion, or Microsoft .NET developer

Location of Services: Omaha

Description of Services:
WebFOCUS, Cold Fusion or Microsoft .NET developer support- in IT
Transportation Rapid Application Development area. The RAD team
provides customers with development resources that are focused to
deliver functionality, value and benefits quickly and at a low cost.
The RAD methodology incorporates joint customer/developer application
requirements planning, design, development and an iterative delivery
approach that ensures customer involvement, satisfaction and sign-off.
This position will support Crew Management Services (CMS) -- a
challenging, fast-paced operational environment where customer
expectations are high, there is a constant sense of urgency, and
requirements can change daily. Team members must be adaptive, outgoing
and decisive ? willing to take initiative and solve problems. Equally
important is a positive attitude, the use of good judgement, and a
world-class customer service approach to project management. This is
expected to be a minimum 6 month engagement with potential for employee
conversion to develop real-time, web-based reports and graphics for the
CMS department as well as perform on-going maintenance and support for
the HEAT Ticketing system.

Skills/Experience:
REQUIRED: SQL Server , Microsoft Access , Web report development , HTML
, JavaScript , Windows 2000 Server , Experience/Knowledge in
Application Development, System Analysis/Design , Eligible to work in
the US permanently without sponsorship (for right to hire). DESIRED:
Transact SQL , WebFOCUS , Cold Fusion , PL/SQL , .NET

Anticipated Start Date: 11/01/2005

Duration of Assignment/Completion Date: 6-12 months with right to hire

Travel Required: NO

Right to Hire: YES 6 months

IF INTERESTED PL FORWARD YOUR RESUME TO [EMAIL PROTECTED]



Re: Models over views?

2005-10-27 Thread [EMAIL PROTECTED]

Nevermind.  It occurred to me yesterday to use a OneToOneField, so
there's no ID required:

create view tags_sortedtags as select tag_id, count(*) as cnt from
tags_articles_tags group by tag_id;

class SortedTag(meta.Model):
tag = meta.OneToOneField(Tag)
cnt = meta.PositiveSmallIntegerField()

and that works perfectly.

duh.

--B