Re: Help me understand the error of my ways...

2007-09-07 Thread Atendo

Still fuzzy to me. :)  Alas... thanks for your help anyway!

I did end up using a different approach and have been successful (so
far) with it.  I've put all my widgets under the same "main" app and
used block tags instead. That seems to be working out well for my
purposes.  It still bugs me that I had to resort to a different method
rather than figuring out the other way, but at least now I'm making
progress.

Now my big battle is getting slugs and urls to work... but I think my
brainpower is on the down curve tonight so I'm going to get some sleep
and look at that with fresh eyes tomorrow.


--~--~-~--~~~---~--~~
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 validate not blank field?

2007-09-07 Thread [EMAIL PROTECTED]

in django-tagging, i found:
class Tag(models.Model):
"""
A basic tag.
"""
name = models.CharField(max_length=50, unique=True, db_index=True,
validator_list=[isTag])

objects = TagManager()

content from validator.py:

def isTag(field_data, all_data):
"""
Validates that ``field_data`` is a valid tag name.
"""
if field_data is not None:
field_data = smart_unicode(field_data)
if not tag_re.match(field_data):
raise ValidationError(u'Tag names must contain only unicode
alphanumeric characters, numbers, underscores or hyphens.')


but this did not work for me.

On 9月8日, 上午9时21分, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> i used this:
> def isBlank(field,all_data):
> if field_data is None:
> raise ValidattionError(u'Cannot be Blank.')
>
> it not work for me.
> should i use if field_data is Blank?
>
> do someone know how to raise a error when the fields is blank? thx


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



Re: Help me understand the error of my ways...

2007-09-07 Thread jake elliott

hi atendo -

i think you may have some misunderstandings about what template context
is and what it's doing here.

maybe another look at this page:
http://www.djangoproject.com/documentation/templates_python/#basics

will help clear this up for you.

best,
jake

Atendo wrote:
> I think I see what you are getting at.  In my views.py, I was able to
> define my context which is why it worked when I initially tried
> mapping the app to the URL.  But in the template tag, the context is
> not defined.  Thing is, how do you define the context in the template
> tag?
> 
> 
> > 
> 


--~--~-~--~~~---~--~~
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: alter FreeComment date/time?

2007-09-07 Thread Drasty

Sweet! Thanks!

On Sep 7, 9:45 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On 9/7/07, Drasty <[EMAIL PROTECTED]> wrote:
>
> > Unless there's some way to override this without actually tweaking the
> > source code?
>
> http://www.djangoproject.com/documentation/db-api/#raw-saves
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."


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



Re: alter FreeComment date/time?

2007-09-07 Thread James Bennett

On 9/7/07, Drasty <[EMAIL PROTECTED]> wrote:
> Unless there's some way to override this without actually tweaking the
> source code?

http://www.djangoproject.com/documentation/db-api/#raw-saves


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

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



Re: alter FreeComment date/time?

2007-09-07 Thread Drasty

Well. I should've just looked at the code before asking! submit_date
has auto_now_add=True. Looks like I'll be adding comments outside the
Admin!

Unless there's some way to override this without actually tweaking the
source code?

On Sep 7, 9:26 pm, Drasty <[EMAIL PROTECTED]> wrote:
> I'm in the process of "re-creating" a series of blog posts & comments
> in a new Django project. I can't seem to be able to adjust the "Date/
> time submitted" field in the Admin interface. Is this a bug, can't you
> do this, or is there a specific technique to use?


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



alter FreeComment date/time?

2007-09-07 Thread Drasty

I'm in the process of "re-creating" a series of blog posts & comments
in a new Django project. I can't seem to be able to adjust the "Date/
time submitted" field in the Admin interface. Is this a bug, can't you
do this, or is there a specific technique to use?


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



how to validate not blank field?

2007-09-07 Thread [EMAIL PROTECTED]

i used this:
def isBlank(field,all_data):
if field_data is None:
raise ValidattionError(u'Cannot be Blank.')

it not work for me.
should i use if field_data is Blank?

do someone know how to raise a error when the fields is blank? thx


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



Re: Help me understand the error of my ways...

2007-09-07 Thread Atendo

I think I see what you are getting at.  In my views.py, I was able to
define my context which is why it worked when I initially tried
mapping the app to the URL.  But in the template tag, the context is
not defined.  Thing is, how do you define the context in the template
tag?


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



Re: Django Book

2007-09-07 Thread James Bennett

On 9/7/07, Griffin Caprio <[EMAIL PROTECTED]> wrote:
> This may have been answered already, but I couldn't find it.

Which is strange, because this thread comes up if you go to the Google
Groups page and search for "djangobook status":

http://groups.google.com/group/django-users/browse_frm/thread/31a8e3e113b478b3/abc0d7b939f56d56?lnk=gst=djangobook+status=1#abc0d7b939f56d56



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

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



Form field value

2007-09-07 Thread Oleg Korsak
Hello. I have:

def save_profile(request):

if request.user.is_authenticated():
if request.method == 'POST':
try:
profile_obj = 
Profile.objects.get(user__exact=request.user)
ProfileForm = 
forms.form_for_instance(profile_obj,
fields=('regnum','pvnnum','jaddress','paddress','bank','swift','account','contactperson','phone','mail','url'))
profile_form = ProfileForm(request.POST)
except Profile.DoesNotExist:
ProfileForm = forms.form_for_model(Profile)
profile_form = ProfileForm()
# how to do THIS?: profile_form['user'] = 
request.user

if profile_form.is_valid():
profile_form.save()
return profile(request)
return HttpResponseRedirect('/')


-
how can I modify a field value in the form? I know it's name('user'),
but I can't figure out how to do it... thanks



signature.asc
Description: OpenPGP digital signature


Re: newforms: message "this field is required" although required=False

2007-09-07 Thread olivier

Hi,

> widget=forms.Select(attrs={'class': 'vSelectField'}))

