Extra Column, change_list newforms view in admin. recursion issues....

2010-07-07 Thread hagan
I'm hoping somebody has run into this issue before, failing that,
perhaps someone can see a glaring mistake in my code.. I'm getting a
recursive loop somehow while following the example:

http://code.djangoproject.com/wiki/NewformsHOWTO#Q:HowdoIaddanextracolumntothechangelistview

In the __init__.py script, i've added None to the line with:
rl = list(admin_list.items_for_result(cl, res, None)) since
items_for_results fails without 3 args..  This is running on django
1.2 btw.


import admin_extras
from django import template

register = template.Library()

@register.inclusion_tag("admin/change_list_results.html")
def article_result_list(cl):
#{#{% url publish_view obj.id %}#}
additional_cols = (
{'text': 'Operations', 'sortable': False, 'template': 'Publish'},
)
return admin_extras.extended_result_list(cl, additional_cols)
# article_result_list = register.inclusion_tag("admin/
change_list_results.html")(article_result_list)




{% extends "admin/change_list.html" %}
{% load change_list_extras %}
{% block result_list %}{% article_result_list cl %}{% endblock %}




And the error i'm seeing:

In template /home/webby/www/localhost/wc-web/mediaItems/templates/
admin/change_list.html, error at line 76
Caught RuntimeError while rendering: maximum recursion depth exceeded
while calling a Python object
66  
67  {% endif %}
68  {% endblock %}
69  {% if cl.formset.errors %}
70  
71  {% blocktrans count cl.formset.errors|length as counter %}Please
correct the error below.{% plural %}Please correct the errors below.{%
endblocktrans %}
72  
73  {{ cl.formset.non_form_errors }}
74  {% endif %}
75  
76  {% block search %}{% search_form cl %}{% endblock %}
77  {% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}
78
79  {% block filters %}
80  {% if cl.has_filters %}
81  
82  {% trans 'Filter' %}
83  {% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{%
endfor %}
84  
85  {% endif %}
86  {% endblock %}

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



Re: i can't import newforms(newbie)

2010-06-08 Thread refreegrata
ok, thanks. Now I feel more relaxed.

On 8 jun, 15:50, Michael <newmani...@gmail.com> wrote:
> On Tue, Jun 8, 2010 at 3:46 PM, refreegrata <refreegr...@yahoo.com> wrote:
> > hello list
> > i'm a newbie with django trying to learn
> > Now i have a question
> > when i do
> > ---
> > from django import newforms as forms
> > 
> > django throw an exception : "Error was: cannot import name newforms"
>
> > But when i do
> > ---
> > from django import forms
> > ---
> > all works fine
>
> > Mi question is, in all tutorial that i read, the writter say something
> > like "the recommended way to import is 'from django import newforms as
> > forms'".
>
> > Why this way don't work now?.In the last version of Django newforms
> > was replaced for form?. I can't find nothing in the official
> > documention.
>
> > Mi PC have Django 1.2.1(the latest stable version)
>
> > That's my question. Thank's all. And sorry for my poor english, the
> > english isn't my mother language.
>
> The tutorial you read was for a django before 1.0. django.newforms was moved
> to django.forms for that release. If you see newforms in a tutorial, you can
> assume those are just forms now.
>
> Hope that helps,
>
> Michael

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



re: i can't import newforms(newbie)

2010-06-08 Thread Steven L Smith
Hello, and welcome to Django.

A long time ago, the original "forms" was removed and replaced with 
"newforms". To keep applications working during the transition, both "forms" 
and "newforms" were kept side-by-side for awhile. The idea was, after the 
transition was complete, you could simply change "import newforms as forms" to 
"import forms" and it would continue working.

So, yes, anytime you see "import newforms as forms" it is safe to replace it 
with "import forms".




Steven L Smith, Web Developer
Department of Information Technology Services
Nazareth College of Rochester
585-389-2085   |   ssmit...@naz.edu
http://www.naz.edu/pub/~ssmith46


- Original Message -
From: "refreegrata" <refreegr...@yahoo.com>
To: "Django users" <django-users@googlegroups.com>
Sent: Tuesday, June 8, 2010 3:46:46 PM GMT -05:00 US/Canada Eastern
Subject: i can't import newforms(newbie)

hello list
i'm a newbie with django trying to learn
Now i have a question
when i do
---
from django import newforms as forms

django throw an exception : "Error was: cannot import name newforms"

But when i do
---
from django import forms
---
all works fine

Mi question is, in all tutorial that i read, the writter say something
like "the recommended way to import is 'from django import newforms as
forms'".

Why this way don't work now?.In the last version of Django newforms
was replaced for form?. I can't find nothing in the official
documention.

Mi PC have Django 1.2.1(the latest stable version)

That's my question. Thank's all. And sorry for my poor english, the
english isn't my mother language.

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

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



Re: i can't import newforms(newbie)

2010-06-08 Thread Dan Harris
Hey there,

newforms was renamed to forms for the Django 1.0 release, this is the
reason why the statement "from django import newforms as forms"
doesn't work (because newforms does not exist anymore). Anywhere you
see newforms you can probably replace with forms. What tutorials are
you reading? If they are the official Django tutorials that is most
likely a bug in the documentation.

The documentation on the deprecation of newforms in favor of form is
in the Django 1.0 release notes at: 
http://docs.djangoproject.com/en/dev/releases/1.0/

Cheers,

Dan Harris
dih0...@gmail.com

On Jun 8, 3:46 pm, refreegrata <refreegr...@yahoo.com> wrote:
> hello list
> i'm a newbie with django trying to learn
> Now i have a question
> when i do
> ---
> from django import newforms as forms
> 
> django throw an exception : "Error was: cannot import name newforms"
>
> But when i do
> ---
> from django import forms
> ---
> all works fine
>
> Mi question is, in all tutorial that i read, the writter say something
> like "the recommended way to import is 'from django import newforms as
> forms'".
>
> Why this way don't work now?.In the last version of Django newforms
> was replaced for form?. I can't find nothing in the official
> documention.
>
> Mi PC have Django 1.2.1(the latest stable version)
>
> That's my question. Thank's all. And sorry for my poor english, the
> english isn't my mother language.

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



Re: i can't import newforms(newbie)

2010-06-08 Thread Michael
On Tue, Jun 8, 2010 at 3:46 PM, refreegrata <refreegr...@yahoo.com> wrote:

> hello list
> i'm a newbie with django trying to learn
> Now i have a question
> when i do
> ---
> from django import newforms as forms
> 
> django throw an exception : "Error was: cannot import name newforms"
>
> But when i do
> ---
> from django import forms
> ---
> all works fine
>
> Mi question is, in all tutorial that i read, the writter say something
> like "the recommended way to import is 'from django import newforms as
> forms'".
>
> Why this way don't work now?.In the last version of Django newforms
> was replaced for form?. I can't find nothing in the official
> documention.
>
> Mi PC have Django 1.2.1(the latest stable version)
>
> That's my question. Thank's all. And sorry for my poor english, the
> english isn't my mother language.
>
>
The tutorial you read was for a django before 1.0. django.newforms was moved
to django.forms for that release. If you see newforms in a tutorial, you can
assume those are just forms now.

Hope that helps,

Michael

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



i can't import newforms(newbie)

2010-06-08 Thread refreegrata
hello list
i'm a newbie with django trying to learn
Now i have a question
when i do
---
from django import newforms as forms

django throw an exception : "Error was: cannot import name newforms"

But when i do
---
from django import forms
---
all works fine

Mi question is, in all tutorial that i read, the writter say something
like "the recommended way to import is 'from django import newforms as
forms'".

Why this way don't work now?.In the last version of Django newforms
was replaced for form?. I can't find nothing in the official
documention.

Mi PC have Django 1.2.1(the latest stable version)

That's my question. Thank's all. And sorry for my poor english, the
english isn't my mother language.

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



Re: Testing Newforms for Blankness

2009-12-24 Thread Aristotle Miternan
Whoops, I think I misstated my use case. A better description:

All the fields are required, but I don't want to return a
forms.ValidationError if the entire form is blank, but I do if it is
partially filled, I simply want to drop it.

Perhaps this is simply bad design. Upon further consideration I think
my users should be required to remove things they don't want so that
the principle of least surprise is satisfied.

I guess that I don't need it after all. Sorry about that.

-AM

On Dec 24, 3:02 pm, Shawn Milochik  wrote:
> On Dec 24, 2009, at 2:51 PM, Aristotle Miternan wrote:
>
>
>
>
>
> > Hello all,
>
> >    I'm fairly new to Django and I noticed a curious behavior of
> > forms. I noticed that there is no simple way to test a form for a form
> > not being filled at all. I think it might be a semi-common use case
> > that you might want to simply not generate a new model instance if a
> > form has no information in it rather than return an error. This sort
> > of thing would look something like:
>
> >    form.is_blank()  ( analogous to form.is_valid() )
>
> > As it is, you have to mark all parts of the form as blank=True and
> > then scan through them. The thing is, if any of them are filled out
> > then I don't want blank=True on my fields, but I do want to test if
> > everything is blank painlessly.
>
> > I'm new at this, so there might be an idiom I don't know of or there
> > might be a good reason why this is a bad idea.
>
> > Thank you for reading!
> > -AM
>
> > --
>
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.
>
> Well, are you talking about a forms.Form or a forms.ModelForm? A ModelForm 
> will require any fields that are required in the model.
>
> A Form's fields default to being required, unless you specify otherwise. Any 
> fields not filled will return a message to the user.
>
> It sounds like you want a way to know whether all the fields are blank, but 
> if the field is invalid, what does that matter? It can't be processed if one 
> required field is left blank or if all of them are. What is your use-case for 
> wanting to know exactly how much of the form is blank?
>
> Shawn

--

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




Re: Testing Newforms for Blankness

2009-12-24 Thread Aristotle Miternan
Hi Shawn,

I am referring to forms.ModelForm, I think it might apply to forms as
well, but I can't think of a good use case off the top of my head.

I suppose I might have an uncommon use case. I display a form that has
several optional parts (that have different models) that can be
dynamically added with ajax and I wanted to avoid adding blank entries
to the database - but partially filled ones would be okay since the
user indicated that they have something to share. I can always just
patch my own version or work around it, but I was wondering if this
was common enough to be of interest to someone else.

-AM

On Dec 24, 3:02 pm, Shawn Milochik  wrote:
> On Dec 24, 2009, at 2:51 PM, Aristotle Miternan wrote:
>
>
>
>
>
> > Hello all,
>
> >    I'm fairly new to Django and I noticed a curious behavior of
> > forms. I noticed that there is no simple way to test a form for a form
> > not being filled at all. I think it might be a semi-common use case
> > that you might want to simply not generate a new model instance if a
> > form has no information in it rather than return an error. This sort
> > of thing would look something like:
>
> >    form.is_blank()  ( analogous to form.is_valid() )
>
> > As it is, you have to mark all parts of the form as blank=True and
> > then scan through them. The thing is, if any of them are filled out
> > then I don't want blank=True on my fields, but I do want to test if
> > everything is blank painlessly.
>
> > I'm new at this, so there might be an idiom I don't know of or there
> > might be a good reason why this is a bad idea.
>
> > Thank you for reading!
> > -AM
>
> > --
>
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.
>
> Well, are you talking about a forms.Form or a forms.ModelForm? A ModelForm 
> will require any fields that are required in the model.
>
> A Form's fields default to being required, unless you specify otherwise. Any 
> fields not filled will return a message to the user.
>
> It sounds like you want a way to know whether all the fields are blank, but 
> if the field is invalid, what does that matter? It can't be processed if one 
> required field is left blank or if all of them are. What is your use-case for 
> wanting to know exactly how much of the form is blank?
>
> Shawn

--

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




Re: Testing Newforms for Blankness

2009-12-24 Thread Shawn Milochik

On Dec 24, 2009, at 2:51 PM, Aristotle Miternan wrote:

> Hello all,
> 
>I'm fairly new to Django and I noticed a curious behavior of
> forms. I noticed that there is no simple way to test a form for a form
> not being filled at all. I think it might be a semi-common use case
> that you might want to simply not generate a new model instance if a
> form has no information in it rather than return an error. This sort
> of thing would look something like:
> 
>form.is_blank()  ( analogous to form.is_valid() )
> 
> As it is, you have to mark all parts of the form as blank=True and
> then scan through them. The thing is, if any of them are filled out
> then I don't want blank=True on my fields, but I do want to test if
> everything is blank painlessly.
> 
> I'm new at this, so there might be an idiom I don't know of or there
> might be a good reason why this is a bad idea.
> 
> Thank you for reading!
> -AM
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 
> 


Well, are you talking about a forms.Form or a forms.ModelForm? A ModelForm will 
require any fields that are required in the model.

A Form's fields default to being required, unless you specify otherwise. Any 
fields not filled will return a message to the user.

It sounds like you want a way to know whether all the fields are blank, but if 
the field is invalid, what does that matter? It can't be processed if one 
required field is left blank or if all of them are. What is your use-case for 
wanting to know exactly how much of the form is blank?

Shawn




--

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




Testing Newforms for Blankness

2009-12-24 Thread Aristotle Miternan
Hello all,

I'm fairly new to Django and I noticed a curious behavior of
forms. I noticed that there is no simple way to test a form for a form
not being filled at all. I think it might be a semi-common use case
that you might want to simply not generate a new model instance if a
form has no information in it rather than return an error. This sort
of thing would look something like:

form.is_blank()  ( analogous to form.is_valid() )

As it is, you have to mark all parts of the form as blank=True and
then scan through them. The thing is, if any of them are filled out
then I don't want blank=True on my fields, but I do want to test if
everything is blank painlessly.

I'm new at this, so there might be an idiom I don't know of or there
might be a good reason why this is a bad idea.

Thank you for reading!
-AM

--

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




Re: Custom field types and newforms admin

2009-08-23 Thread Hanpan

Hi, thanks for the reply.

ImageWithThumbsField is custom field which extends ImageField. It
creates a thumbnail. I am using it in my model definition, nothing to
do with a form. syncdb is ignoring this field when it creates the
table completely.

On 23 Aug, 18:39, Daniel Roseman  wrote:
> On Aug 23, 3:44 pm, Hanpan  wrote:
>
> > Hi,
>
> > I have created a custom field type, which I am using like so:
>
> > image_thumb = ImageWithThumbsField(_('preview image'),
> > upload_to='uploads/projects')
>
> > But for some reason, when I run syncdb this custom field is being
> > completely ignored. I tried using the 'widget' argument, but that
> > caused an error. I also tried 'formfield_for_dbfield' in the admin.py,
> > but that didn't help at all.
>
> > Any suggestions?
>
> You seem to be confusing model fields with form fields. Where are you
> using this field, in a model or form definition? What are you
> expecting syncdb to do, and what is it actually doing?
> --
> DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom field types and newforms admin

2009-08-23 Thread Hanpan

Hi, thanks for the reply.

ImageWithThumbsField is custom field which extends ImageField. It
creates a thumbnail. I am using it in my model definition, nothing to
do with a form. syncdb is ignoring this field when it creates the
table completely.

On 23 Aug, 18:39, Daniel Roseman  wrote:
> On Aug 23, 3:44 pm, Hanpan  wrote:
>
> > Hi,
>
> > I have created a custom field type, which I am using like so:
>
> > image_thumb = ImageWithThumbsField(_('preview image'),
> > upload_to='uploads/projects')
>
> > But for some reason, when I run syncdb this custom field is being
> > completely ignored. I tried using the 'widget' argument, but that
> > caused an error. I also tried 'formfield_for_dbfield' in the admin.py,
> > but that didn't help at all.
>
> > Any suggestions?
>
> You seem to be confusing model fields with form fields. Where are you
> using this field, in a model or form definition? What are you
> expecting syncdb to do, and what is it actually doing?
> --
> DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom field types and newforms admin

2009-08-23 Thread Daniel Roseman

On Aug 23, 3:44 pm, Hanpan  wrote:
> Hi,
>
> I have created a custom field type, which I am using like so:
>
> image_thumb = ImageWithThumbsField(_('preview image'),
> upload_to='uploads/projects')
>
> But for some reason, when I run syncdb this custom field is being
> completely ignored. I tried using the 'widget' argument, but that
> caused an error. I also tried 'formfield_for_dbfield' in the admin.py,
> but that didn't help at all.
>
> Any suggestions?

You seem to be confusing model fields with form fields. Where are you
using this field, in a model or form definition? What are you
expecting syncdb to do, and what is it actually doing?
--
DR.

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



Custom field types and newforms admin

2009-08-23 Thread Hanpan

Hi,

I have created a custom field type, which I am using like so:

image_thumb = ImageWithThumbsField(_('preview image'),
upload_to='uploads/projects')

But for some reason, when I run syncdb this custom field is being
completely ignored. I tried using the 'widget' argument, but that
caused an error. I also tried 'formfield_for_dbfield' in the admin.py,
but that didn't help at all.

Any suggestions?

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



Help w/ Newforms Trouble

2009-06-27 Thread Dylan Lorimer

Hi,

I have a newform that works as intended. I want to add admin
functionality such that within the same view I can handle creation of
a newform or passing back a model's values to the template for
editing. This is supposed to be simple with newforms but I'm stuck,
hoping for help.

Here is my simplified code:

def blog_post(request, id=None):

  instance = None
  if id is not None and id != "":
instance = BlogEntry.objects.get(id)

  if request.method == 'POST':
form = jacey_forms.BlogEntryForm(request.POST, instance=instance)

if form.is_valid():
  new_blog_entry = form.save(commit=False)
  ...do some stuff
  new_blog_entry = form.save()
  return HttpResponseRedirect('/')

  else:
form = jacey_forms.BlogEntryForm(instance=instance)

  return render_to_response('base_post.html', {'form' : form})


By all accounts this should work. But I have no idea how to fill out
my html form with the values of the model that already exists. Any
help is appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to create a newforms label unattached to an input field?

2009-05-12 Thread Nash-t

Thanks for the help. I created the custom widget. It works OK but I
cannot figure out how to get my custom class (for css) to render .
Please check this out when you get a chance.

class NakedLabelWidget(forms.Widget):
  """
  A widget that produces a naked label
  """
  def __init__(self, attrs=None):
""
super(NakedLabelWidget, self).__init__(attrs)

  def render(self, name, value, attrs=None):
 return '' #super(NakedLabelWidget, self).render( attrs)

class NakedLabelField(forms.NullBooleanField):
widget = NakedLabelWidget(attrs={'class':'special'})


On May 11, 9:15 pm, George Song  wrote:
> On 5/11/2009 12:29 PM,Nash-twrote:
>
> > I apologize if this is a dumb newbie question...
> > I am trying to create a newform label that doesn't have an associated
> > input field. This label is used as a title for a set of  input fields.
> > I don't want to use django templates because of the way the form/data
> > is passed around and saved on the server side.
> > Any advice?
>
> I'm not sure I understand entirely what you're doing. In any case, you
> have a few options:
>
> 1. If this is one specific form, you can just override it's rendering
> method, or write your own rendering method for that form which takes
> care of generating the correct label at the right place.
>
> 2. Write a custom widget, since widgets are responsible for rendering
> fields out to the form.
>
> --
> George
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to create a newforms label unattached to an input field?

2009-05-11 Thread George Song

On 5/11/2009 12:29 PM, Nash-t wrote:
> I apologize if this is a dumb newbie question...
> I am trying to create a newform label that doesn't have an associated
> input field. This label is used as a title for a set of  input fields.
> I don't want to use django templates because of the way the form/data
> is passed around and saved on the server side.
> Any advice?

I'm not sure I understand entirely what you're doing. In any case, you 
have a few options:

1. If this is one specific form, you can just override it's rendering 
method, or write your own rendering method for that form which takes 
care of generating the correct label at the right place.

2. Write a custom widget, since widgets are responsible for rendering 
fields out to the form.

-- 
George

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



How to create a newforms label unattached to an input field?

2009-05-11 Thread Nash-t

I apologize if this is a dumb newbie question...
I am trying to create a newform label that doesn't have an associated
input field. This label is used as a title for a set of  input fields.
I don't want to use django templates because of the way the form/data
is passed around and saved on the server side.
Any advice?

Thanks,
-Tim
Lead Developer
SanMateoWaveforms.com

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



Re: Many Models, One Form with newforms?

2009-04-08 Thread robstar

Thanks a lot !  That worked great.  I can't believe how easy it is to
slam everything back into the db using the instance and prefix.
Django ftw!!

rob


>
> Just use them all side-by-side in your views and templates,  
> potentially using prefixes 
> (http://docs.djangoproject.com/en/dev/ref/forms/api/#prefixes-for-forms
> ) if you think there's a risk of field name collisions.
>
> Also, check formsets 
> (http://docs.djangoproject.com/en/dev/topics/forms/formsets/
> ) if you have series of identical forms.
--~--~-~--~~~---~--~~
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: Many Models, One Form with newforms?

2009-04-08 Thread Masklinn

On 8 Apr 2009, at 20:51 , robstar wrote:
> Hey guys,
>
> I'm working on a recipe engine and need to consolidate all the related
> models for one Recipe on one page for editing purposes... Suppose I
> have:
>
> model Recipe
>  fk <-model Recipe Parts
>   fk <- model Ingredients
>   fk <- model Directions
>
> Can I render all these related models in one view and handle saving it
> through the newforms architecture?
>
> I tried form inheritance but the metas get overwritten and only the
> Ingredient fields show up by the time you get to SuperForm:
>
> class RecipeForm(ModelForm):
>  class Meta:
>model = Recipe
>
> class IngredientForm(RecipeForm):
>  class Meta():
>model = Ingredient
>
> class SuperForm(IngredientForm):
>  morestuff = models.CharField(max_length=100)
>
>
>
> Can I use newforms or any part of Django to do this, or do I have to
> revert to plain html coding of a custom form?

Just use them all side-by-side in your views and templates,  
potentially using prefixes 
(http://docs.djangoproject.com/en/dev/ref/forms/api/#prefixes-for-forms 
) if you think there's a risk of field name collisions.

Also, check formsets 
(http://docs.djangoproject.com/en/dev/topics/forms/formsets/ 
) if you have series of identical forms.

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



Many Models, One Form with newforms?

2009-04-08 Thread robstar

Hey guys,

I'm working on a recipe engine and need to consolidate all the related
models for one Recipe on one page for editing purposes... Suppose I
have:

model Recipe
  fk <-model Recipe Parts
   fk <- model Ingredients
   fk <- model Directions

Can I render all these related models in one view and handle saving it
through the newforms architecture?

I tried form inheritance but the metas get overwritten and only the
Ingredient fields show up by the time you get to SuperForm:

class RecipeForm(ModelForm):
  class Meta:
model = Recipe

class IngredientForm(RecipeForm):
  class Meta():
model = Ingredient

class SuperForm(IngredientForm):
  morestuff = models.CharField(max_length=100)



Can I use newforms or any part of Django to do this, or do I have to
revert to plain html coding of a custom form?

Thanks for your help

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



Re: Controlling html display of Charfield length on forms...(newforms?)

2009-04-02 Thread NoviceSortOf


text = forms.CharField(label="text", max_length=10,
  widget=forms.TextInput(
attrs={'size':'10', 'class':'inputText'}))

Thanks Ayaz the above works perfectly.
--~--~-~--~~~---~--~~
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: Controlling html display of Charfield length on forms...(newforms?)

2009-03-26 Thread Ayaz Ahmed Khan


On 26-Mar-09, at 2:26 PM, NoviceSortOf wrote:

> It would seem natural that there would be a length or size parameter
> on something in forms and/or models Charfield to control the html
> display of the field length.


How a field in a form in Django is rendered is determined by the
corresponding widget used for that field. To that end, Django offers a
great deal of flexibility when it comes to customising both the look
and functionality of form fields. Having said that, I should point out
without sounding condescending that one can specify and configure
different supported attributes of an HTML form element through the use
of the `attrs` attribute supported by Django widgets.

For example, to restrict the size of and specify a class for an input
field, the following can be used:

 text = forms.CharField(label="text", max_length=10,
  widget=forms.TextInput(
 attrs={'size':'10', 'class':'inputText'}))

One can toss in all manners of *supported* HTML attributes in there.

-- 
Ayaz Ahmed Khan

An evil mind is a great comfort.


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



Controlling html display of Charfield length on forms...(newforms?)

2009-03-26 Thread NoviceSortOf


It would seem natural that there would be a length or size parameter
on something in forms and/or models Charfield to control the html
display of the field length.

ie.
firstname = forms.CharField(max_length=20, size = 4)

I've found this hack discussed to the fields.py [link below] but it
dates back a few years and I was curious if there is any update on how
the display of html input field's is now handled by Django.

http://groups.google.com/group/django-users/browse_frm/thread/4f6e2e0c936dcca5/cea43c5582dda436?hl=en=gst=fields.py+length#cea43c5582dda436
--~--~-~--~~~---~--~~
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: Trouble with accents when passing tranlsated string with newforms

2009-03-09 Thread Malcolm Tredinnick

On Tue, 2009-03-10 at 13:15 +1100, Malcolm Tredinnick wrote:
> On Mon, 2009-03-09 at 07:55 -0700, Tipan wrote:
> > 
> > > Do you mean they are inserted into the source as "oacute;" and so
> > > the user sees, literally, ""?
> > >
> > 
> > Yes. The string has the html code for the accent as you show above.
> 
> I showed two possiblities. Which one is it? If the string is being
> inserted as  then there's no problem here.

I had some time to test, using the example from #10449 and it is indeed
producing the incorrect result ("oacute;"). So we'll fix it at some
point.

Regards,
Malcolm



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



Re: Trouble with accents when passing tranlsated string with newforms

2009-03-09 Thread Malcolm Tredinnick

On Mon, 2009-03-09 at 07:55 -0700, Tipan wrote:
> 
> > Do you mean they are inserted into the source as "oacute;" and so
> > the user sees, literally, ""?
> >
> 
> Yes. The string has the html code for the accent as you show above.

I showed two possiblities. Which one is it? If the string is being
inserted as  then there's no problem here.

Regards,
Malcolm



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



Re: Trouble with accents when passing tranlsated string with newforms

2009-03-09 Thread Tipan


> Do you mean they are inserted into the source as "oacute;" and so
> the user sees, literally, ""?
>

Yes. The string has the html code for the accent as you show above.

> This could be a bug. Any strings provided by Django itself (and this
> includes translated strings, although we don't make that clear in the
> documentation) should be automatically considered "safe" in the
> auto-escaping sense. That is, they should be inserted literally. If
> we're auto-escaping them, it's a bug. I thought we'd flushed out all of
> those cases; apparently not.
>
> I'll make some time to investigate this a bit more, but if you can be
> bothered to open a ticket describing the problem, that would be helpful
> so that we don't forget it.

I'll raise a ticket for this as a bug as you suggest.

I'm experiencing a similar issue when I pass a unicode translated
string for use as a Subject in the send_mail function. It also
presents the text still containing the  etc.

Thanks, 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: Trouble with accents when passing tranlsated string with newforms

2009-03-08 Thread Malcolm Tredinnick

On Sun, 2009-03-08 at 04:55 -0700, Tipan wrote:
> I'm trying to pass a translated string to a select box using a Forms
> Select widget and it always presents the output string with all the
> accent HTML entity codes.
> 
> In my models file, I have a range of subjects:
> 
> Models.py
> from django.utils import translation
> from django.utils.translation import ugettext_lazy as _
> 
> SUBJECT = (
> (10, _('Log-in or Account related problems')),
> (20, _('General enquiry')),
> (30, _('Other feedback')),
> )
> 
> This is used in a form:
> 
> class HelpFeedbackForm(forms.Form):
>   #form for user to submit their feedback when not logged in
>   subject = forms.CharField(widget=forms.Select(choices=SUBJECT))
> 
> and presented in the template as:
> 
> {{ form.subject }}
> 
> The translations are returned from the django.po file, but all of the
> HTML entity codes are returned as is in the Select box as shown below.

Do you mean they are inserted into the source as "oacute;" and so
the user sees, literally, ""?

> If also tried using the safe template filter tag but to no avail.
> 
> "Problemas para el Inicio de Sesin o relacionados con la
> Cuenta"
> 
> 
> I'm sure I'm doing something silly, but having tried a number of
> options, I need a fresh viewpoint. Could anyone suggest how I might
> overcome the problem?

This could be a bug. Any strings provided by Django itself (and this
includes translated strings, although we don't make that clear in the
documentation) should be automatically considered "safe" in the
auto-escaping sense. That is, they should be inserted literally. If
we're auto-escaping them, it's a bug. I thought we'd flushed out all of
those cases; apparently not.

I'll make some time to investigate this a bit more, but if you can be
bothered to open a ticket describing the problem, that would be helpful
so that we don't forget it.

Regards,
Malcolm



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



Trouble with accents when passing tranlsated string with newforms

2009-03-08 Thread Tipan

I'm trying to pass a translated string to a select box using a Forms
Select widget and it always presents the output string with all the
accent HTML entity codes.

In my models file, I have a range of subjects:

Models.py
from django.utils import translation
from django.utils.translation import ugettext_lazy as _

SUBJECT = (
(10, _('Log-in or Account related problems')),
(20, _('General enquiry')),
(30, _('Other feedback')),
)

This is used in a form:

class HelpFeedbackForm(forms.Form):
#form for user to submit their feedback when not logged in
subject = forms.CharField(widget=forms.Select(choices=SUBJECT))

and presented in the template as:

{{ form.subject }}

The translations are returned from the django.po file, but all of the
HTML entity codes are returned as is in the Select box as shown below.
If also tried using the safe template filter tag but to no avail.

"Problemas para el Inicio de Sesin o relacionados con la
Cuenta"


I'm sure I'm doing something silly, but having tried a number of
options, I need a fresh viewpoint. Could anyone suggest how I might
overcome the problem?

Thanks,

Tim









I may be doing something silly, but I can't find the solution
--~--~-~--~~~---~--~~
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: newforms library.

2009-01-12 Thread David Zhou

On Mon, Jan 12, 2009 at 8:25 AM, Karen Tracey <kmtra...@gmail.com> wrote:
> On Mon, Jan 12, 2009 at 6:11 AM, seki <sekiskyl...@gmail.com> wrote:
>>
>> Hi guys,
>> I have been teaching myself Django and I have worked with the latest
>> release. To me it seems the new library isn't shipped with the
>> newforms library ( i.e Django-1.0.2-final)...
>> I just coppied the library from an older version.
>> Hope that's pretty fine...
>
> newforms was never intended to be a permanent name for the new forms
> package, it was just a temporary name to allow co-existence with the
> original forms and allow for easier migration.

seki, this is why it's always been recommended to do "import newforms
as forms", since that allowed easier migration when newforms was
renamed and replaced forms.


-- 
---
David Zhou
da...@nodnod.net

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



Re: newforms library.

2009-01-12 Thread Karen Tracey
On Mon, Jan 12, 2009 at 6:11 AM, seki <sekiskyl...@gmail.com> wrote:

>
> Hi guys,
> I have been teaching myself Django and I have worked with the latest
> release. To me it seems the new library isn't shipped with the
> newforms library ( i.e Django-1.0.2-final)...
> I just coppied the library from an older version.
> Hope that's pretty fine...
>

newforms was never intended to be a permanent name for the new forms
package, it was just a temporary name to allow co-existence with the
original forms and allow for easier migration.  Prior to 1.0, all traces of
"old" forms were removed from the django tree and newforms was renamed to
forms.  By copying an old copy of newforms, you have likely downgranded your
forms support to a version that does not have all the 1.0+ bugfixes.  You
should just use forms as shipped.

Karen

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



newforms library.

2009-01-12 Thread seki

Hi guys,
I have been teaching myself Django and I have worked with the latest
release. To me it seems the new library isn't shipped with the
newforms library ( i.e Django-1.0.2-final)...
I just coppied the library from an older version.
Hope that's pretty fine...

--~--~-~--~~~---~--~~
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: clear a newforms error indicator

2008-11-24 Thread Malcolm Tredinnick

Hi Robin,

On Mon, 2008-11-24 at 12:45 +, Robin Becker wrote:
> We have some legacy code that wants to display a partially filled form. One 
> of 
> the fields is required to be non-empty (it's a captcha) so when re-issuing 
> the 
> form partially filled I've been doing this
> 
> class EmailForm(forms.Form):
>   .
>vericode = forms.CharField(max_length=5, required=True, label='CODE')
> 
> 
>   ...
> 
> nparams= params.copy()
> nparams['vericode'] = ''
> ef = EmailFormPangea(nparams)
> 
> 
> but I find then that the vericode field is marked as in error when I come to 
> render.
> 
> To fix this I tried
> 
> ef = EmailFormPangea(nparams)
> ef.full_clean()
> del ef._errors['vericode']
> 
> but this looks fairly clunky. Is there a better way to clear errors or to 
> indicate that something is not in error during rendering, but should be 
> considered erroneous on submission?

Aren't you approaching this from the wrong end. If I understand your
problem correctly, it sounds like you want normal processing except that
the existing value should not be rendered if the form is redisplayed (in
the error processing path). You still want the captcha field to be
validated and everything, right? So blanking it out from the parameters
doesn't sound right.

Instead, you can use a widget for that field that doesn't render its
initial data. django.forms.PasswordInput(render_value=False) is almost
right, except it used an input type of password and not text. But it
gives us the right start. Thinking out loud (thinking in type?), I
suspect something like this will work:

class NoRenderWidget(forms.PasswordInput):
input_type = "text"

class EmailForm(forms.Form):
vericode = forms.CharField(max_length=5, required=True,
label='CODE',
widget=NoRenderWidget(render_value=False))

It's almost midnight here, so my brain's only at about 25%, but that
should give you some clues even if it's not quite right out of the box.
In that way, you don't have to mess around with the parameters and
email_form.is_valid(), etc, will still work as normal. But if you
display the form with anything in the data['vericode'] slot, it won't be
rendered.

An alternative solution, in case the above is really wrong, is to
remember that you can use multiple Form classes in one HTML form. So
create one form class that contains all your normal data that will be
redisplayed and another form class for the vericode. Then, when it comes
time to render, *always* pass in a new (empty) instance of the second
form. Okay, that's only slightly less crufty than your current solution,
but it contains no diving around under the covers.

Best wishes,
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
-~--~~~~--~~--~--~---



clear a newforms error indicator

2008-11-24 Thread Robin Becker

We have some legacy code that wants to display a partially filled form. One of 
the fields is required to be non-empty (it's a captcha) so when re-issuing the 
form partially filled I've been doing this

class EmailForm(forms.Form):
  .
   vericode = forms.CharField(max_length=5, required=True, label='CODE')


  ...

nparams= params.copy()
nparams['vericode'] = ''
ef = EmailFormPangea(nparams)


but I find then that the vericode field is marked as in error when I come to 
render.

To fix this I tried

ef = EmailFormPangea(nparams)
ef.full_clean()
del ef._errors['vericode']

but this looks fairly clunky. Is there a better way to clear errors or to 
indicate that something is not in error during rendering, but should be 
considered erroneous on submission?
-- 
Robin Becker

--~--~-~--~~~---~--~~
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: num_in_admin equivalent in newforms

2008-11-04 Thread Xiong Chiamiov

Actually, extra by itself does exactly what I want.  For some reason I
couldn't see it - I guess I just got caught up in the specific name.
Thanks.

On Nov 4, 10:32 am, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> On Nov 4, 5:57 pm, Xiong Chiamiov <[EMAIL PROTECTED]> wrote:
>
> > I'm in the process of converting a bunch of sites from pre-nfa to
> > 1.0.  One of the things I've run across is the change in inlines in
> > the admin interface.  Previously, there was 
> > (http://www.djangoproject.com/documentation/0.96/model-api/#many-to-on..)
> > a parameter called num_in_admin that, when set to =1, would show all
> > filled models and one blank, allowing you to have the ability to add
> > as many of an object as you want without having a page filled with
> > blank models.
>
> > The current implementation, however doesn't seem to support this
> > (http://docs.djangoproject.com/en/dev/ref/contrib/admin/
> > #inlinemodeladmin-objects).  Am I overlooking something obvious, or is
> > there another way to do this?
>
> Some combination of extra and max_num will do what you want.
> --
> 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
-~--~~~~--~~--~--~---



Re: num_in_admin equivalent in newforms

2008-11-04 Thread Daniel Roseman

On Nov 4, 5:57 pm, Xiong Chiamiov <[EMAIL PROTECTED]> wrote:
> I'm in the process of converting a bunch of sites from pre-nfa to
> 1.0.  One of the things I've run across is the change in inlines in
> the admin interface.  Previously, there was 
> (http://www.djangoproject.com/documentation/0.96/model-api/#many-to-one-relat...)
> a parameter called num_in_admin that, when set to =1, would show all
> filled models and one blank, allowing you to have the ability to add
> as many of an object as you want without having a page filled with
> blank models.
>
> The current implementation, however doesn't seem to support this
> (http://docs.djangoproject.com/en/dev/ref/contrib/admin/
> #inlinemodeladmin-objects).  Am I overlooking something obvious, or is
> there another way to do this?

Some combination of extra and max_num will do what you want.
--
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
-~--~~~~--~~--~--~---



num_in_admin equivalent in newforms

2008-11-04 Thread Xiong Chiamiov

I'm in the process of converting a bunch of sites from pre-nfa to
1.0.  One of the things I've run across is the change in inlines in
the admin interface.  Previously, there was (http://
www.djangoproject.com/documentation/0.96/model-api/#many-to-one-relationships)
a parameter called num_in_admin that, when set to =1, would show all
filled models and one blank, allowing you to have the ability to add
as many of an object as you want without having a page filled with
blank models.

The current implementation, however doesn't seem to support this
(http://docs.djangoproject.com/en/dev/ref/contrib/admin/
#inlinemodeladmin-objects).  Am I overlooking something obvious, or is
there another way to do this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms question

2008-10-17 Thread Daniel Roseman

On Oct 17, 5:50 pm, Jeff Gentry <[EMAIL PROTECTED]> wrote:
> > Oops. It could also read
> >     from django import newforms as forms
> > in which case you should change it to
> >     from django import forms
>
> Right, that's what I was thinking.
>
> > but I hope you've got the idea: basically newforms has *become* forms.
>
> Yup - just wasn't sure on that.  I had remembered seeing something along
> those lines a while back but wasn't sure if it had said it *was* changing
> names or *wasn't* :)  Plus with all of the chatter on both forms and
> newforms I couldn't find a definitive answer to this question when
> searching.
>
> They have some other "old stuff-isms", some I noticed on my own, some were
> easier to search on and I'm sure I'll come across more.
>
> Thanks all :)
> -J

You might find this page useful:
http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges

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



Re: newforms question

2008-10-17 Thread Jeff Gentry

> Oops. It could also read
> from django import newforms as forms
> in which case you should change it to
> from django import forms

Right, that's what I was thinking.

> but I hope you've got the idea: basically newforms has *become* forms.

Yup - just wasn't sure on that.  I had remembered seeing something along
those lines a while back but wasn't sure if it had said it *was* changing
names or *wasn't* :)  Plus with all of the chatter on both forms and
newforms I couldn't find a definitive answer to this question when
searching.

They have some other "old stuff-isms", some I noticed on my own, some were
easier to search on and I'm sure I'll come across more.

Thanks all :)
-J


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

2008-10-17 Thread Steve Holden

Jeff Gentry wrote:
> Hi there ...
> 
> To date, I've not been using Django's form system (nor 'newforms'), but am
> trying to integrate another app into a suite that I'm developing.  The
> code on this is a bit older and is using newforms - when I fire up the
> server (running off of the 1.0 branch) I get "No module named
> newforms".  I've been a bit lax in trying to follow how this all shook
> out, but am I correct in my thinking that 'newforms' is now simply
> 'forms'?
> 
Oops. It could also read

from django import newforms as forms

in which case you should change it to

from django import forms

but I hope you've got the idea: basically newforms has *become* forms.

regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.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: newforms question

2008-10-17 Thread Steve Holden

Jeff Gentry wrote:
> Hi there ...
> 
> To date, I've not been using Django's form system (nor 'newforms'), but am
> trying to integrate another app into a suite that I'm developing.  The
> code on this is a bit older and is using newforms - when I fire up the
> server (running off of the 1.0 branch) I get "No module named
> newforms".  I've been a bit lax in trying to follow how this all shook
> out, but am I correct in my thinking that 'newforms' is now simply
> 'forms'?

If the statement that is failing used the recommended mechanism and reads

import django.newforms as forms

then you simply have to change it to

import django.forms

Otherwise you'll have to change every occurrence of "newforms" to
"forms". The code should work, though, modulo any incompatible changes
made to the newforms module before incorporation as the standard package.

regards
 Steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.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: newforms question

2008-10-17 Thread Jeff Anderson
Jeff Gentry wrote:
> Hi there ...
>
> To date, I've not been using Django's form system (nor 'newforms'), but am
> trying to integrate another app into a suite that I'm developing.  The
> code on this is a bit older and is using newforms - when I fire up the
> server (running off of the 1.0 branch) I get "No module named
> newforms".  I've been a bit lax in trying to follow how this all shook
> out, but am I correct in my thinking that 'newforms' is now simply
> 'forms'?
>   
This is correct. oldforms was removed, and newforms was renamed to
forms. This happened before the 1.0 release.

You just need to change your code to reflect this, and it should likely
work.

Jeff Anderson



signature.asc
Description: OpenPGP digital signature


newforms question

2008-10-17 Thread Jeff Gentry

Hi there ...

To date, I've not been using Django's form system (nor 'newforms'), but am
trying to integrate another app into a suite that I'm developing.  The
code on this is a bit older and is using newforms - when I fire up the
server (running off of the 1.0 branch) I get "No module named
newforms".  I've been a bit lax in trying to follow how this all shook
out, but am I correct in my thinking that 'newforms' is now simply
'forms'?


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



Need help with newforms ...

2008-10-17 Thread dbee

I need the user to be able to check the box on groups that apply to
them. This was really easy to do with oldforms ...

   VIEWS:

# Get all that user's
groups
groups =
Groups.objects.filter(userProfile__user__pk=request.user.id)

# Create the FormWrapper, template, context, response
form = forms.FormWrapper(manipulator, new_data, errors)

return render_to_response('myaccount.html', {'form': form,
'user' : request.user,'groups' : groups})


   TEMPLATE:

  {% for g in groups %}

   
 
  {{ g.name }}
 
 
  
 
   

   {% endfor %}

Couldn't be simpler. But now in newforms, i'm a bit lost ...

  VIEWS:

# Get all that user's
groups
groups =
Groups.objects.filter(userProfile__user__pk=request.user.id)


# Campaign
form
class CampaignsForm(forms.Form):

  name = forms.CharField(required=True, max_length=40)
  description = forms.CharField(required=True,
max_length=1000,
widget=forms.Textarea(attrs={'rows':'7','cols':'25'}))
  send_date = forms.CharField(required=False)
  groups = forms.CharField(widget=forms.Select())

  def __init__(self, groups, *args, **kwargs):

   super(CampaignsForm, self).__init__(args, kwargs)
   self.fields['groups'].choices = groups

# THis gives me a an empty groups drop-down menu and triggers all
the errors on the form. I also especially want to render checkboxes
using only that user's groups and not have a drop-down menu.

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: Django-Registration and NewForms Error

2008-10-08 Thread Chris Spencer

Thanks guys, that fixed the problem.

On Wed, Oct 8, 2008 at 6:37 PM, Steve Holden <[EMAIL PROTECTED]> wrote:
>
> Rishabh Manocha wrote:
>> On Wed, Oct 8, 2008 at 5:07 PM, Chris <[EMAIL PROTECTED]
>> <mailto:[EMAIL PROTECTED]>> wrote:
>>
>>
>> I installed django-registration via easy_install, and followed the
>> directions for setting it up in my app, but when I go to /register, I
>> get the error:
>>
>>  File "/usr/lib/python2.5/site-packages/django_registration-0.5-
>> py2.5.egg/registration/views.py", line 12, in 
>>
>>  File "/usr/lib/python2.5/site-packages/django_registration-0.5-
>> py2.5.egg/registration/forms.py", line 7, in 
>>
>> ImportError: cannot import name newforms
>> [...]
>>
>>
>> The problem most probably is that the version of django-registration
>> you have installed via easy_install is not the latest version
>> available - and hence is probably doing an import like "from django
>> import newforms as forms" (or something like that) in forms.py.
>> "newforms" was renamed to "forms" at some point before the 1.0 release
>> and so python is unable to import "newforms". The latest version(in
>> trunk) seems to have fixed this[1].
>>
>> Uninstall the version you have installed via easy_install and grab the
>> latest tar from the official site -
>> http://code.google.com/p/django-registration/.
>>
> I believe I installed from SVN quite recently and discovered that
> newforms was still used. James Bennet recently pointed out he hadn't yet
> had time to 1.0-ify all his contributions. The only change i had to make
> was changing
>
> import newforms as forms
>
> to
>
> import forms
>
> regards
>  Steve
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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-Registration and NewForms Error

2008-10-08 Thread Steve Holden

Rishabh Manocha wrote:
> On Wed, Oct 8, 2008 at 5:07 PM, Chris <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
> I installed django-registration via easy_install, and followed the
> directions for setting it up in my app, but when I go to /register, I
> get the error:
>
>  File "/usr/lib/python2.5/site-packages/django_registration-0.5-
> py2.5.egg/registration/views.py", line 12, in 
>
>  File "/usr/lib/python2.5/site-packages/django_registration-0.5-
> py2.5.egg/registration/forms.py", line 7, in 
>
> ImportError: cannot import name newforms
> [...]
>
>
> The problem most probably is that the version of django-registration
> you have installed via easy_install is not the latest version
> available - and hence is probably doing an import like "from django
> import newforms as forms" (or something like that) in forms.py.
> "newforms" was renamed to "forms" at some point before the 1.0 release
> and so python is unable to import "newforms". The latest version(in
> trunk) seems to have fixed this[1].
>
> Uninstall the version you have installed via easy_install and grab the
> latest tar from the official site -
> http://code.google.com/p/django-registration/.
>
I believe I installed from SVN quite recently and discovered that
newforms was still used. James Bennet recently pointed out he hadn't yet
had time to 1.0-ify all his contributions. The only change i had to make
was changing

import newforms as forms

to

import forms

regards
 Steve


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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-Registration and NewForms Error

2008-10-08 Thread Rishabh Manocha
On Wed, Oct 8, 2008 at 5:07 PM, Chris <[EMAIL PROTECTED]> wrote:

>
> I installed django-registration via easy_install, and followed the
> directions for setting it up in my app, but when I go to /register, I
> get the error:
>
>  File "/usr/lib/python2.5/site-packages/django_registration-0.5-
> py2.5.egg/registration/views.py", line 12, in 
>
>  File "/usr/lib/python2.5/site-packages/django_registration-0.5-
> py2.5.egg/registration/forms.py", line 7, in 
>
> ImportError: cannot import name newforms
>
> Does anyone know what would cause this error? The line it's
> complaining about is "from django import forms", which if I try from
> the command line imports just fine.
>
> This is the urls.py I'm using:
>
> from django.conf.urls.defaults import *
> from django.views.generic.simple import direct_to_template
> from registration.views import activate
> from registration.views import register
>
> urlpatterns = patterns('',
>(r'^account/activate/(?P\w+)/$',
>activate,
>{'template': 'templates/account_activate.html'}
>),
>(r'^account/login/$',
>'django.contrib.auth.views.login',
>{'template_name': 'templates/account_login.html'},
>),
>(r'^account/logout/$',
>'django.contrib.auth.views.logout',
>{'template_name': 'templates/account_logout.html'},
>),
>(r'^account/password/change/$',
>'django.contrib.auth.views.password_change',
>{'template_name': 'templates/account_password_change.html'}
>),
>(r'^account/password/change/done/$',
>'django.contrib.auth.views.password_change_done',
>{'template_name': 'templates/
> account_password_change_done.html'}
>),
>(r'^account/password/reset/$',
>'django.contrib.auth.views.password_reset',
>{'template_name': 'templates/account_password_reset.html'}
>),
>(r'^account/password/reset/done/$',
>'django.contrib.auth.views.password_reset_done',
>{'template_name': 'templates/
> account_password_reset_done.html'}
>),
>(r'^account/profile/$',
>direct_to_template,
>{'template': 'templates/account_profile.html'}
>),
>(r'^account/register/$',
>register,
>{'template': 'templates/account_register.html'},
>   ),
>   (r'^account/register/complete/$',
>direct_to_template,
>{'template': 'templates/account_registration_complete.html'},
>   ),
> )
>
> >
>
The problem most probably is that the version of django-registration you
have installed via easy_install is not the latest version available - and
hence is probably doing an import like "from django import newforms as
forms" (or something like that) in forms.py. "newforms" was renamed to
"forms" at some point before the 1.0 release and so python is unable to
import "newforms". The latest version(in trunk) seems to have fixed this[1].

Uninstall the version you have installed via easy_install and grab the
latest tar from the official site -
http://code.google.com/p/django-registration/.

-- 

Best,

R

[1] -
http://code.google.com/p/django-registration/source/browse/trunk/registration/forms.py#7

--~--~-~--~~~---~--~~
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-Registration and NewForms Error

2008-10-08 Thread Chris

I installed django-registration via easy_install, and followed the
directions for setting it up in my app, but when I go to /register, I
get the error:

  File "/usr/lib/python2.5/site-packages/django_registration-0.5-
py2.5.egg/registration/views.py", line 12, in 

  File "/usr/lib/python2.5/site-packages/django_registration-0.5-
py2.5.egg/registration/forms.py", line 7, in 

ImportError: cannot import name newforms

Does anyone know what would cause this error? The line it's
complaining about is "from django import forms", which if I try from
the command line imports just fine.

This is the urls.py I'm using:

from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from registration.views import activate
from registration.views import register

urlpatterns = patterns('',
(r'^account/activate/(?P\w+)/$',
activate,
{'template': 'templates/account_activate.html'}
),
(r'^account/login/$',
'django.contrib.auth.views.login',
{'template_name': 'templates/account_login.html'},
),
(r'^account/logout/$',
'django.contrib.auth.views.logout',
{'template_name': 'templates/account_logout.html'},
),
(r'^account/password/change/$',
'django.contrib.auth.views.password_change',
{'template_name': 'templates/account_password_change.html'}
),
(r'^account/password/change/done/$',
'django.contrib.auth.views.password_change_done',
{'template_name': 'templates/
account_password_change_done.html'}
),
(r'^account/password/reset/$',
'django.contrib.auth.views.password_reset',
{'template_name': 'templates/account_password_reset.html'}
),
(r'^account/password/reset/done/$',
'django.contrib.auth.views.password_reset_done',
{'template_name': 'templates/
account_password_reset_done.html'}
),
(r'^account/profile/$',
direct_to_template,
{'template': 'templates/account_profile.html'}
),
(r'^account/register/$',
register,
{'template': 'templates/account_register.html'},
   ),
   (r'^account/register/complete/$',
direct_to_template,
{'template': 'templates/account_registration_complete.html'},
   ),
)

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



ManyToMany relation and admin newforms

2008-09-30 Thread Jens

Hello django-users,

after searching google and this group and not finding any helpful
answers I hope you can help me.
I am making an event-app which allows me to manage my own events I
organize for me and my friends.

I add my friends to the database. Then I create an event and choose
which friends I want to invite. The app sends mails to these friends
with a url to the event. They can decide by their own if they want to
join.

There are a model for events and for attendees. In addition I made an
intermediary table by myself:

Code:
-
class EventAttendeeList(models.Model):
  event_id = models.ForeignKey(Event)
  attendee_id = models.ForeignKey(Attendee)
  is_enrolled = models.BooleanField(default=False, editable=False)

  class Meta:
db_table = 'events_attendee_list'
-

If a friend of mine decides to attend he checks his own name in a list
of possible attendees (yes I trust my dudes). So I dont really need to
edit the "is_enrolled" field in admin.

The default m2m widget with the multiple-select field was perfect :
( But now its gone and I have to use this inline stuff:

Code:
-
class AttendeeListInline(admin.TabularInline):
  model = EventAttendeeList

class EventAdmin(admin.ModelAdmin):
  inlines = [AttendeeListInline,]

admin.site.register(Event, EventAdmin)
-

I only want the default widget back :(
Does anyone know how to achieve that without much work? I want to keep
things simple.

Thank you so far
Jens from Germany

--~--~-~--~~~---~--~~
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: No delete in newforms-admin

2008-09-29 Thread krylatij

Add extra variable to the context in this way:
http://code.djangoproject.com/wiki/NewformsHOWTO#Q:HowcanIpassextracontextvariablesintomyaddandchangeviews
then override your submit_line.html template and put into it something
like that:

{% if my_show_delete_link %}
{% if show_delete_link %}{% trans "Delete" %}{% endif %}
{% endif %}

Hope this helps.


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



No delete in newforms-admin

2008-09-29 Thread [EMAIL PROTECTED]

I like that there's a "delete" checkbox with NFA, but what if I don't
want the item to be delete-able? I have a case where I'm they're an
inline, and I don't want anyone to be able to delete those items
unless the parent is deleted. Can this be done?
--~--~-~--~~~---~--~~
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 admin and custom widgets

2008-09-17 Thread Rob Hudson

I was playing with this again tonight and it's just not working for me
no matter what I try.  I'm wondering if there are issues with
ManyToMany and Inlines and trying to override them?


On Jul 24, 5:23 pm, "Rob Hudson" <[EMAIL PROTECTED]> wrote:
> > SpecialBookFormSet = inlineformset_factory(Newsletter, Special,
> > form=SpecialBookForm)
>
> > [1]:http://www.djangoproject.com/documentation/modelforms/#model-formsets
>
> Hmm... I'm still not able to get it to work.  I think I'll try to
> whittle my code down to an example that I can play with and post a
> without all the clutter of my real code.
>
> I suppose I should first create a custom model field without it being
> an inline and make sure I understand that, and then bring it (and my
> new found understanding) over to extending that towards an inline
> custom model field and custom widget.
>
> -Rob
--~--~-~--~~~---~--~~
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: AlreadyRegistered Exception after newforms-admin merge

2008-09-10 Thread ryan

Good catch. Thank you

On Aug 3, 10:14 pm, "Pedro Valente" <[EMAIL PROTECTED]> wrote:
> I'm not sure if it's your case, but I got the AlreadyRegistered errors
> because before the merge I used the NFA branch and had an admin import
> inside __init__.py (not needed anymore).
>
> I had forgotten about that, and after I got rid of if my app worked fine.
>
> Pedro Valente
>
> On Sun, Aug 3, 2008 at 14:19, Brian Morton <[EMAIL PROTECTED]> wrote:
>
> > As my original post states, my admin registration calls are all in
> > admin.py for each app.  No admin declarations or registrations are
> > going on in my models.
>
> > On Aug 3, 5:55 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > wrote:
> > > The correct way to handle it is to put all your admin stuff inside
> > > admin.py for each application and than follow these directions:
> >http://www.djangoproject.com/documentation/admin/#hooking-adminsite-i...
>
> > > On Aug 3, 3:32 am, Ludwig <[EMAIL PROTECTED]> wrote:
>
> > > > I encountered the same exception -- it is triggered when, assuming your
> > > > admin registration takes place in models.py, is imported by something
> > else,
> > > > e.g. template tags, inclusion into another model.
>
> > > > A try/except block around the admin registration will suppress this.
>
> > > > While I consider this an inelegant hack, I am not sufficiently steeped
> > in
> > > > the logic of the admin registration to say that such multiple
> > registration
> > > > should or should not trigger an exception. Maybe the developers could
> > > > suggest the right pattern for this.
>
> > > > HTH
>
> > > > Ludwig
>
> > > > 2008/8/2 Brian Morton <[EMAIL PROTECTED]>
>
> > > > > Using revision 8194 from TRUNK (the latest as of writing this post),
> > I
> > > > > am encountering AlreadyRegistered while starting my application.  I
> > > > > have all ModelAdmin definitions in admin.py for my two applications.
> > > > > App2's models file references the app1's model with an import (like
> > in
> > > > >http://code.djangoproject.com/ticket/6776).  However, I am still
> > > > > getting exceptions about each one of my models from app1 being
> > already
> > > > > registered.  If I comment out the admin.site.register lines in
> > > > > app1.admin, only about 1/3 of my models appear in the admin.
>
> > > > > Any ideas what might be causing this?
>
>

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



Re: newforms problem

2008-09-01 Thread Jesse

I have to say, I discovered my own problem, as usually happens
directly after I make a post for help.

The documentation has listed:

Model FieldForms Field
TextFieldCharField with widget=Textarea

I tried that to no avail. Eventually I found a snippet of code with
google where someone had specified widget=forms.Textarea, which worked
fine.

My apologies.

On Sep 1, 9:48 pm, Jesse <[EMAIL PROTECTED]> wrote:
> I'm terribly new and inexperienced, and after 30-40 minutes of
> googling I cannot find anything to help my problem:
>
> class roomForm(forms.Form):
>         authorName = forms.CharField(max_length = "30")
>         authorWebsite = forms.CharField(max_length = "50")
>         title = forms.CharField(max_length = "30")
>         content = forms.TextField()
>
> That forms.TextField() is getting me an error. I saw and tried various
> other things, which were probably legacy stuff, like
> TextField(widget=TextArea) or something to that effect.
>
> Anyhow, I appreciate any help.
>
> Also, is this somewhere in the documentation? I couldn't find 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
-~--~~~~--~~--~--~---



newforms problem

2008-09-01 Thread Jesse

I'm terribly new and inexperienced, and after 30-40 minutes of
googling I cannot find anything to help my problem:

class roomForm(forms.Form):
authorName = forms.CharField(max_length = "30")
authorWebsite = forms.CharField(max_length = "50")
title = forms.CharField(max_length = "30")
content = forms.TextField()


That forms.TextField() is getting me an error. I saw and tried various
other things, which were probably legacy stuff, like
TextField(widget=TextArea) or something to that effect.

Anyhow, I appreciate any help.

Also, is this somewhere in the documentation? I couldn't find 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
-~--~~~~--~~--~--~---



Customizing newforms-admin -- collapsing apps?

2008-08-20 Thread [EMAIL PROTECTED]

Has anyone customized the admin (specifically with newforms-admin) to
collapse/expand apps? I'd like to keep them out of the way as much as
possible. I'm thinking some javascript that would expand/collapse them
and store the preference in a cookie or the session. Is this a dumb
idea? Has anyone done it and care to share how?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Workflow Building with NewForms, ModelForm

2008-08-18 Thread DoctorMO

Hello All,

This is just a quick FYI to state what I'm currently working on and
see if anyone has anything to add or good ideas (or even criticisms)

Since django can do model forms which reflect a models fields and save
the created object appropriately. I'm researching the possibility of
creating some structures to manage workflows which would ultimately be
a collection of model forms which would save inter-referencing models.

The functionality it needs to do is, pass data from each step and save
when the process is complete (not before); be able to model process
level data entry so you could specify interesting relationships.

I don't know what will come out of my work, but I'm hoping to build
something useful for organisational software.

Best Regards, Martin Owens
--~--~-~--~~~---~--~~
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 generic and hidden fields in form

2008-07-25 Thread hotani

I had a form that was working with oldforms generic and had some
hidden fields. After the newforms-admin merge and newforms-generic,
the hidden fields are being passed as NULL. In
'BackwardsIncompatibleChanges,' it says "You'll probably need to
update any templates used by these views."

So what exactly needs to be updated? Should I rewrite this as a manual
form? Is this documented somewhere and I'm missing 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
-~--~~~~--~~--~--~---



django-tagging and newforms admin

2008-07-25 Thread eka

Hi,

Any one knows if the newforms-admin branch of the django-tagging
project is merged in the trunk? or they will continue to update on
that branch?

Regars.
--~--~-~--~~~---~--~~
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-admin weird error ( 'str' object has no attribute '_default_manager' )

2008-07-25 Thread vv2

I am experiencing same error message with r8053, however my situation
is a bit different:
- commenting out fieldsets definition doesn't help,
- everything works perfectly on local dev server and fails deployed
through mod_wsgi and mod_python (I didn't try with fcgi)

I managed to narrow down the problem to two models that are causing
the problem, both have custom managers and one have overriden queryset
method.

Any help would be highly appreciated as I spent a lot of time on
chasing this and really have no idea where I could look for possible
solution.

Thanks,
Maciek

Traceback:
File "/web/django-trunk/django/core/handlers/base.py" in get_response
  77. callback, callback_args, callback_kwargs =
resolver.resolve(
File "/web/django-trunk/django/core/urlresolvers.py" in resolve
  238. for pattern in self.urlconf_module.urlpatterns:
File "/web/django-trunk/django/core/urlresolvers.py" in
_get_urlconf_module
  262. raise ImproperlyConfigured, "Error while
importing URLconf %r: %s" % (self.urlconf_name, e)

Exception Type: ImproperlyConfigured at /
Exception Value: Error while importing URLconf 'urls': 'str' object
has no attribute '_default_manager'
--~--~-~--~~~---~--~~
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-admin weird error ( 'str' object has no attribute '_default_manager' )

2008-07-25 Thread Bram de Jong

On Fri, Jul 18, 2008 at 5:45 PM, Karen Tracey <[EMAIL PROTECTED]> wrote:
>
> Determining which part of the fieldsets definition generates the error would
> be helpful.  You might be able to determine it by looking at the local vars
> in the debug page.  Alternatively you could experiment with removing pieces
> of it to see which field is causing the error.  Basic fieldsets validation
> works (I'm sure it's got tests and I have models that use it and still work
> on current newforms-admin), so it's something specific to your model.  If
> you could strip your models down to a reasonably simple testcase that
> displays the error it would be helpful.

Sorry for not replying this earlier.
Splitting my admin settings into admin.py modules, and updating to the
latest trunk fixed this problem.


 - 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: Newforms admin problem: TemplateSyntaxError at /admin/

2008-07-24 Thread Florencio Cano

In fact it was not the solution. I though that it was because when I
browsed to localhost:8000/admin/ I saw the login form but after
logging in the error appeared another time.

Today I'm going to start a project from the beggining and I'm going to
copy the files one by one trying to isolate the error.

2008/7/21 Karen Tracey <[EMAIL PROTECTED]>:

>> Uhm, the solution was to delete the database and recreate it. Now it
>> runs correctly.
>
> Note this sort of thing (delete/recreate database) IS NOT generally
> necessary for updating to the newforms admin code, which is now in trunk.
> Sorry, I have not had time to look in detail at the problem you were having
> but if anyone else hits a similar thing it would be good to figure out what
> was actually going on, if possible.  Delete/recreate the database is not
> something that should be required to migrate to the new code.
>
> Karen

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



Re: URL problems after newforms admin migration

2008-07-24 Thread Karen Tracey
On Tue, Jul 22, 2008 at 2:17 PM, Matthew <[EMAIL PROTECTED]> wrote:

>
> Hey everyone, I recently updated a development version of my Django
> site to use the newforms admin, following the tutorial here
>
> http://oebfare.com/blog/2008/jul/20/newforms-admin-migration-and-screencast/
> It all went fairly well, but I do have one major problem though, and I
> don't know whether its connected to this. I suspect it is anyway
> because it only arose after migration.
>
> The problem is that whenever I am editing in the admin site, and I
> click on a 'Save' button for instance, I get a 404 error.
>
> "Page not found (404)
> Request Method: GET
> Request URL:
> http://10.2.140.72:2013/main.fcgi/main.fcgi/admin/events/event/2/;
>
> Obviously it appears that the admin is trying to redirect me to an
> address such as /main.fcgi/main.fcgi/admin/events/event/2/ rather
> than /admin/events/event/2/
>
> After getting the 404, if I remove the /main.fcgi/ from the address
> and go to /admin/events/event/2/ I get to the correct page. The
> changes that are to be saved are actually being saved too, but
> obviously this is a big hindrance to a smooth site running.
>
> Can anyone help, or is this something unrelated to the newforms admin?
>

Not sure, but it might be related to this change:

http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#ChangedthewayURLpathsaredetermined

rather than newforms-admin.

Karen

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



Re: Custom permission problem in newforms-admin

2008-07-23 Thread Brandon Taylor

Doh! You're absolutely right Malcom. Sorry, don't know why I didn't
see that before.

So, now that I have my lovely permission, I have a new problem...
I need the ability to let a user 'add' a story, even if they can't
'approve' one. So, I'm wondering where I should try to disable the
field? In the model, or in the change_form? I'm not very experienced
in customizing the admin, but am very eager to learn.

Kind regards,
Brandon

On Jul 21, 5:50 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Mon, 2008-07-21 at 15:46 -0700, Brandon Taylor wrote:
> > Hi everyone,
>
> > I'm trying to enforce a customer permission on Add/Update. In my
> > model, I have defined the permission:
>
> > permissions = (
> >                        ('can_approve_stories','Can Approve Stories'),
> >         )
>
> > in my model.ModelAdmin I have:
>
> > def change_view(self, request, obj_id):
> >         if request.user.has_perm('can_approve_stories'):
> >             return super(StoryAdmin, self).change_view(request,
> > obj_id)
> >         else:
> >             raise PermissionDenied
>
> >     def add_view(self, request, obj_id):
> >         if request.user.has_perm('can_approve_stories'):
> >             return super(StoryAdmin, self).add_view(request, obj_id)
> >         else:
> >             raise PermissionDenied
>
> > The change_view permission is working. The add_view thrown an error:
>
> > TypeError at /admin/stories/story/add/
> > add_view() takes exactly 3 arguments (2 given)
>
> > Can someone please show me what I'm doing wrong?
>
> At a guess: if you're adding an object, passing in the object_id doesn't
> make a lot of sense (the object doesn't exist yet).
>
> 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
-~--~~~~--~~--~--~---



Re: Migrating to newforms-admin and classes already registered error

2008-07-22 Thread Peter Bailey

That works much better Malcolm, thank you very much. Appreciate the
explanations too.

Cheers,

Peter


On Jul 22, 3:23 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2008-07-22 at 12:21 -0700, Peter Bailey wrote:
> > Hi all. I am attempting to convert an app I am writing to use the nfa.
> > I have looked at all the docs available about this, but must have
> > missed something. I am using:
>
> > Django version 1.0-alpha-SVN-8053
>
> > Anyway, I have changed my urls.py file to be like so:
>
> > from django.contrib import admin
>
> >     (r'^admin/(.*)', admin.site.root),  # in urlpatterns
>
> > and in my models file I have:
>
> > from django.contrib import admin
>
> > and then after my Page class declaration I have
>
> > admin.site.register(Page)
>
> > which creates the following error at runtime:
>
> > ImproperlyConfigured at /
> > Error while importing URLconf 'generator.urls': The model Page is
> > already registered
>
> > I have tried using the autodiscover and not using it - same result - I
> > also see some people are using an admin.py file and some are just
> > modifying the model.py file.
>
> > Can anyone point me at some info or tell me what I am doing wrong.
> > Feeling kinda stupid about now...
>
> The recommended approach (and the reason for autodiscover()) is to put
> the admin classes and registration into admin.py. Your models.py files
> are imported more than once, which is leading to the duplicate
> registration error (which is a real error in other situations, which is
> why it exists).
>
> Putting things in admin.py is a way to make sure they're only registered
> once.
>
> 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
-~--~~~~--~~--~--~---



Re: URL problems after newforms admin migration

2008-07-22 Thread Matthew

Hmm, unfortunately I'm running this test environment on a Media Temple
Gridserver container, so I have no access to the httpd.conf for
changing stuff like that :( I'm not too bothered with the problem
whilst I'm testing it, but I wouldn't want this to crop up when I'm
trying to move it all across to my "production" server :\

That link does seem similar to trouble I'm having though, thanks for
that Karen.

On 22 Jul, 21:30, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Tue, Jul 22, 2008 at 2:17 PM, Matthew <[EMAIL PROTECTED]> wrote:
>
> > Hey everyone, I recently updated a development version of my Django
> > site to use the newforms admin, following the tutorial here
>
> >http://oebfare.com/blog/2008/jul/20/newforms-admin-migration-and-scre...
> > It all went fairly well, but I do have one major problem though, and I
> > don't know whether its connected to this. I suspect it is anyway
> > because it only arose after migration.
>
> > The problem is that whenever I am editing in the admin site, and I
> > click on a 'Save' button for instance, I get a 404 error.
>
> > "Page not found (404)
> > Request Method:         GET
> > Request URL:
> >http://10.2.140.72:2013/main.fcgi/main.fcgi/admin/events/event/2/;
>
> > Obviously it appears that the admin is trying to redirect me to an
> > address such as /main.fcgi/main.fcgi/admin/events/event/2/ rather
> > than /admin/events/event/2/
>
> > After getting the 404, if I remove the /main.fcgi/ from the address
> > and go to /admin/events/event/2/ I get to the correct page. The
> > changes that are to be saved are actually being saved too, but
> > obviously this is a big hindrance to a smooth site running.
>
> > Can anyone help, or is this something unrelated to the newforms admin?
>
> Not sure, but it might be related to this change:
>
> http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Chang...
>
> rather than newforms-admin.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: superuser has no rights with newforms admin

2008-07-22 Thread stranger

I am using django (revision 8055.). after updating the site seems to
work fine but the admin panel still shows me

You don't have permission to edit anything.

I do have admin.autodiscover() and induvidually registered models in
admin.py in all apps. I tried commenting out the admin.site.register()
but it still shows me permission denied. I am the only super user on
the site. Any recommendations.




On Jul 21, 12:46 am, "Justin Wong" <[EMAIL PROTECTED]> wrote:
> Never mind,newforms-adminworks great. :)
>
> I forgot that I had copied a custom version of the old admin templates
> and it was parsing that instead.
>
> Cheers!
> Justin
>
> On Sun, Jul 20, 2008 at 7:27 PM, Justin Wong <[EMAIL PROTECTED]> wrote:
> > Well, I tracked down the admin/index.html page and I see that it
> > checks the variable app_list.
>
> > Going to django/contrib/admin/sites.py, I put a print statement to
> > print out my app_list.  Can anyone spot anything wrong?
>
> > [   {   'has_module_perms': True,
> >        'models': [   {   'admin_url': 'auth/group/',
> >                          'name':  > object at 0x89ad60c>,
> >                          'perms': {   'add': True,
> >                                       'change': True,
> >                                       'delete': True}},
> >                      {   'admin_url': 'auth/user/',
> >                          'name':  > object at 0x89ad80c>,
> >                          'perms': {   'add': True,
> >                                       'change': True,
> >                                       'delete': True}}],
> >        'name': 'Auth'},
> >    {   'has_module_perms': True,
> >        'models': [   {   'admin_url': 'blog/entry/',
> >                          'name': u'Entries',
> >                          'perms': {   'add': True,
> >                                       'change': True,
> >                                       'delete': True}}],
> >        'name': 'Blog'},
> >    {   'has_module_perms': True,
> >        'models': [   {   'admin_url': 'database/article/',
> >                          'name':  > object at 0x89adfac>,
> >                          'perms': {   'add': True,
> >                                       'change': True,
> >                                       'delete': True}},
> >                      {   'admin_url': 'database/artist/',
> >                          'name':  > object at 0x89ada8c>,
> >                          'perms': {   'add': True,
> >                                       'change': True,
> >                                       'delete': True}},
> >                      {   'admin_url': 'database/dictionary/',
> >                          'name': u'Dictionary entries',
> >                          'perms': {   'add': True,
> >                                       'change': True,
> >                                       'delete': True}},
> >                      {   'admin_url': 'database/event/',
> >                          'name':  > object at 0x89ad68c>,
> >                          'perms': {   'add': True,
> >                                       'change': True,
> >                                       'delete': True}},
> >                      {   'admin_url': 'database/image/',
> >                          'name':  > object at 0x89ada6c>,
> >                          'perms': {   'add': True,
> >                                       'change': True,
> >                                       'delete': True}},
> >                      {   'admin_url': 'database/poem/',
> >                          'name':  > object at 0x8967e4c>,
> >                          'perms': {   'add': True,
> >                                       'change': True,
> >                                       'delete': True}},
> >                      {   'admin_url': 'database/signature/',
> >                          'name':  > object at 0x89addec>,
> >                          'perms': {   'add': True,
> >                                       'change': True,
> >                                       'delete': True}},
> >                      {   'admin_url': 'database/stamp/',
> >                          'name':  > object at 0x89ade0c>,
> >                          'perms': {   'add': True,
> >                                       'change': True,
> >                                       'delete': True}},
> >                      {   'admin_url': 'database/style/',
> >                          'name':  > object at 0x89ad98c&g

Migrating to newforms-admin and classes already registered error

2008-07-22 Thread Peter Bailey

Hi all. I am attempting to convert an app I am writing to use the nfa.
I have looked at all the docs available about this, but must have
missed something. I am using:

Django version 1.0-alpha-SVN-8053

Anyway, I have changed my urls.py file to be like so:

from django.contrib import admin

(r'^admin/(.*)', admin.site.root),  # in urlpatterns

and in my models file I have:

from django.contrib import admin

and then after my Page class declaration I have

admin.site.register(Page)

which creates the following error at runtime:

ImproperlyConfigured at /
Error while importing URLconf 'generator.urls': The model Page is
already registered

I have tried using the autodiscover and not using it - same result - I
also see some people are using an admin.py file and some are just
modifying the model.py file.

Can anyone point me at some info or tell me what I am doing wrong.
Feeling kinda stupid about now...

Thanks,

Peter



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



Extending Newforms Admin with functionality

2008-07-22 Thread gnijholt

Hello django-users,

What is the preferred way of extending the Admin interface with
functionality (not just a template override) (using the newforms
admin)? I ask because I'm trying to build something simple.

I have a model NewsletterSubscriber which has just a name, an active
boolean, and an e-mail field. Extending the 'change_list.html'
template enables me to display some sort of button within the 'object-
tools' block.

Now I'd like to attach functionality to this custom button. (I want to
loop through the mailinglist and send out mails)

Where do I start to look? Are there any guides that I've missed?

Thanks.
Gijs



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



Custom permission problem in newforms-admin

2008-07-22 Thread Brandon Taylor

Hi everyone,

I'm trying to enforce a customer permission on Add/Update. In my
model, I have defined the permission:

permissions = (
   ('can_approve_stories','Can Approve Stories'),
)



in my model.ModelAdmin I have:

def change_view(self, request, obj_id):
if request.user.has_perm('can_approve_stories'):
return super(StoryAdmin, self).change_view(request,
obj_id)
else:
raise PermissionDenied

def add_view(self, request, obj_id):
if request.user.has_perm('can_approve_stories'):
return super(StoryAdmin, self).add_view(request, obj_id)
else:
raise PermissionDenied


The change_view permission is working. The add_view thrown an error:

TypeError at /admin/stories/story/add/
add_view() takes exactly 3 arguments (2 given)

Can someone please show me what I'm doing wrong?

TIA,
Brandon
--~--~-~--~~~---~--~~
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: Custom permission problem in newforms-admin

2008-07-21 Thread [EMAIL PROTECTED]

I believe you can override get_form and have it create a new modelform
for each request, you'd probably have to look into the source to see
what the method and signature look like.


On Jul 21, 8:04 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote:
> Doh! You're absolutely right Malcom. Sorry, don't know why I didn't
> see that before.
>
> So, now that I have my lovely permission, I have a new problem...
> I need the ability to let a user 'add' a story, even if they can't
> 'approve' one. So, I'm wondering where I should try to disable the
> field? In the model, or in the change_form? I'm not very experienced
> in customizing the admin, but am very eager to learn.
>
> Kind regards,
> Brandon
>
> On Jul 21, 5:50 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>
> > On Mon, 2008-07-21 at 15:46 -0700, Brandon Taylor wrote:
> > > Hi everyone,
>
> > > I'm trying to enforce a customer permission on Add/Update. In my
> > > model, I have defined the permission:
>
> > > permissions = (
> > >                        ('can_approve_stories','Can Approve Stories'),
> > >         )
>
> > > in my model.ModelAdmin I have:
>
> > > def change_view(self, request, obj_id):
> > >         if request.user.has_perm('can_approve_stories'):
> > >             return super(StoryAdmin, self).change_view(request,
> > > obj_id)
> > >         else:
> > >             raise PermissionDenied
>
> > >     def add_view(self, request, obj_id):
> > >         if request.user.has_perm('can_approve_stories'):
> > >             return super(StoryAdmin, self).add_view(request, obj_id)
> > >         else:
> > >             raise PermissionDenied
>
> > > The change_view permission is working. The add_view thrown an error:
>
> > > TypeError at /admin/stories/story/add/
> > > add_view() takes exactly 3 arguments (2 given)
>
> > > Can someone please show me what I'm doing wrong?
>
> > At a guess: if you're adding an object, passing in the object_id doesn't
> > make a lot of sense (the object doesn't exist yet).
>
> > 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
-~--~~~~--~~--~--~---



Re: Newforms admin problem: TemplateSyntaxError at /admin/

2008-07-21 Thread Florencio Cano

Uhm, the solution was to delete the database and recreate it. Now it
runs correctly.

2008/7/21 Florencio Cano <[EMAIL PROTECTED]>:
> Hi,
> After viewing the new documentation for the admin interface and
> modifying, properly I think, the files when I try to access
> http://localhost:8000/admin/ I get a template problem that seems to be
> caused because 'user' is not found in the context of the template. I
> did not changed anything in the template, and the template is an admin
> template. Here is all the info.

--~--~-~--~~~---~--~~
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 admin problem: TemplateSyntaxError at /admin/

2008-07-21 Thread Karen Tracey
On Mon, Jul 21, 2008 at 10:59 AM, Florencio Cano <[EMAIL PROTECTED]>
wrote:

>
> Uhm, the solution was to delete the database and recreate it. Now it
> runs correctly.
>

Note this sort of thing (delete/recreate database) IS NOT generally
necessary for updating to the newforms admin code, which is now in trunk.
Sorry, I have not had time to look in detail at the problem you were having
but if anyone else hits a similar thing it would be good to figure out what
was actually going on, if possible.  Delete/recreate the database is not
something that should be required to migrate to the new code.

Karen


>
> 2008/7/21 Florencio Cano <[EMAIL PROTECTED]>:
> > Hi,
> > After viewing the new documentation for the admin interface and
> > modifying, properly I think, the files when I try to access
> > http://localhost:8000/admin/ I get a template problem that seems to be
> > caused because 'user' is not found in the context of the template. I
> > did not changed anything in the template, and the template is an admin
> > template. Here is all the info.
>
> >
>

--~--~-~--~~~---~--~~
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: Custom permission problem in newforms-admin

2008-07-21 Thread Malcolm Tredinnick


On Mon, 2008-07-21 at 15:46 -0700, Brandon Taylor wrote:
> Hi everyone,
> 
> I'm trying to enforce a customer permission on Add/Update. In my
> model, I have defined the permission:
> 
> permissions = (
>('can_approve_stories','Can Approve Stories'),
> )
> 
> 
> 
> in my model.ModelAdmin I have:
> 
> def change_view(self, request, obj_id):
> if request.user.has_perm('can_approve_stories'):
> return super(StoryAdmin, self).change_view(request,
> obj_id)
> else:
> raise PermissionDenied
> 
> def add_view(self, request, obj_id):
> if request.user.has_perm('can_approve_stories'):
> return super(StoryAdmin, self).add_view(request, obj_id)
> else:
> raise PermissionDenied
> 
> 
> The change_view permission is working. The add_view thrown an error:
> 
> TypeError at /admin/stories/story/add/
> add_view() takes exactly 3 arguments (2 given)
> 
> Can someone please show me what I'm doing wrong?

At a guess: if you're adding an object, passing in the object_id doesn't
make a lot of sense (the object doesn't exist yet).

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



Re: How to display UserProfiles in newforms-admin

2008-07-21 Thread [EMAIL PROTECTED]

On Jul 20, 4:22 pm, slav0nic <[EMAIL PROTECTED]> wrote:
> #admin.py
> from django.contrib import admin
> from profile.models import UserProfile
> from django.contrib.auth.models import User
>
> class ProfileInline(admin.StackedInline):
> model = UserProfile
> extra = 1
> max_num = 1
>
> class ProfileAdmin(admin.ModelAdmin):
> inlines = (ProfileInline,)
>
> admin.site.unregister(User)  #!!!
> admin.site.register(User, ProfileAdmin)
>
> ;)

Doing this will wipe out the rest of the admin settings for the User
moel, unfortunate.y It would be better for the ProfileAdmin to
subclass django.contrib.auth.admin.UserAdmin so that all the other
settings are retained.
--~--~-~--~~~---~--~~
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 display UserProfiles in newforms-admin

2008-07-21 Thread Bernd Donner

In the old version of the admin site the fields of the UserProfile could be 
displayed "inline" on the corresponding User page of the admin site. This was 
done by somthing like:

class UserProfile(models.Model):
  ...
  user = models.ForeignKey(User, unique=True, edit_inline=models.STACKED)

How can the same effect be achieved with newforms-admin?

Thanks for your help,
Bernd Donner

--~--~-~--~~~---~--~~
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: superuser has no rights with newforms admin

2008-07-21 Thread Justin Wong

Never mind, newforms-admin works great. :)

I forgot that I had copied a custom version of the old admin templates
and it was parsing that instead.

Cheers!
Justin


On Sun, Jul 20, 2008 at 7:27 PM, Justin Wong <[EMAIL PROTECTED]> wrote:
> Well, I tracked down the admin/index.html page and I see that it
> checks the variable app_list.
>
> Going to django/contrib/admin/sites.py, I put a print statement to
> print out my app_list.  Can anyone spot anything wrong?
>
> [   {   'has_module_perms': True,
>'models': [   {   'admin_url': 'auth/group/',
>  'name':  object at 0x89ad60c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'auth/user/',
>  'name':  object at 0x89ad80c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}}],
>'name': 'Auth'},
>{   'has_module_perms': True,
>'models': [   {   'admin_url': 'blog/entry/',
>  'name': u'Entries',
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}}],
>'name': 'Blog'},
>{   'has_module_perms': True,
>'models': [   {   'admin_url': 'database/article/',
>  'name':  object at 0x89adfac>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/artist/',
>  'name':  object at 0x89ada8c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/dictionary/',
>  'name': u'Dictionary entries',
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/event/',
>  'name':  object at 0x89ad68c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/image/',
>  'name':  object at 0x89ada6c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/poem/',
>  'name':  object at 0x8967e4c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/signature/',
>  'name':  object at 0x89addec>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/stamp/',
>  'name':  object at 0x89ade0c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/style/',
>  'name':  object at 0x89ad98c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/word/',
>  'name':  object at 0x89ad92c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/work/',
>  'name':  object at 0x893c24c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/year/',
>  'name':  object at 0x8967f4c&

Re: How to display UserProfiles in newforms-admin

2008-07-21 Thread Malcolm Tredinnick


On Sun, 2008-07-20 at 21:35 +0200, Bernd Donner wrote:
> In the old version of the admin site the fields of the UserProfile could be 
> displayed "inline" on the corresponding User page of the admin site. This was 
> done by somthing like:
> 
> class UserProfile(models.Model):
>   ...
>   user = models.ForeignKey(User, unique=True, edit_inline=models.STACKED)
> 
> How can the same effect be achieved with newforms-admin?

Have you searched for the word "inline" in the admin documentation (or
the backwards incompatible changes entry for this change)? That should
lead you to the section about the InlineModelAdmin class.

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



Re: superuser has no rights with newforms admin

2008-07-20 Thread Justin Wong
': {   'add': True,
   'change': True,
   'delete': True}},
  {   'admin_url': 'market/order/',
  'name': ,
  'perms': {   'add': True,
   'change': True,
   'delete': True}},
  {   'admin_url': 'market/product/',
  'name': ,
  'perms': {   'add': True,
   'change': True,
   'delete': True}}],
'name': 'Market'},
{   'has_module_perms': True,
'models': [   {   'admin_url': 'sites/site/',
  'name': ,
  'perms': {   'add': True,
   'change': True,
   'delete': True}}],
'name': 'Sites'}]


Cheers!
Justin



On Sun, Jul 20, 2008 at 5:24 PM, Justin Wong <[EMAIL PROTECTED]> wrote:
> Hello!
>
> I'm still getting the "You don't have permission to edit anything."
> message and I'm kinda stumped. I am using Django changelist 8012,
> which should be post merge.
>
> I put print right before the __import__ statement and it seems like
> the admin.py files for auth, sites, and my apps are being imported
> correctly. I'm not getting error messages telling me that I'm
> importing multiple times.
>
> I'm logged on as the superuser, so that shouldn't be a problem... right?
>
> I started a new project and newforms-admin seems to work great.
>
> If anyone has any more suggestions, it'd be great! (What file is this
> message from?)
>
>
> Cheers!
> Justin
>
>
> On Sun, Jul 20, 2008 at 6:21 AM, Karen Tracey <[EMAIL PROTECTED]> wrote:
>> On Sun, Jul 20, 2008 at 9:11 AM, eka <[EMAIL PROTECTED]> wrote:
>>>
>>> Hi
>>>
>>> I'm installing it from SVN and got "You don't have permission to edit
>>> anything", I made it work before, but now when I try to follow the
>>> book can't. Could you tell me what should I add to have full
>>> permissions?
>>
>> I have no idea what is going on in cases where people have
>> admin.autodiscover() in their urls.py yet still get this "You don't have
>> permission to edit anything" message.  I'd suggest you put a print statement
>> in django/contrib/admin/__init__.py after the __import__ in autodiscover()
>> and verify that the auth app, at a minimum, is being found by
>> autodiscover(). If not put a print in before the import and ensure
>> adutodiscover() is really being called and attempting to import the admin
>> module for each installed app.
>>
>> (Also I'm not sure what 'book' is being referred to here, since there's
>> certainly nothing printed that covers newforms-admin.  Even the tutorial, I
>> believe, is still missing mention of autodiscover(), which means if you are
>> following it exactly that may be why you are getting this message.)
>>
>> Karen
>>
>>
>>>
>>> Regards
>>> On Jul 20, 7:43 am, "Jon Atkinson" <[EMAIL PROTECTED]> wrote:
>>> > On Sun, Jul 20, 2008 at 2:01 AM, stryderjzw <[EMAIL PROTECTED]>
>>> > wrote:
>>> >
>>> > > Strange, I'm getting the message "You don't have permission to edit
>>> > > anything." on the admin homepage. I've done admin.autodiscover() on
>>> > > the project urls page, I've created admin.py files for my models and
>>> > > registered the classes with admin.site.register().
>>> >
>>> > Same here (having followed the earlier advice on the list). Is there
>>> > any more useful information which I could post to help debug this?
>>> >
>>> > --Jon
>>>
>>
>>
>> >>
>>
>

--~--~-~--~~~---~--~~
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: superuser has no rights with newforms admin

2008-07-20 Thread Justin Wong

Hello!

I'm still getting the "You don't have permission to edit anything."
message and I'm kinda stumped. I am using Django changelist 8012,
which should be post merge.

I put print right before the __import__ statement and it seems like
the admin.py files for auth, sites, and my apps are being imported
correctly. I'm not getting error messages telling me that I'm
importing multiple times.

I'm logged on as the superuser, so that shouldn't be a problem... right?

I started a new project and newforms-admin seems to work great.

If anyone has any more suggestions, it'd be great! (What file is this
message from?)


Cheers!
Justin


On Sun, Jul 20, 2008 at 6:21 AM, Karen Tracey <[EMAIL PROTECTED]> wrote:
> On Sun, Jul 20, 2008 at 9:11 AM, eka <[EMAIL PROTECTED]> wrote:
>>
>> Hi
>>
>> I'm installing it from SVN and got "You don't have permission to edit
>> anything", I made it work before, but now when I try to follow the
>> book can't. Could you tell me what should I add to have full
>> permissions?
>
> I have no idea what is going on in cases where people have
> admin.autodiscover() in their urls.py yet still get this "You don't have
> permission to edit anything" message.  I'd suggest you put a print statement
> in django/contrib/admin/__init__.py after the __import__ in autodiscover()
> and verify that the auth app, at a minimum, is being found by
> autodiscover(). If not put a print in before the import and ensure
> adutodiscover() is really being called and attempting to import the admin
> module for each installed app.
>
> (Also I'm not sure what 'book' is being referred to here, since there's
> certainly nothing printed that covers newforms-admin.  Even the tutorial, I
> believe, is still missing mention of autodiscover(), which means if you are
> following it exactly that may be why you are getting this message.)
>
> Karen
>
>
>>
>> Regards
>> On Jul 20, 7:43 am, "Jon Atkinson" <[EMAIL PROTECTED]> wrote:
>> > On Sun, Jul 20, 2008 at 2:01 AM, stryderjzw <[EMAIL PROTECTED]>
>> > wrote:
>> >
>> > > Strange, I'm getting the message "You don't have permission to edit
>> > > anything." on the admin homepage. I've done admin.autodiscover() on
>> > > the project urls page, I've created admin.py files for my models and
>> > > registered the classes with admin.site.register().
>> >
>> > Same here (having followed the earlier advice on the list). Is there
>> > any more useful information which I could post to help debug this?
>> >
>> > --Jon
>>
>
>
> >
>

--~--~-~--~~~---~--~~
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: superuser has no rights with newforms admin

2008-07-20 Thread Karen Tracey
On Sun, Jul 20, 2008 at 12:01 PM, Jon Atkinson <[EMAIL PROTECTED]>
wrote:

> I've uploaded my complete project tree (it's fairly small, and I've
> included the sqlite database). The admin username and password is
> 'test'. It's available at:
>
> http://jonatkinson.co.uk/static/junk/myproj.zip
>
> FWIW, I'm using SVN trunk at revision 7951. I realise that asking
> anyone to download and run my project just to help me fix a problem is
> quite a presumptious request, but I live in hope :-)
>

I downloaded the zip file, unzipped it, ran the development server, and all
went to my localhost admin page and I have 'Auth', 'People' and 'Sites' I
can edit.  I'm running trunk r8007.

You can't really be using trunk 7951 -- that's from before newforms-admin
merge which was 7967??  Try updating to latest trunk?

Karen

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



Re: How to display UserProfiles in newforms-admin

2008-07-20 Thread Adi J. Sieker

On Sun, 20 Jul 2008 21:35:44 +0200, Bernd Donner <[EMAIL PROTECTED]>  
wrote:

> In the old version of the admin site the fields of the UserProfile could  
> be
> displayed "inline" on the corresponding User page of the admin site.  
> This was
> done by somthing like:
>
> class UserProfile(models.Model):
>   ...
>   user = models.ForeignKey(User, unique=True, edit_inline=models.STACKED)
>
> How can the same effect be achieved with newforms-admin?

The docs know all:  
http://www.djangoproject.com/documentation/admin/#inlinemodeladmin-objects

That should probably help you.

adi



-- 
Adi J. Sieker mobile: +49 - 178 - 88 5 88 13
Freelance developer   skype:  adijsieker
SAP-Consultantweb:http://www.sieker.info/profile
   openbc: https://www.openbc.com/hp/AdiJoerg_Sieker/

--~--~-~--~~~---~--~~
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 display UserProfiles in newforms-admin

2008-07-20 Thread [EMAIL PROTECTED]

As long as it works(which I have every reason to believe it does), yes
that looks like the best solution.

On Jul 20, 4:25 pm, Bernd Donner <[EMAIL PROTECTED]> wrote:
> Thanks for the link. Since UserAdmin is not directly under my control I came
> up with the following solution:
>
> from django.contrib.auth.admin import UserAdmin
>
> class UserProfile(models.Model):
>   ...
>   user = models.ForeignKey(User, unique=True, core=True)
>
> class UserProfileInline(admin.StackedInline):
>   model = UserProfile
>   max_num = 1
>
> class UserAndProfileAdmin(UserAdmin):
>   inlines = [UserProfileInline, ]
>
> admin.site.unregister(User)
> admin.site.register(User, UserAndProfileAdmin)
>
> is that the "best" solution?
>
> Thanks,
> Bernd Donner
>
> On Sunday 20 July 2008 22:06:19 Adi J. Sieker wrote:
>
> > On Sun, 20 Jul 2008 21:35:44 +0200, Bernd Donner <[EMAIL PROTECTED]>
>
> > wrote:
> > > In the old version of the admin site the fields of the UserProfile could
> > > be
> > > displayed "inline" on the corresponding User page of the admin site.
> > > This was
> > > done by somthing like:
>
> > > class UserProfile(models.Model):
> > >   ...
> > >   user = models.ForeignKey(User, unique=True, edit_inline=models.STACKED)
>
> > > How can the same effect be achieved with newforms-admin?
>
> > The docs know all:
> >http://www.djangoproject.com/documentation/admin/#inlinemodeladmin-ob...
>
> > That should probably help you.
>
> > adi
>
>
--~--~-~--~~~---~--~~
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 display UserProfiles in newforms-admin

2008-07-20 Thread Bernd Donner

Thanks for the link. Since UserAdmin is not directly under my control I came 
up with the following solution:

from django.contrib.auth.admin import UserAdmin

class UserProfile(models.Model):
  ...
  user = models.ForeignKey(User, unique=True, core=True)


class UserProfileInline(admin.StackedInline):
  model = UserProfile
  max_num = 1


class UserAndProfileAdmin(UserAdmin):
  inlines = [UserProfileInline, ]


admin.site.unregister(User)
admin.site.register(User, UserAndProfileAdmin)


is that the "best" solution?


Thanks,
Bernd Donner



On Sunday 20 July 2008 22:06:19 Adi J. Sieker wrote:
> On Sun, 20 Jul 2008 21:35:44 +0200, Bernd Donner <[EMAIL PROTECTED]>
>
> wrote:
> > In the old version of the admin site the fields of the UserProfile could
> > be
> > displayed "inline" on the corresponding User page of the admin site.
> > This was
> > done by somthing like:
> >
> > class UserProfile(models.Model):
> >   ...
> >   user = models.ForeignKey(User, unique=True, edit_inline=models.STACKED)
> >
> > How can the same effect be achieved with newforms-admin?
>
> The docs know all:
> http://www.djangoproject.com/documentation/admin/#inlinemodeladmin-objects
>
> That should probably help you.
>
> adi



--~--~-~--~~~---~--~~
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 display UserProfiles in newforms-admin

2008-07-20 Thread slav0nic

#admin.py
from django.contrib import admin
from profile.models import UserProfile
from django.contrib.auth.models import User

class ProfileInline(admin.StackedInline):
model = UserProfile
extra = 1
max_num = 1

class ProfileAdmin(admin.ModelAdmin):
inlines = (ProfileInline,)

admin.site.unregister(User)  #!!!
admin.site.register(User, ProfileAdmin)

;)
--~--~-~--~~~---~--~~
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: superuser has no rights with newforms admin

2008-07-20 Thread eka

Hi

I'm installing it from SVN and got "You don't have permission to edit
anything", I made it work before, but now when I try to follow the
book can't. Could you tell me what should I add to have full
permissions?

Regards
On Jul 20, 7:43 am, "Jon Atkinson" <[EMAIL PROTECTED]> wrote:
> On Sun, Jul 20, 2008 at 2:01 AM, stryderjzw <[EMAIL PROTECTED]> wrote:
>
> > Strange, I'm getting the message "You don't have permission to edit
> > anything." on the admin homepage. I've done admin.autodiscover() on
> > the project urls page, I've created admin.py files for my models and
> > registered the classes with admin.site.register().
>
> Same here (having followed the earlier advice on the list). Is there
> any more useful information which I could post to help debug this?
>
> --Jon
--~--~-~--~~~---~--~~
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: superuser has no rights with newforms admin

2008-07-20 Thread Jon Atkinson

> You can't really be using trunk 7951 -- that's from before newforms-admin
> merge which was 7967??  Try updating to latest trunk?

So I feel slightly ... foolish :-)

--Jon

--~--~-~--~~~---~--~~
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: superuser has no rights with newforms admin

2008-07-20 Thread Jon Atkinson

> Does that mean it works for you as well if you update to latest?  I only
> knew nfa was not part of trunk at that point because I looked it up after
> trying reverting to 7951 to test your environment.  I found the
> autodiscover() caused an exception because it didn't exist...so if you were
> running 7951 it must have been a newforms-admin branch version?  Not sure
> why that wouldn't have worked but if it's fixed in latest it's probably not
> worth tracking down.

Yes, it does work for me. I had both the newforms-admin and an older
trunk checked out on my machine, but it appears that I updated my nfa
branch, and not my trunk, but then went ahead and installed my (old)
trunk code. PEBKAC.

Sorry for wasting your time, but thanks a lot for your help anyway, Karen.

--Jon

--~--~-~--~~~---~--~~
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: superuser has no rights with newforms admin

2008-07-20 Thread Karen Tracey
On Sun, Jul 20, 2008 at 12:32 PM, Jon Atkinson <[EMAIL PROTECTED]>
wrote:

>
> > You can't really be using trunk 7951 -- that's from before newforms-admin
> > merge which was 7967??  Try updating to latest trunk?
>
> So I feel slightly ... foolish :-)
>

Does that mean it works for you as well if you update to latest?  I only
knew nfa was not part of trunk at that point because I looked it up after
trying reverting to 7951 to test your environment.  I found the
autodiscover() caused an exception because it didn't exist...so if you were
running 7951 it must have been a newforms-admin branch version?  Not sure
why that wouldn't have worked but if it's fixed in latest it's probably not
worth tracking down.

Karen

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



Re: superuser has no rights with newforms admin

2008-07-20 Thread Jon Atkinson

> It sounds like your admin.py file has already been imported by something
> else before the autodiscover() is called.  Did you add an import of your
> app's admin into your models.py? That shouldn't be necessary. Also make sure
> you don't have an import for it in your __init__.py file; that was the
> recommendation when I first migrated to newforms-admin but it led to
> multiple registrations like this so was replaced by autodiscover().  You
> should not have an explicit import of your app's admin anywhere;
> autodiscover() is, I believe, the only thing that should be doing the import
> thus ensuring registration is only run once.

No, I don't. I should clarify that when I previously had
newforms-admin working correctly, it was in a different project. The
trouble that I'm having is with a project which I started after the
newforms-admin merge.

> Alternatively, you are sure you removed the registration calls from your
> models.py file?

Yep.

> I'm pretty stumped by this myself.  I can't recreate it (and actually right
> now am away from home so unable to even try anything for several hours).
> Maybe if you can figure out and solve what is causing the multiple
> registration exception that will shed some light

I've uploaded my complete project tree (it's fairly small, and I've
included the sqlite database). The admin username and password is
'test'. It's available at:

http://jonatkinson.co.uk/static/junk/myproj.zip

FWIW, I'm using SVN trunk at revision 7951. I realise that asking
anyone to download and run my project just to help me fix a problem is
quite a presumptious request, but I live in hope :-)

--Jon

--~--~-~--~~~---~--~~
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: superuser has no rights with newforms admin

2008-07-20 Thread Karen Tracey
On Sun, Jul 20, 2008 at 9:11 AM, eka <[EMAIL PROTECTED]> wrote:

>
> Hi
>
> I'm installing it from SVN and got "You don't have permission to edit
> anything", I made it work before, but now when I try to follow the
> book can't. Could you tell me what should I add to have full
> permissions?
>

I have no idea what is going on in cases where people have
admin.autodiscover() in their urls.py yet still get this "You don't have
permission to edit anything" message.  I'd suggest you put a print statement
in django/contrib/admin/__init__.py after the __import__ in autodiscover()
and verify that the auth app, at a minimum, is being found by
autodiscover(). If not put a print in before the import and ensure
adutodiscover() is really being called and attempting to import the admin
module for each installed app.

(Also I'm not sure what 'book' is being referred to here, since there's
certainly nothing printed that covers newforms-admin.  Even the tutorial, I
believe, is still missing mention of autodiscover(), which means if you are
following it exactly that may be why you are getting this message.)

Karen



> Regards
> On Jul 20, 7:43 am, "Jon Atkinson" <[EMAIL PROTECTED]> wrote:
> > On Sun, Jul 20, 2008 at 2:01 AM, stryderjzw <[EMAIL PROTECTED]>
> wrote:
> >
> > > Strange, I'm getting the message "You don't have permission to edit
> > > anything." on the admin homepage. I've done admin.autodiscover() on
> > > the project urls page, I've created admin.py files for my models and
> > > registered the classes with admin.site.register().
> >
> > Same here (having followed the earlier advice on the list). Is there
> > any more useful information which I could post to help debug this?
> >
> > --Jon
> >
>

--~--~-~--~~~---~--~~
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: superuser has no rights with newforms admin

2008-07-20 Thread Karen Tracey
On Sun, Jul 20, 2008 at 11:05 AM, Jon Atkinson <[EMAIL PROTECTED]>
wrote:

> >> > I have no idea what is going on in cases where people have
> >> > admin.autodiscover() in their urls.py yet still get this "You don't
> have
> >> > permission to edit anything" message.  I'd suggest you put a print
> statement
> >> > in django/contrib/admin/__init__.py after the __import__ in
> autodiscover()
> >> > and verify that the auth app, at a minimum, is being found by
> >> > autodiscover(). If not put a print in before the import and ensure
> >> > adutodiscover() is really being called and attempting to import the
> admin
> >> > module for each installed app.
>
> Okay, I've spent a little time on this. There seem to be a few problems.
>
> First of all, I'm a little confused about where to use
> admin.site.register(). A few months ago I checked out the
> newforms-admin branch to try to get a head start, and I followed the
> instructions on this wiki page[1], which recommended importing
> django.contrib.admin at the top of models.py in a given app, then
> registering the models at the bottom of the same file. Of course, I
> realise that the documentation is in flux, but at the time, doing that
> worked.
>
> I've now moved that code into admin.py in my app folder. It looks
> something like this:
>
> -8<-
>
> from django.contrib import admin
> from myproj.people.models import Person
>
> class PersonAdmin(admin.ModelAdmin):
>pass
>
> admin.site.register(Person, PersonAdmin)
>
> -8<-
>
> However, when I *also* include admin.autodiscover() in my project-root
> urls.py, the following exception is raised:
>
> ImproperlyConfigured at /admin/
> Error while importing URLconf 'myproj.urls': The model Person is
> already registered
>

It sounds like your admin.py file has already been imported by something
else before the autodiscover() is called.  Did you add an import of your
app's admin into your models.py? That shouldn't be necessary. Also make sure
you don't have an import for it in your __init__.py file; that was the
recommendation when I first migrated to newforms-admin but it led to
multiple registrations like this so was replaced by autodiscover().  You
should not have an explicit import of your app's admin anywhere;
autodiscover() is, I believe, the only thing that should be doing the import
thus ensuring registration is only run once.

Alternatively, you are sure you removed the registration calls from your
models.py file?


>
> If I comment out the contents of my admin.py file, then that exception
> is not raised, and also if I comment out the call to
> admin.autodiscover(), the exception is not raised, however I cannot
> have both active at the same time. A little googling brought up ticket
> 6776 [2], which seems to have been closed, with the introduction of
> admin.autodiscover() as the resolution. I'm not entirely sure what is
> going on there.
>
> Regardless, I took Karen's advice, and modified the __init__.py in
> django.contrib.admin, and added a print statement to see which
> applications were being loaded. In my case, the output was this:
>
> django.contrib.auth
> django.contrib.contenttypes
> django.contrib.sessions
> django.contrib.sites
> django.contrib.admin
> myproj.people
>
> ... which looks reasonable to me (auth is being loaded before admin,
> which would suggest that the permissions would be available to the
> admin app), but I still see the same 'you don't have permission to
> edit anything' message in the admin application.
>

Yes that looks reasonable.  So I'd expect, with that output, that even if
you had removed the registration for your own models, you could go into
admin and edit Users and Sites, for example.


>
> Any help debugging this would be much appreciated - now that
> newforms-admin is in trunk, I can't justify continuing development
> without it, so I'd really like to solve this :-)
>

I'm pretty stumped by this myself.  I can't recreate it (and actually right
now am away from home so unable to even try anything for several hours).
Maybe if you can figure out and solve what is causing the multiple
registration exception that will shed some light

Karen


>
> --Jon
>
> [1] http://code.djangoproject.com/wiki/NewformsHOWTO
> [2] http://code.djangoproject.com/ticket/6776
>
> >
>

--~--~-~--~~~---~--~~
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: superuser has no rights with newforms admin

2008-07-20 Thread Jon Atkinson

>> > > I'm installing it from SVN and got "You don't have permission to edit
>> > > anything", I made it work before, but now when I try to follow the
>> > > book can't. Could you tell me what should I add to have full
>> > > permissions?
>>
>> > I have no idea what is going on in cases where people have
>> > admin.autodiscover() in their urls.py yet still get this "You don't have
>> > permission to edit anything" message.  I'd suggest you put a print 
>> > statement
>> > in django/contrib/admin/__init__.py after the __import__ in autodiscover()
>> > and verify that the auth app, at a minimum, is being found by
>> > autodiscover(). If not put a print in before the import and ensure
>> > adutodiscover() is really being called and attempting to import the admin
>> > module for each installed app.

Okay, I've spent a little time on this. There seem to be a few problems.

First of all, I'm a little confused about where to use
admin.site.register(). A few months ago I checked out the
newforms-admin branch to try to get a head start, and I followed the
instructions on this wiki page[1], which recommended importing
django.contrib.admin at the top of models.py in a given app, then
registering the models at the bottom of the same file. Of course, I
realise that the documentation is in flux, but at the time, doing that
worked.

I've now moved that code into admin.py in my app folder. It looks
something like this:

-8<-

from django.contrib import admin
from myproj.people.models import Person

class PersonAdmin(admin.ModelAdmin):
pass

admin.site.register(Person, PersonAdmin)

-8<-

However, when I *also* include admin.autodiscover() in my project-root
urls.py, the following exception is raised:

ImproperlyConfigured at /admin/
Error while importing URLconf 'myproj.urls': The model Person is
already registered

If I comment out the contents of my admin.py file, then that exception
is not raised, and also if I comment out the call to
admin.autodiscover(), the exception is not raised, however I cannot
have both active at the same time. A little googling brought up ticket
6776 [2], which seems to have been closed, with the introduction of
admin.autodiscover() as the resolution. I'm not entirely sure what is
going on there.

Regardless, I took Karen's advice, and modified the __init__.py in
django.contrib.admin, and added a print statement to see which
applications were being loaded. In my case, the output was this:

django.contrib.auth
django.contrib.contenttypes
django.contrib.sessions
django.contrib.sites
django.contrib.admin
myproj.people

... which looks reasonable to me (auth is being loaded before admin,
which would suggest that the permissions would be available to the
admin app), but I still see the same 'you don't have permission to
edit anything' message in the admin application.

Any help debugging this would be much appreciated - now that
newforms-admin is in trunk, I can't justify continuing development
without it, so I'd really like to solve this :-)

--Jon

[1] http://code.djangoproject.com/wiki/NewformsHOWTO
[2] http://code.djangoproject.com/ticket/6776

--~--~-~--~~~---~--~~
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: superuser has no rights with newforms admin

2008-07-20 Thread eka

admin.autodiscover() in the urls.py did the trick.

Thanks for the answers.

On Jul 20, 10:21 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Sun, Jul 20, 2008 at 9:11 AM, eka <[EMAIL PROTECTED]> wrote:
>
> > Hi
>
> > I'm installing it from SVN and got "You don't have permission to edit
> > anything", I made it work before, but now when I try to follow the
> > book can't. Could you tell me what should I add to have full
> > permissions?
>
> I have no idea what is going on in cases where people have
> admin.autodiscover() in their urls.py yet still get this "You don't have
> permission to edit anything" message.  I'd suggest you put a print statement
> in django/contrib/admin/__init__.py after the __import__ in autodiscover()
> and verify that the auth app, at a minimum, is being found by
> autodiscover(). If not put a print in before the import and ensure
> adutodiscover() is really being called and attempting to import the admin
> module for each installed app.
>
> (Also I'm not sure what 'book' is being referred to here, since there's
> certainly nothing printed that covers newforms-admin.  Even the tutorial, I
> believe, is still missing mention of autodiscover(), which means if you are
> following it exactly that may be why you are getting this message.)
>
> Karen
>
> > Regards
> > On Jul 20, 7:43 am, "Jon Atkinson" <[EMAIL PROTECTED]> wrote:
> > > On Sun, Jul 20, 2008 at 2:01 AM, stryderjzw <[EMAIL PROTECTED]>
> > wrote:
>
> > > > Strange, I'm getting the message "You don't have permission to edit
> > > > anything." on the admin homepage. I've done admin.autodiscover() on
> > > > the project urls page, I've created admin.py files for my models and
> > > > registered the classes with admin.site.register().
>
> > > Same here (having followed the earlier advice on the list). Is there
> > > any more useful information which I could post to help debug this?
>
> > > --Jon
--~--~-~--~~~---~--~~
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: superuser has no rights with newforms admin

2008-07-20 Thread eka

'The' book -> Django book

On Jul 20, 11:07 am, eka <[EMAIL PROTECTED]> wrote:
> admin.autodiscover() in the urls.py did the trick.
>
> Thanks for the answers.
>
> On Jul 20, 10:21 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
>
> > On Sun, Jul 20, 2008 at 9:11 AM, eka <[EMAIL PROTECTED]> wrote:
>
> > > Hi
>
> > > I'm installing it from SVN and got "You don't have permission to edit
> > > anything", I made it work before, but now when I try to follow the
> > > book can't. Could you tell me what should I add to have full
> > > permissions?
>
> > I have no idea what is going on in cases where people have
> > admin.autodiscover() in their urls.py yet still get this "You don't have
> > permission to edit anything" message.  I'd suggest you put a print statement
> > in django/contrib/admin/__init__.py after the __import__ in autodiscover()
> > and verify that the auth app, at a minimum, is being found by
> > autodiscover(). If not put a print in before the import and ensure
> > adutodiscover() is really being called and attempting to import the admin
> > module for each installed app.
>
> > (Also I'm not sure what 'book' is being referred to here, since there's
> > certainly nothing printed that covers newforms-admin.  Even the tutorial, I
> > believe, is still missing mention of autodiscover(), which means if you are
> > following it exactly that may be why you are getting this message.)
>
> > Karen
>
> > > Regards
> > > On Jul 20, 7:43 am, "Jon Atkinson" <[EMAIL PROTECTED]> wrote:
> > > > On Sun, Jul 20, 2008 at 2:01 AM, stryderjzw <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > > Strange, I'm getting the message "You don't have permission to edit
> > > > > anything." on the admin homepage. I've done admin.autodiscover() on
> > > > > the project urls page, I've created admin.py files for my models and
> > > > > registered the classes with admin.site.register().
>
> > > > Same here (having followed the earlier advice on the list). Is there
> > > > any more useful information which I could post to help debug this?
>
> > > > --Jon
--~--~-~--~~~---~--~~
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: Great work with newforms-admin

2008-07-20 Thread Kenneth Gonsalves


On 19-Jul-08, at 10:34 PM, Ramdas S wrote:

> Can you just share the wiki page link please. I need some place to  
> start

start with an svn co. keep running the prog till there are no errors.

-- 

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




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



Re: custom AdminSite access for non-staff user (newforms-admin)

2008-07-20 Thread Karen Tracey
On Sun, Jul 20, 2008 at 3:37 AM, SanPy <[EMAIL PROTECTED]> wrote:

> Is it possible to allow a non-staff member access to a custom
> AdminSite? When I try to login as a non-staff user, I get the error
> message: "Please enter a correct username and password. Note that both
> fields are case-sensitive."
>

No,  is_staff is still used as a gating factor to allow users to login to an
admin site.

Karen

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



Re: superuser has no rights with newforms admin

2008-07-20 Thread Jon Atkinson

On Sun, Jul 20, 2008 at 2:01 AM, stryderjzw <[EMAIL PROTECTED]> wrote:
>
> Strange, I'm getting the message "You don't have permission to edit
> anything." on the admin homepage. I've done admin.autodiscover() on
> the project urls page, I've created admin.py files for my models and
> registered the classes with admin.site.register().

Same here (having followed the earlier advice on the list). Is there
any more useful information which I could post to help debug this?

--Jon

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



custom AdminSite access for non-staff user (newforms-admin)

2008-07-20 Thread SanPy

Is it possible to allow a non-staff member access to a custom
AdminSite? When I try to login as a non-staff user, I get the error
message: "Please enter a correct username and password. Note that both
fields are case-sensitive."

Regards, Sander.
--~--~-~--~~~---~--~~
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 have both newforms-admin and previous version on the same machine?

2008-07-20 Thread Andre Meyer
hi all

newforms-admin has been merged, so you can go back to trunk.

anyway, maybe you can do the same as i do: put a django.pth file in
site-packages which includes all the paths to the branches you want to use.
just uncomment the one you want to use at a given moment. you can add more
paths to the same file, like project paths and such.

http://docs.python.org/lib/module-site.html

cheers
André


On Sun, Jul 20, 2008 at 8:13 AM, ge <[EMAIL PROTECTED]> wrote:

>
> Don't know if this helps for your case, but I simply clone the django
> repository using git-svn, and then sym link the django directory to
> site-packages in the usual fashion.  When you want to switch to a
> different branch, its as simple as running 'git checkout  name>'.   You can switch back and forth freely between all the
> branches this way.  You can only be using one branch at a time this
> way, but I'm not in a situation where this matters.
>
> On Jul 19, 10:19 pm, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote:
> > Great, thanks for the advice.
> > So, using virtualenv, I basically install two separate environments,
> > one for each django version, and manually call "\path\to\djangoversion
> > \bin\activate.bat" depending on which version I need? Or is there a
> > way to activate the correct version directly from the project itself?
> > Using Windows for development, Linux for production.
> > Thanks!
> >
> > Rodrigo
> >
> > On Jul 19, 9:43 pm, "[EMAIL PROTECTED]"
> >
> > <[EMAIL PROTECTED]> wrote:
> > > Do not install django as part of site-packges.
> > > Treat it as a python package like any other.
> > > Create two directories:
> > > django-0.96/
> > > django-pre-1.0/
> >
> > > put the old django in 0.96 (as a sub directory 'django')
> > > put the new svn in pre-1.0
> >
> > > Then for your projects have your PYTHONPATH set appropriatly.
> >
> > > because you need django for settings.py, you can not set it in
> > > settings.
> > > custom env scripts work well (and I recommend virtualenv)
> >
> > > hope this helps.
> >
> > > -Doug
> >
> > > On Jul 19, 9:26 pm, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote:
> >
> > > > I'm looking foward to trying out the merged newforms-admin on my
> > > > upcoming projects. However, I have a few ongoing projects already
> > > > developed using pre-newforms-admin django.
> > > > I make changes to the projects on my local machine and test them
> > > > before comitting them to the remote production sites, so, unless I
> > > > want to refactor all these sites, I need to keep the current django
> > > > version on my development machine.
> > > > Question: Is it possible to have two django versions on a single
> > > > machine? Is there a way to tell each project which one to use, maybe
> > > > in settings.py?
> > > > I realize that it might make sense to refactor the existing projects
> > > > to work with newforms-admin, just not sure how much time this would
> > > > take for some already considerably complex and extended model
> > > > definitions, plus testing, etc.
> >
>

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



  1   2   3   4   5   6   7   8   9   10   >