Couple of things.
bruno, your save example should maybe look call the superclass save
first. Otherwise parent may not have been set yet.
def save(self, *args, **kw):
super(Node, self).save(*args, **kw)
if self.parent and type(self.parent) != Group:
raise
This is interesting. I think the two examples you give are distinct
use cases and they should be. But I think it's just as common to want
to do what felix is doing. Essentially he wants to modify a queryset
as it exists by adding or overriding additional parameters. It can be
very convenient
Definitely use python csv and do it yourself. It's really very
simple. shaner's links above should help. One thing I would add is
make sure you convert all of your model values to unicode because
otherwise the csv module will choke on bad characters.
unicode(value, 'utf8')
:Marco
On Feb
Check out this solution for testing emails when in development. It
allows you to use send_mail and the email output is printed to the
terminal (the one running the runserver process).
http://jboxer.com/2009/05/non-painful-email-on-django-development-servers/
When you're ready to go live, you'll
I had a need for this at one point because my main model had an
overridden save method that would modify the inlines. But it didn't
work because the inlines weren't there. I had to reverse the save
method and put it on the inline model. But in my case, there was no
reason not to do that.
:Marco
I've never had to do this but it sounds you want to work with
Form.clean() in stead of Form.clean_is_approved(). From the docs:
"The Form subclass’s clean() method. This method can perform any
validation that requires access to multiple fields from the form at
once."
So in your clean method
I'm trying to find a solution to this very same issue. At the very
least, I think inlines should support custom callables.
The inline I'm displaying is an intermediary table for a ManyToMany
relationship. So I have a selector for the related object, but what I
would like to do in the inline is
t;tomasz.zielin...@pyconsultant.eu> wrote:
> > On 11 Sty, 16:23, Marco Rogers <marco.rog...@gmail.com> wrote:
>
> > > I'm reposting this from earlier to see if I have better luck. I need
> > > to be able to get the ModelAdmin associated with a model at runtime.
I'm reposting this from earlier to see if I have better luck. I need
to be able to get the ModelAdmin associated with a model at runtime.
Similar to how django.db.models.get_model allows you to retrieve a
model.
admin_class = get_admin(Model)
Is this possible?
The original post has more
I was looking for some convenient method like this to use with the
object_list generic view. But writing my own wrapper view only took 2
secs.
def speaker_list(request, session_month):
if not session_month in settings.SESSIONS:
return HttpResponseNotFound()
I'm retrieving a model using django.db.models.get_model. The view is
receiving a post from a form generated by the ModelAdmin. How can I
get a hold of that ModelAdmin instance so can then get a hold of the
ModelForm? This will allow me to process the post (validation,
related objects, etc).
11 matches
Mail list logo