This let me think you use a javascript validator. Are you sure the
message comes from the server ?
You should try  form.is_valid() or whatever.


> just printed "form.is_bound" in my view: the result is "True",
> although I didn´t invoke the Form with any data.

Yes, you bound it with 'data', even if it is None.
You may want to do stuff like :
if data is None:
forms.Form.__init(self, auto_id = auto_id)
else:
forms.Form.__init(self, data, auto_id)

But I'm not sure anyway that forms.Form.__init__(self, ...) is the
right way to do it.


Regards,

 Olivier


--~--~-~--~~~---~--~~
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: ANN: Making some changes to djangoproject.com

2007-09-07 Thread Tim Chase

>> These changes are in preparation of some exciting news, but I'll leave
>> y'all in suspense until next week.
> 
> You're rewriting Django in Java! Finally, enterprise capability!

I thought it was one of the following:

- adding "2.0" to the official name to make it a "Web 2.0"
buzzword-compliant technology... "Django 2.0, now with more AJAXy
goodness for your RESTful/SOAPy SaaS!  Paradigm!  Synergy!"

- the addition of Cobol data-stores and hierarchical databases

- support for SilverLight

- Django has been ported from Python to PostScript and can now
run on any PostScript compatible printer with minimal syntax changes

- a complete reimplementation of Emacs in Django

- a complete reimplementation of Django in Emacs

- ability to use use Prolog as your backing fact database

Any other guesses? :)

TGIF...

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Adsense Absolute Information :AAi Groups

2007-09-07 Thread Suntwu Suntzu

Adsense Absolute Information :AAi Groups

http://groups.google.com/group/aaigroup

For your vision in google adsense. How to make money with adsense. How
to create web to create page impression. How to earning money easy.
For article, technique, thinking in adsense, seo, free downlaod, free
stuff.

http://www.adsenseclever.com   for article, News, technique.


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



full-text search and mediawiki markup apps

2007-09-07 Thread David Cramer

I've taken the time to upload both our SphinxSearch layer, and our
MediaWiki markup util to Google code today. For more info see my blog
post: http://www.davidcramer.net/code/54/mediawiki-markup-and-sphinxsearch-...

I haven't used Google code before, so if theres any problems just let
me know.

Enjoy.


--~--~-~--~~~---~--~~
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: Using multiples version of Django on the same server

2007-09-07 Thread Tim Chase

> I'm setting up a new server to host my Django projects and they don't
> each use the same version of Django (0.95, 0.96 and svn). Is their a
> way to configure each virtualhost to use their own version of Django ?


I've done something like this whereby I had several of the
development branches and the .96 branch all in their own
subdirectory.  For each virtual-host, I had it add the correct
path to the PythonPath, a'la

  PythonPath "['/var/www/django/', '/usr/local/django/0.95/'] +
sys.path"

where /var/www/django/ is my project directory and
/usr/local/django/{branch}/ is the particular Django branch you
want (your .95, .96 or svn)

If done properly, you can have one as the default, omitting the
2nd list-item to be appended, and only append that particular
list item for the non-standard projects.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ANN: Making some changes to djangoproject.com

2007-09-07 Thread ToddG

> These changes are in preparation of some exciting news, but I'll leave
> y'all in suspense until next week.

You're rewriting Django in Java! Finally, enterprise capability!


--~--~-~--~~~---~--~~
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: Using multiples version of Django on the same server

2007-09-07 Thread Andrey Khavryuchenko


 FS> I'm setting up a new server to host my Django projects and they don't
 FS> each use the same version of Django (0.95, 0.96 and svn). Is their a
 FS> way to configure each virtualhost to use their own version of Django ?

Put each version in it's own directory (say, django-0.95 and django-0.96)
and use PYTHONPATH to point each virtualhost's mod_python to the correct
version. 

-- 
Andrey V Khavryuchenko
Development - http://www.kds.com.ua 

--~--~-~--~~~---~--~~
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: ANN: Making some changes to djangoproject.com

2007-09-07 Thread Jacob Kaplan-Moss

On 9/7/07, ToddG <[EMAIL PROTECTED]> wrote:
> You're rewriting Django in Java! Finally, enterprise capability!

Dammit, that news wasn't supposed to leak! Who told you!?

Jacob

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



Using multiples version of Django on the same server

2007-09-07 Thread Fabien Schwob

Hello,

I'm setting up a new server to host my Django projects and they don't
each use the same version of Django (0.95, 0.96 and svn). Is their a
way to configure each virtualhost to use their own version of Django ?

Thanks

-- 
Fabien SCHWOB

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



Re: Help me understand the error of my ways...

2007-09-07 Thread jake elliott

hi atendo,

Atendo wrote:
> If I do that, I get this error:
> 
> 
> KeyError at /
> 'link'
> Request Method:   GET
> Request URL:  http://localhost:8080/
> Exception Type:   KeyError
> Exception Value:  'link'
> 

this KeyError is coming from your line:


context['link']


when 'link' isn't actually part of the template's context (and therefore
not a valid key to the dictionary-like object 'context').  if you'd like
to more-or-less silently ignore this error for now you can use instead


context.get('link')


which will return None if link isn't part of the context.

best,
jake

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



Re: Django Book

2007-09-07 Thread Jacob Kaplan-Moss

On 9/7/07, Griffin Caprio <[EMAIL PROTECTED]> wrote:
> This may have been answered already, but I couldn't find it.  What's
> the status of www.djangobook.com?  The last update is dated Jan 24
> 2007 and two chapters are still TBA.  Has the book been abandoned ?

No, we're finishing up the book for publication, which'll happen just
as soon as possible.

> There is a Django book coming from APress (http://www.amazon.com/
> Definitive-Guide-Django-Development-Right/dp/1590597257/ ) and one of
> the authors is a developer for django.  Is this the print incarnation
> of the site?

Yup.

Jacob

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



ANN: Making some changes to djangoproject.com

2007-09-07 Thread Jacob Kaplan-Moss

Howdy folks --

A quick announcement:

I'm going to be making some changes to djangoproject.com over the next
week or so.

The first of those changes are done and don't appear to have broken
anything, but if you notice anything busted, please send me an email
([EMAIL PROTECTED]).

These changes are in preparation of some exciting news, but I'll leave
y'all in suspense until next week.

Jacob

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



Re: Help me understand the error of my ways...

2007-09-07 Thread Atendo

If I do that, I get this error:


KeyError at /
'link'
Request Method: GET
Request URL:http://localhost:8080/
Exception Type: KeyError
Exception Value:'link'



--~--~-~--~~~---~--~~
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: Form field deletion

2007-09-07 Thread Mark Green

On Fri, Sep 07, 2007 at 03:24:46PM -0500, jake elliott wrote:
> 
> Oleg Korsak wrote:
> >> Sure - use the 'fields' option to specify the subset of model fields
> >> you want to use on the form.
> >>
> >   form_for_instance() got an unexpected keyword argument 'fields'
> > 
> 
> this argument to form_for_instance() and form_for_model() is only
> available in the SVN version of django.
> 
> one quick way to get this behavior without that argument is to set the
> 'user' field 'editable=False'
> 
> user = models.ForeignKey(User, editable=False)
> 
> remember this will affect the change form in contrib.admin also, which
> may or may not be desirable for your project.
> 
> -jake

i have a related question, is there a way to change the
order of the fields, too?

my form adds a second password field like this:


class JoinForm(forms.BaseForm):
def __init__(self, *args, **kwargs):
self.base_fields['pw2'] = forms.CharField( label = 'again', min_length 
= 3 )
self.base_fields['pw2'].widget = forms.PasswordInput()


unfortunately this new field always appears at the end
of my form and fields=(..) doesn't affect the order.


-mark


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



Project level tags - again

2007-09-07 Thread arelenas

How to make project level tags?

I've already read post 
http://groups.google.com/group/django-users/browse_thread/thread/49e9669c64e353b2/
and tried what Ivan Sagalaev suggested but I've got
TemplateSyntaxError - "common_tags' is not a valid tag library.

What could be the problem?

There is Ticket #2539 (Custom tags and filters can be restricted by
namespace) at code.djangoproject.com but I'm not quite sure if it is
related to this.

Can anybody help me?

Petar


--~--~-~--~~~---~--~~
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: Form field deletion

2007-09-07 Thread jake elliott

Oleg Korsak wrote:
>> Sure - use the 'fields' option to specify the subset of model fields
>> you want to use on the form.
>>
>   form_for_instance() got an unexpected keyword argument 'fields'
> 

this argument to form_for_instance() and form_for_model() is only
available in the SVN version of django.

one quick way to get this behavior without that argument is to set the
'user' field 'editable=False'

user = models.ForeignKey(User, editable=False)

remember this will affect the change form in contrib.admin also, which
may or may not be desirable for your project.

-jake

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



Re: Help me understand the error of my ways...

2007-09-07 Thread jake elliott

hi atendo,

Atendo wrote:
> And then in the homepage index.html I've got this:
> 
> {% load industry_widget %}
> 

sorry if i miss the mark here but are you actually invoking the
templatetag you've loaded anywhere in your template?  ie:


{% load industry_widget %}

{% industry_widget %}


here you happen to have named your templatetag module and your inclusion
tag the same thing, but they are separate entities.

-jake

--~--~-~--~~~---~--~~
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: Form field deletion

2007-09-07 Thread Oleg Korsak


Russell Keith-Magee пишет:
> On 9/7/07, Oleg Korsak <[EMAIL PROTECTED]> wrote:
> 
>> I just want to create form_for_model and/or form_for_instance  and then
>> delete one field (user). Is it possible or do I need to manually create my
>> own form?
> 
> Sure - use the 'fields' option to specify the subset of model fields
> you want to use on the form.
> 

Traceback (most recent call last):
File "/usr/lib64/python2.5/site-packages/django/core/handlers/base.py"
in get_response
  77. response = callback(request, *callback_args, **callback_kwargs)
File "/var/www/localhost/rebus/../rebus/tours/views.py" in profile
  41. ProfileForm = forms.form_for_instance(user_profile, fields=('pvnnum'))

  TypeError at /profile/
  form_for_instance() got an unexpected keyword argument 'fields'



signature.asc
Description: OpenPGP digital signature


Help me understand the error of my ways...

2007-09-07 Thread Atendo

I'm quite new to Python and Django so please bear with me as I'm more
of an HTML coder/designer by trade.  I'm trying to do something that
to me seems simple but apparently isn't.

Basically, I have 2 separate "apps" which are really just widgets for
a homepage that contain a link and text that I can manage from the
Django admin. (When I figure out how to do this simple step, I'll be
adding more complexity to my widgets).

In my urls.py I have the following to define the homepage:


urlpatterns = patterns('django.views.generic.simple',
(r'^$', 'direct_to_template', {'template':
'index.html'}),
)


Then, I tried making inclusion tags for each app to pull into the
homepage.  Lets look at one of the apps called Industry... here is the
model.py:


from django.db import models

class Industry(models.Model):
title = models.CharField(maxlength=200)
link = models.CharField(maxlength=200)
pub_date = models.DateTimeField('Date published')
class Admin:
pass
list_display = ('title','link')


And this is the views.py...


from django.template import Context, loader
from wg.industry.models import Industry
from django.http import HttpResponse


def index(request):
latest_industry_widget = Industry.objects.all().order_by('-
pub_date')[:1]
t = loader.get_template('industry/index.html')
c = Context({
'latest_industry_widget': latest_industry_widget,
})
return HttpResponse(t.render(c))


When I map the app directly to the homepage from urls.py, I can pull
in the data just fine using block tags.  But that's not what I'm
trying to do since I want to pull multiple apps into the homepage.  So
instead I'm trying to make inclusion tags.

I made a templatetags directory in the app directory and put in the
__init__.py and industry_widget.py files as specified by the Django
documentation.  This is what industry_widget.py looks like:


from django import template

register = template.Library()

def industry_widget(context):
return {
'link': context['link'],
'title': context['title'],
}

register.inclusion_tag('industry/widget.html', takes_context=True)
(industry_widget)


My industry/widget.html file looks like this:


Jump directly to {{ title }}.


And then in the homepage index.html I've got this:


{% load industry_widget %}


Yet nothing happens.  What am I doing wrong?  Any help would be
greatly appreciated as my head can only take so many beatings against
my desk before I'll need to see a doctor. ;)


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



Django Book

2007-09-07 Thread Griffin Caprio

This may have been answered already, but I couldn't find it.  What's  
the status of www.djangobook.com?  The last update is dated Jan 24  
2007 and two chapters are still TBA.  Has the book been abandoned ?

There is a Django book coming from APress (http://www.amazon.com/ 
Definitive-Guide-Django-Development-Right/dp/1590597257/ ) and one of  
the authors is a developer for django.  Is this the print incarnation  
of the site?

Thanks,
Griffin 

--~--~-~--~~~---~--~~
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: error: unsupported locale setting on windows machine

2007-09-07 Thread Subrat

This issue has been fixed.

On Sep 6, 11:40 am, Subrat <[EMAIL PROTECTED]> wrote:
> I am currently building an app in windows machine which was already
> built in unix machine. While running 'syncdb' command, I am getting
> error 'unsupported locale setting'.
>
> >>> import locale
> >>> locale.setlocale(locale.LC_ALL, '')
> >> 'English_United States.1252'
>
> When I run this it returns error.
>
> >>> locale.setlocale(locale.LC_ALL, "en_US")
>
> An Error is raised: "unsupported locale setting" (lib/locale.py in
> setlocale, line 476).
>
> Dose anyone know how to fix this issue?


--~--~-~--~~~---~--~~
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: data manipulation in templates or views?

2007-09-07 Thread RajeshD

> I hope I am not inviting a quasi-religious war
> on this issue, but I am wonder if people could provide some insight on
> when or why I should do this sort of thing within the template (via
> template tag or not) or if I should continue doing that within the
> view, which not only currently makes sense to me, but I think is what
> the official documentation suggests.

In real life, not all applications are created equal. Think about
categorizing your "data manipulation" needs:

- manipulations involving DB updates, traversing relations,
incremental query set build-up, and generally complex work. I would
most definitely not do these in a template.

- manipulations that don't make DB updates: translation of a field's
value to a different language, simple excel like calculations,
conversion of a queryset value to a logged-in user's currency, and
other "lightweight" work. These could be done either in a view or in a
template using custom templatetags. Generally, you can make a case for
a templatetag if you are going to be able to use it in several
independent templates (say, a currency conversion tag.) If your
manipulation consists of transforming a field purely for the sake of
rendering it on screen, consider doing it in a template.

There is no single correct answer to this. But there's usually a
natural way to make this decision for every individual case; a
solution that "feels" elegant (not-hackish), simplest, and most
maintanable. If in doubt, post a specific usecase here and get some
recommendations on what would be best.


--~--~-~--~~~---~--~~
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: newforms: message "this field is required" although required=False

2007-09-07 Thread patrickk

just printed "form.is_bound" in my view: the result is "True",
although I didn´t invoke the Form with any data.

btw: I´m using the current SVN-version and did an update last week
(before the update it worked).

any help with this?

thanks,
patrick

On 7 Sep., 16:53, patrickk <[EMAIL PROTECTED]> wrote:
> I´m creating a dynamic newform and when going to the page, I´m getting
> an error-message "This Field is required", although required ist set
> to False when building the Form.
>
> Here´s part of the code:
>
> field_list = []
> date = forms.ChoiceField(label='Wann', required=False,
> choices=date_choices_list, widget=forms.Select(attrs={'class':
> 'vSelectField'}))
> field_list.append(('Datum', date))
> ...
> form = CinemaFormDynamic(field_list=field_list)
>
> class CinemaFormDynamic(forms.Form):
> def __init__(self, data=None, auto_id=False, field_list=[]):
> forms.Form.__init__(self, data, auto_id)
> for field in field_list:
> self.fields[field[0]] = field[1]
>
> thanks,
> patrick


--~--~-~--~~~---~--~~
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: data manipulation in templates or views?

2007-09-07 Thread Alex Koshelev

Templates just represents data to the client, all calculations must by
in views or model methods


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



http://islam-town.miniville.fr

2007-09-07 Thread Ussop

Visit my city in http://islam-town.miniville.fr

It's a good game, try it by yourself :)

Thanks


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



data manipulation in templates or views?

2007-09-07 Thread r_f_d

I have been looking at many of the posts in here in recent weeks and
wanted to ask any djangurus out there a question to clear up some
confusion I have.  Should I do data manipulation in my views or in
templates.  After reading much of the django documentation and working
with the framework for the last 18 months or so, I have been doing all
of my data manipulation within my views, and using the templates
simply for formatting the presentation of the data.  Many people have
been asking about how to modify the data within the template, i.e. a
recent post asking about excel calculations within a template.  I do
not do any of this in my template, I actually have the need to display
statistics regarding some data in an app I am writing, but I do all of
the calculations within my view and pass the computed values to my
template for display.  I hope I am not inviting a quasi-religious war
on this issue, but I am wonder if people could provide some insight on
when or why I should do this sort of thing within the template (via
template tag or not) or if I should continue doing that within the
view, which not only currently makes sense to me, but I think is what
the official documentation suggests.


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



Re: User Administration

2007-09-07 Thread RajeshD

>
> please have a method to add one user to a specific group?

Try this:

grp = Group.objects.get(name='registered')
us.groups.add(grp)


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



newforms: message "this field is required" although required=False

2007-09-07 Thread patrickk

I´m creating a dynamic newform and when going to the page, I´m getting
an error-message "This Field is required", although required ist set
to False when building the Form.

Here´s part of the code:

field_list = []
date = forms.ChoiceField(label='Wann', required=False,
choices=date_choices_list, widget=forms.Select(attrs={'class':
'vSelectField'}))
field_list.append(('Datum', date))
...
form = CinemaFormDynamic(field_list=field_list)


class CinemaFormDynamic(forms.Form):
def __init__(self, data=None, auto_id=False, field_list=[]):
forms.Form.__init__(self, data, auto_id)
for field in field_list:
self.fields[field[0]] = field[1]


thanks,
patrick


--~--~-~--~~~---~--~~
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: hidden fields

2007-09-07 Thread RajeshD



On Sep 7, 9:55 am, Ana <[EMAIL PROTECTED]> wrote:
> Hi,
> I'd like to have  "last modified by" and "owner" fields in my
> application. I'd like to set fields value automatically, and I want
> those  fields to be hidden. Is there any way I can do that?

Yes.

Here's one way to do it:

Add those two fields to your model and set editable=False on them so
they don't show in the Admin.

Override your model's save method and set "last modified by" to
current time i.e. datetime.datetime.now(). Also set the owner to the
request user. Here's an article on how to get request.user using a
custom middleware:

http://lukeplant.me.uk/blog.php?id=1107301634



--~--~-~--~~~---~--~~
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: Unicode problem when rendering a template

2007-09-07 Thread Tipan



On Sep 5, 9:28 pm, wolfds <[EMAIL PROTECTED]> wrote:
> Can we see the model definition for Reward?

Just got back to this and realised I was being a dummy. Whilst I had
changed all the def's to unicode, I'd still left some str() functions
on the return. Changed these to smart_unicode() and the problem was
solved.

Lesson learnt - read the notes carefully first!


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



hidden fields

2007-09-07 Thread Ana

Hi,
I'd like to have  "last modified by" and "owner" fields in my
application. I'd like to set fields value automatically, and I want
those  fields to be hidden. Is there any way I can do that?
Thanks in advance,
Ana


--~--~-~--~~~---~--~~
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: putting a link in a multiplechoice checkbox field in new forms

2007-09-07 Thread Kenneth Gonsalves


On 07-Sep-07, at 4:43 PM, Kenneth Gonsalves wrote:

>
>   checkbox  itemname
>
> I tried to format this in the view itself - but didnt get a link -
> just got the literal string above. Any ideas?

solved - just broke up the form and made the template by hand

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



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



Django Contract Work Available

2007-09-07 Thread [EMAIL PROTECTED]

Overview:
Currently looking for a python/django developer for contract work on a
web API and web-based account management system.

Project Details:
The project will consist of two main parts: a web API responsible for
account registration and web interface responsible for managing
account data. The web API work will involve implementing a pre-defined
set of protocols used by 3rd party sites to open and register a new
account. The management system will be a secure web interface to allow
clients to login and view/edit/delete account details. The work is to
be done in python using the django framework and interface with a
postgres database all in a FreeBSD environment.

Required Experience:
The candidate must be higly proficient in the following:
Web Technologies (HTML, JS, CSS)
Python
Django
PostregSQL

Position immediately available independent of location. Further
contract work possibly available upon successful completion of this
project.

Please send CV to the following address if interested:
[EMAIL PROTECTED]
www.bluemetrix.com


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



Re: hai am new one to django

2007-09-07 Thread Jon Atkinson

The mod_python documentation will help you:

http://www.modpython.org/live/current/doc-html/installation.html

And there is a very helpful mod_python mailing list you can subscribe
to and ask any questions you may have:

http://modpython.org/pipermail/mod_python/

Good luck!

--Jon

On 9/7/07, Damodhar <[EMAIL PROTECTED]> wrote:
>
> Hai ,
>
> I,read the django documentation , am very interest to learn django. so
> iwant to confiugure Apache (mod_python), But i don't know how to
> configure. now am working in php mysql.using XAMPP (http://
> www.apachefriends.org/en/xampp-windows.html)
> (PHP + Mysql + Apache) as a server installed in my local machine.
>
> How to configure Apache mod_python into my apache. if any thing want
> to install patch or any extra files to apache or change any lines to
> enabled the mod_python or add any lines in config files or any other
> files which line i want to edit
>
> please help me ( I am very interest to learn )
>
> Thanks
>
>
>
> >
>

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



User Administration

2007-09-07 Thread cingusoft

hi guys

my question is:
in my application i have a views with a method to insert a new user.
the form sebd the informations and i register the user with:

us=User.objects.create_user(new_data['username'],
 new_data['email'],
 new_data['password'])

this method return an User object, and i want to add a group to this
object

i have utilized
us.groups.add('registered') #with the group name
but fails
grp=Group.objects.filter(name='registered').values() #get the group
us.groups.add(grp['id']) #with the group name
but fails

please have a method to add one user to a specific group?
i have readed the documentation but i dont view a response to my
question
thanks


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



Re: FORMS help needed

2007-09-07 Thread AniNair

Thank you a lot. That was just what I wanted to know: about the url
conf for get function. Thank you.. thank you... And is it similar in
post?
Once again, thank you a lot.


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



Re: hai am new one to django

2007-09-07 Thread Damodhar

Hai ,

I,read the django documentation , am very interest to learn django. so
iwant to confiugure Apache (mod_python), But i don't know how to
configure. now am working in php mysql.using XAMPP (http://
www.apachefriends.org/en/xampp-windows.html)
(PHP + Mysql + Apache) as a server installed in my local machine.

How to configure Apache mod_python into my apache. if any thing want
to install patch or any extra files to apache or change any lines to
enabled the mod_python or add any lines in config files or any other
files which line i want to edit

please help me ( I am very interest to learn )

Thanks



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



putting a link in a multiplechoice checkbox field in new forms

2007-09-07 Thread Kenneth Gonsalves

hi,

I have a multiplechoice field using multiplecheckbox widget. There is  
a form which has various action buttons for the selected items. In  
addition, I need to add a link to each of the selected items -  
something like 'details here ...' and clicking the link would take  
them to the details page for that item. The choices list has the id  
and name of each item. I need something like this:

  checkbox  itemname

I tried to format this in the view itself - but didnt get a link -  
just got the literal string above. Any ideas?
-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



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



login cookies problem[SESSION_COOKIE_DOMAIN]

2007-09-07 Thread beck917

Your username and password didn't match. Please try again.

{'username': ["Your Web browser doesn't appear to have cookies
enabled. Cookies are required for logging in."]}
-->This is the error message when I login,I had seen the
Django's document,then guess it's
SESSION_COOKIE_DOMAIN problem

I tried set SESSION_COOKIE_DOMAIN = 'www.mydomain.cn', or
SESSION_COOKIE_DOMAIN =
'demo.mydomain.cn',mydomain.cn,"127.0.0.1"&"localhost",but all failed

http://groups.google.com/group/django-users/browse_thread/thread/ccac3debb68d1957/4f5811b69714d164?lnk=gst=session_cookie_domain=8#4f5811b69714d164

This link's question is much like my question ,I also install PHP5 and
run wordpress,and in that discuss he disable php-mod,it works..
but I disable it ,it doesn't work.

thx~~


--~--~-~--~~~---~--~~
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: sporadic VariableDoesNotExist's...

2007-09-07 Thread Bram - Smartelectronix

Brian Morton wrote:
 > Also, do you have django.core.context_processors.request in your
 > context_processors?  It looks like you're trying to overwrite a dict
 > element that already exists.

# settings.py

TEMPLATE_CONTEXT_PROCESSORS = (
 'django.core.context_processors.auth',
 'django.core.context_processors.debug',
 'django.core.context_processors.i18n',
 'pysplice.splice.context_processors.context_vars',
)


# pysplice/splice/context_processors/context_vars.py

from django.conf import settings

def context_vars(request):
 return {'base_url': settings.BASE_URL,
 'media_url': settings.MEDIA_URL,
 'media_url2': settings.MEDIA_URL2,
 'gmap_key': settings.GOOGLE_API_KEY,
 'sidebar': None,
 'request': request}


And, I'm obviously using context_instance=RequestContext(request) where 
needed.

As said, the weird thing is that it SPORADICLY fails, not all the time. 
I.e. it only fails once every X views. Could this possibly have 
something to do with the anonymous user caching?


  - Bram

> 
> On Sep 6, 12:14 pm, Bram - Smartelectronix <[EMAIL PROTECTED]>
> wrote:
>> Hello Everyone,
>>
>> I have a request context which sets {'request':request}...
>>
>> On windows (dev-server) everything is fine and dandy, but on our live
>> site (splicemusic.com, Apache2 + mod_python) I see *sporadic*
>> appearances of:
>>
>> "VariableDoesNotExist: Failed lookup for key [request] in [{}]"
>>
>> Does anyone have any idea what this could mean? The strange part is that
>> the same page will sometimes trigger the error and sometimes... not!
>>
>>   - bram
> 
> 
> > 


--~--~-~--~~~---~--~~
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: FORMS help needed

2007-09-07 Thread o.elias

Hi!

Everything after the '?' in the url is post using the GET array. The
regular expression of yor url config ignores these parameters and
should simply be (r'^showuser/$)', show) to match on the url sent by
the form.

To get the GET-data sent by the form, use something like this:

def show(request):
user_id = request.GET['user_id']
...

Oliver

On Sep 7, 11:04 am, AniNair <[EMAIL PROTECTED]> wrote:
> Hi... Thanks alot for the reply, I am a bit confused with this since i
> have been trying to get an idea for the last few hours,. I went
> through the documentation,  Can u/anyone tell me how my urlconf should
> be like? I hav a simple text box with a submit button. I want to know
> how to get that value to my view. Sorry if this is so simple that I
> shouldn't have asked...


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

2007-09-07 Thread Matt Davies
I've fixed the problem

I had to pull /admin/base.html into my templates folder and add this line to
the head



IE6 browsers that have their default character set set to Latin1 can now add
utf8 characters, they could not before.

This line should be in the base.html within django source code fellas, there
is no earthly reason why not.

IE seems to be not picking up the deafult_charset for the form encoding in
the admin site, this simple line added would mean I can go back to using src
code.

Any chance of putting it in there someone?



On 07/09/07, vanderkerkoff <[EMAIL PROTECTED]> wrote:
>
>
> Has anyone experienced any problems with getting IE browsers to
> recognize that they should be using the default_charset when entering
> data into forms in the admin site?
>
> I'm having a hell of a time of it, all unicode, new trunk, front end
> running of lighttpd, all set to utf8, database utf8, no problems front
> end forms, I can see the default charset in the header, we've put it
> in the code and it works fine.
>
> I dont want to have to overrite the admin base template if I can help
> it, but that might be the only solution, to put a charset into that
> file to force IE to use utf8.
>
> Anyone else seen this before?
>
>
> >
>

--~--~-~--~~~---~--~~
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: using querysets to populate a form

2007-09-07 Thread David Reynolds


On 6 Sep 2007, at 9:21 pm, RajeshD wrote:

> You can always turn the queryset into a list and cache it with
> Django's caching framework. However, that doesn't solve the usability
> issue of a huge drop-down list. A few options:
>
> 1. Do what the Django raw_id_admin interface does (http://
> www.djangoproject.com/documentation/model-api/#many-to-one- 
> relationships).
> It uses a popup-window in which the user sees the set of available
> options (they could be paginated if it's a big list); clicking a row
> results in its pk being fed back to the parent field being selected.
>
> 2. ExtJS (and possible other Javascript) libraries provide fancy AJAX
> based interfaces that let you load a custom drop down list on demand
> as the user scrolls down.

I never actually mentioned it being a drop down, it's actually going  
to be checkboxes and also the actual dataset won't be that big. It'll  
be a distinct query on a huge set of data and I don't want that huge  
hit every time someone loads the form.

I think I'll go for the caching idea, as you suggested.

Thanks,

David

-- 
David Reynolds
[EMAIL PROTECTED]


-- 
David Reynolds
[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: FORMS help needed

2007-09-07 Thread AniNair


Hi... Thanks alot for the reply, I am a bit confused with this since i
have been trying to get an idea for the last few hours,. I went
through the documentation,  Can u/anyone tell me how my urlconf should
be like? I hav a simple text box with a submit button. I want to know
how to get that value to my view. Sorry if this is so simple that I
shouldn't have asked...


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

2007-09-07 Thread Nader

Indeed, the problem was that  both of the tables were defined in
database. It has been solved by deleting of Dataset.

Thank!

On Sep 6, 4:37 pm, Nis Jørgensen <[EMAIL PROTECTED]> wrote:
> Nader skrev:
>
> > I have used 'inspectdb' to produce the model, because I had a dump
> > mysql file. In Meta section of model I have defined the table name:
>
> > class Meta:
> > db_table = 'Dataset'
>
> > Besides If I check the application model with "python manage.py sqlall
> > dataset" I see the same  name which has been defined in Meta class.
>
> > BEGIN;
> > CREATE TABLE `Dataset`
>
> you may have both a table "Dataset" and a table "dataset":
>
> http://dev.mysql.com/doc/refman/4.1/en/identifier-case-sensitivity.html
>
> Nis Jorgensen
> No House IT


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



Excel-like functions in templates?

2007-09-07 Thread jj

I have a list of items and I define some way to rank them:

class Item:
name = models.CharField()
project = models.ManyToManyField(Project)

def score(year):
... some intensive computation + queries ...
return result

I'd like to display the items together with their score, and the mean
score and standard deviation:
Items  | 2007| 2006
item1  |2|2
item2  | 1.33| 3.92
...|  ...|  ...
Mean (dev) | 1.68 (0.73) | 3.33 (1.54)

I use a tag to compute the score and std deviation for a given year,
but this involves
{% get_score_stats item_list year as mean std_deviation %}

But this involves running the score query again for each item. Also, I
could want to compute other sorts of statistics and then quickly the
number of tags and queries grows up, which is bad.

What's the best way of doing this? Could I use Excel-like macros in
the template?

JJ.


--~--~-~--~~~---~--~~
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: i18n blocktrans

2007-09-07 Thread Katja Süss

Yes, sorry. Now I see.
{% blocktrans with value|filter as myvar %}
This will have {{ myvar }} inside.
{% endblocktrans %}
That makes sense, definitly.

Thanks a lot!
Katja

Malcolm Tredinnick schrieb:
> On Fri, 2007-09-07 at 00:07 -0700, ksuess wrote:
>> http://code.djangoproject.com/ticket/5073
>> Isn't it a typical use case that attributes of variables are used in
>> templates?
>> If this is not supported a view has to call a template like this
>> return render_to_response('polls/detail.html', {'object': p,
>> 'question': p.question,})
>> which is not very nice
>> What do you think?
> 
> As mentioned in the ticket resolution, you need to alias those lookups.
> The reason is that things like variable lookups need to be typed in
> exactly, without any change, by anybody translating that string. That is
> quite a burden on the translators and very error prone.
> 
> So we ask the template author to choose a single word alias instead of
> the long lookup form. You don't have to do it in the view, you do it as
> part of the blocktrans tag, as mentioned in the docs (referenced in the
> ticket).
> 
> Regards,
> Malcolm
> 



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



admin site form encoding

2007-09-07 Thread vanderkerkoff

Has anyone experienced any problems with getting IE browsers to
recognize that they should be using the default_charset when entering
data into forms in the admin site?

I'm having a hell of a time of it, all unicode, new trunk, front end
running of lighttpd, all set to utf8, database utf8, no problems front
end forms, I can see the default charset in the header, we've put it
in the code and it works fine.

I dont want to have to overrite the admin base template if I can help
it, but that might be the only solution, to put a charset into that
file to force IE to use utf8.

Anyone else seen this before?


--~--~-~--~~~---~--~~
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: i18n blocktrans

2007-09-07 Thread Malcolm Tredinnick

On Fri, 2007-09-07 at 00:07 -0700, ksuess wrote:
> http://code.djangoproject.com/ticket/5073
> Isn't it a typical use case that attributes of variables are used in
> templates?
> If this is not supported a view has to call a template like this
> return render_to_response('polls/detail.html', {'object': p,
> 'question': p.question,})
> which is not very nice
> What do you think?

As mentioned in the ticket resolution, you need to alias those lookups.
The reason is that things like variable lookups need to be typed in
exactly, without any change, by anybody translating that string. That is
quite a burden on the translators and very error prone.

So we ask the template author to choose a single word alias instead of
the long lookup form. You don't have to do it in the view, you do it as
part of the blocktrans tag, as mentioned in the docs (referenced in the
ticket).

Regards,
Malcolm

-- 
If you think nobody cares, try missing a couple of payments. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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: FORMS help needed

2007-09-07 Thread Boris Samorodov

On Thu, 06 Sep 2007 22:55:38 -0700 AniNair wrote:

>I am using django 0.97 pre with python 2.5.1. I have been trying to
> learn this but i am having trouble with forms. What I want is to
> submit data in one page and do calculations with it and return the
> result in other page. I managed to do it using cgi, but can anyone
> tell me how to get data in django? I should I use get_list_or_404()? I
> have my url conf as

> from django.conf.urls.defaults import *
> from dbp.users.views import show, get_id, showall

> urlpatterns = patterns('',
> (r'^users/', showall),(r'^showuser/([A-Za-z]+)', show),
> )

> The url on submitting is http://localhost:8000/showuser/?id_user=Ani
> I get a page not found error saying
> The current URL, showuser/, didn't match.
> please advice. Thanking you in advance

Seems that you may be interested at
http://www.djangoproject.com/documentation/tutorial03/ :

"Note that these regular expressions do not search GET and POST
parameters, or the domain name. For example, in a request to
http://www.example.com/myapp/, the URLconf will look for /myapp/. In a
request to http://www.example.com/myapp/?page=3, the URLconf will look
for /myapp/."


WBR
-- 
Boris Samorodov (bsam)
Research Engineer, http://www.ipt.ru Telephone & Internet SP
FreeBSD committer, http://www.FreeBSD.org The Power To Serve

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



i18n: Has anyone experienced that but too?

2007-09-07 Thread Julian

Hi there,

I opened a ticket yesterday, now I'm wondering about being alone with
that bug.

Please look here:

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

Thanks
Julian


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