The save_model(..) in ModelAdmin is what you're looking for
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#save-model-self-request-obj-form-change
On Nov 29, 6:25 pm, AJ wrote:
> I have a simple model like so:
> # models.py
> class Announcement(models.Model):
>
check this snippet
http://www.djangosnippets.org/snippets/840/
Satheesh
On Dec 19, 9:05 am, mono wrote:
> I means if I have three param( I think it is very frequent ), the
> style of writing method seem somehow inconvenient.
>
> eg;
>
> in code area which handle param1
I means if I have three param( I think it is very frequent ), the
style of writing method seem somehow inconvenient.
eg;
in code area which handle param1
if ... url = ?param1=..=..=..
else url = ?param1=..=..=..
param2
if ... url = ?param1=..=..=..
else url = ?param1=..=..=..
Yay!! Now I can sleep tonight!
So the docs say this about the CSRF middleware: "It may still be
possible to use the middleware, provided you can find some way to get
the CSRF token and ensure that is included when your form is
submitted."
Has anyone found that way, or can anyone point me in
> Each of my views use the @login_required decorator, is there anything
> else I need to do to ensure that the user is logged in and active
> (i.e. do I need to check user.is_active)?
The meaning of is_active is an application decision. It's just a field
on the model, you can do whatever you
On Thu, Dec 18, 2008 at 4:53 PM, Eugene Mirotin wrote:
>
> Hello.
> Consider I have a simple model
>
> class Team(models.Model):
>name = models.CharField(max_length=200)
>
> Then I create some team and try to look for it with iexact match:
> tt = Team(name='English')
>
Hi all,
I'm a Django newbie having some trouble getting image uploads to work.
I've read the docs pretty carefully, I have PIL installed, and I've
been googling without success for a while now. Hopefully, my dumb
mistake will jump out at someone reading this...
Anyway, here is my trivial model:
On Mon, Dec 15, 2008 at 11:24 AM, Mark
wrote:
>
> Hello,
>
> Are there any comments on the issue I describe below?
> Aside from issue 7052 in the tracker:
>
> http://code.djangoproject.com/ticket/7052
>
> I'm a new user of Django so I may be doing something
>
response = serializers.serialize('xml', MySet.objects.all())
return HttpResponse(response , mimetype='text/xml;')
The output has each member of "MySet" with an tag, and then
within the object, a bunch of tags with each field. It seems
sort of hard to parse this on the client side.
Can anyone
On 18 déc, 23:20, Taylor wrote:
> I'm working on a game in Django where the majority of the interaction
> comes through clicks that run JavaScript methods that use jQuery's
> $.post() to post data to a url. To protect against cheaters and bots,
> I must ensure that every post
url(r'^register/$',
register,
{'extra_context' : {'currentmaintab' :
'account'}},
name='registration_register',
),
It would have been nice if you could have told me straight up.
On 18 Dec 2008, at 23:21 , DragonSlayre wrote:
>
> Hi,
>
> I'm currently working with django-registration, and have the following
> url pattern (it's included from my other url pattern):
>
> url(r'^register/$',
> register,
>
> From: mono
> Sent: Thursday, 18 December 2008 22:10
> To: Django users
> Subject: Re: how to add more params in url
>
>
> I don't know whether it is a good answer because only two
> page links is here and the aim of is_extend flag is to show
> entire or part of columns.
>
> so I could not
Yep that works, adding that and the following to forms.py:
> from django.forms import fields
> from django.db import models
On Thu, Dec 18, 2008 at 11:53 AM, panta wrote:
>
> noticing you have provided also models.py, here is a more complete
> answer:
>
> def
It seems to be working now once I made the following changes to
admin.py http://dpaste.com/100570/
On Dec 18, 1:56 pm, Peter Shafer wrote:
> I'm also having the same problem as Emil. I have pictures that belong
> to galleries so I use inline forms to manage them. I
Hi,
I'm currently working with django-registration, and have the following
url pattern (it's included from my other url pattern):
url(r'^register/$',
register,
name='registration_register',
),
This calls a view:
I'm working on a game in Django where the majority of the interaction
comes through clicks that run JavaScript methods that use jQuery's
$.post() to post data to a url. To protect against cheaters and bots,
I must ensure that every post is made by a logged-in user and protect
against cross-site
On Dec 18, 7:18 pm, Cortland Klein wrote:
> I'm using inlineformset_factory in one of my views, which is working
> great, except now I'd like to change the widget for one of the fields
> (in case anyone's curious, an AdminFileWidget). For clarification this
> is my own
Hello.
Consider I have a simple model
class Team(models.Model):
name = models.CharField(max_length=200)
Then I create some team and try to look for it with iexact match:
tt = Team(name='English')
tt.save()
Team.objects.filter(name__iexact=tt.name.lower()) # this returns the
list containing
noticing you have provided also models.py, here is a more complete
answer:
def my_formfield_cb(field):
if isinstance(field, models.FileField) and field.name == 'file':
return fields.FileField(widget = AdminFileWidget(attrs={'url':
"/my/url/"}))
return field.formfield()
On 18 déc, 18:31, marco ghidinelli wrote:
> hello.
>
> Does django template engine supports nested dictionary?
Yes, indeed.
> i'm trying to display a nested array with no luck.
>
> that's my tries:
>
> --- python manage.py shell ---
> from
I've never used inlineformset_factory(), but I guess you can use the
formfield_callback parameter.
For example:
def my_formfield_cb(field):
if condition_on_field(field):
return SuitableFormField(widget = MyCustomWidget())
return field.formfield()
FileFormSet =
I'm using inlineformset_factory in one of my views, which is working
great, except now I'd like to change the widget for one of the fields
(in case anyone's curious, an AdminFileWidget). For clarification this
is my own view and has nothing to do with contrib/admin.
I see that
I'm also having the same problem as Emil. I have pictures that belong
to galleries so I use inline forms to manage them. I also use the
drag-drop script to order these images. Since images have so many
attributes though, the size of the inline form becomes pretty
unmanageable.
Here is my
Hello Dj,
Yes, this is what I need. I just have to get it working and I will be
on my way.
Thanks,
Ana
On Dec 18, 10:35 am, "Dj Gilcrease" wrote:
> Do you mean a select form item or a mouse over drop down menu?
>
> If you mean a select dropdown an
Do you mean a select form item or a mouse over drop down menu?
If you mean a select dropdown an example http://dpaste.com/hold/100463/
Dj Gilcrease
OpenRPG Developer
~~http://www.openrpg.com
--~--~-~--~~~---~--~~
You received this message because you are
Hello Justin,
This seems very complicated for a drop down menu. Will my travels
through Django be this complex? I'm coming from a php environment and
have been very impressed by Django admin page and inheritance of
base.html, but now that I'm trying to write my own views and templates
I'm
I am trying to get django-registration working.
My PC is on a domain. When I am logged on to the domain, I cannot ping
the Google smtp server.
Even when I dial up, I get the error in the subject above.
All my congifurations are correct, including the following in
settings.py
EMAIL_USE_TLS =
> How do I write the drop down menu on the index page to then
> retrieve the value from the drop down menu.
Django itself won't generate the dropdowns for you--that's a template
issue. What you'd want to do is generate the markup (i.e., a list
within tags or something similar) with Django and
Hello,
I have a table Technology:
id
technology
What is the code to place in view.py to create a drop down menu on the
index.html page, so a user can select a value from the technology
list. How do I write the drop down menu on the index page to then
retrieve the value from the drop down menu.
hello.
Does django template engine supports nested dictionary?
i'm trying to display a nested array with no luck.
that's my tries:
--- python manage.py shell ---
from django.template import Template, Context
list_parts = {
'root': {'value': [{'tag':
On Dec 18, 4:33 pm, "Marco Pantaleoni"
wrote:
>
> Binary packages are available in the Cheeseshop (PyPI):
>
> http://pypi.python.org/softwarefabrica.django.utils
errata corrige, the correct link is:
http://pypi.python.org/pypi/softwarefabrica.django.utils
Marco
Softwarefabrica Django Forms (sfforms) is a free, Open Source, forms
library for Django, which aims at providing increased functionality
and flexibility to the standard forms library ("newforms").
Its main features are:
- a compatible replacement for the standard Form class, supporting
Softwarefabrica Django Utils (sfutils) is a free, Open Source, Django
library providing useful functions and abstractions in day to day
Django application development.
This is the foundation library on which the other Softwarefabrica Open
Source Django apps and libraries are built: Forms, CRUD
Or use prefix
theform(request.POST,prefix='form1Prefix')
theform2(request.POST,prefix='form2Prefix')
2008/12/18 Stefan Tunsch
>
> You simply have to avoid using the same field name in the two forms.
>
> On 12/18/08, Alfredo Alessandrini wrote:
> >
> >
You simply have to avoid using the same field name in the two forms.
On 12/18/08, Alfredo Alessandrini wrote:
>
> Hi,
>
> can I use two form in the same view function?
>
> if request.method == 'POST':
> form = FORM_1(request.POST)
> if form.is_valid():
>
On Thu, Dec 18, 2008 at 3:36 AM, Alan wrote:
> Thanks Malcom,
> I think I was not clear enough. I will try again.
>
> So I am at the "Submission Page" (submit.html), with a form where I set
> some parameters and then I click "submit". This form is linked to action
>
�� wrote:
> On Dec 17, 7:49 am, Rajesh Dhawan wrote:
> > On Dec 16, 2:31 am, $B wrote:
> >
> > > Theextra_contextinFormWizardis a class attribute so the new
> > > request may get the context of the previous request.
> > > I can prepend
朱穆穆 wrote:
> On Dec 17, 7:49 am, Rajesh Dhawan wrote:
> > On Dec 16, 2:31 am, $B wrote:
> >
> > > Theextra_contextinFormWizardis a class attribute so the new
> > > request may get the context of the previous request.
> > > I can prepend below to __call__ method to solved
maybe do it.
is there a method like '+='?
On Dec 18, 8:10 pm, "@@" wrote:
> You can keep these information in session.
>
> On Thu, Dec 18, 2008 at 7:10 PM, mono wrote:
>
> > I don't know whether it is a good answer because only two page links
> > is
Malcolm Tredinnick wrote:
> So let's fall back to first principles: always construct the smallest
> case possible that repeats the failure. This means start with a template
> that includes nothing but the "extends" of the batchadmin template. If
> that works, you can
Hi List,
So I have this in models.py:
class Job(models.Model):
jname = models.CharField(max_length=255)
title = models.CharField(max_length=255, null=True, blank=True)
file = models.FileField(upload_to=".")
class JobForm(ModelForm):
class Meta:
model = Job
Hi,
can I use two form in the same view function?
if request.method == 'POST':
form = FORM_1(request.POST)
if form.is_valid():
.
form = FORM_2(request.POST)
if form.is_valid():
.
It's
You can keep these information in session.
On Thu, Dec 18, 2008 at 7:10 PM, mono wrote:
>
> I don't know whether it is a good answer because only two page links
> is here and the aim of is_extend flag is to show entire or part of
> columns.
>
> so I could not tell a page
I don't know whether it is a good answer because only two page links
is here and the aim of is_extend flag is to show entire or part of
columns.
so I could not tell a page linkto is_extend=shrink=next_page and
is_extend=shrink=previous_page
maybe I need more page links, like the first, the last
Thank you very much for the great advice.
I found that it is:
self.base_fields['accounts'].choices =
but I am sure that was just an example.
Thanks again.
On Dec 18, 1:52 am, Daniel Roseman
wrote:
> On Dec 18, 9:41 am, Chris
On Dec 18, 9:30 am, "Arnoud Tijssen" wrote:
> I`m a python newbie so bear with me
>
> I use the django framework and get the following error:
>
> DoesNotExist at /
> UserProfile matching query does not exist.
>
> Since python is fairly new to me I don`t know where to start.
On Dec 18, 6:16 am, sagi s wrote:
> I'd like to use the test client to verify that when there's an error
> in a form field, the input field in the
> response is populated with the original input.
>
> So I'd like to do something like:
>
> iteration = 'bad data'
> response =
On Dec 18, 9:41 am, Chris wrote:
> Hello all,
> I am trying to popular a multi-select form field by passing in a user
> object suchas request.user so that I can filter a table based on that
> object. Below is what I came up with but it is still not working.
> I get the
Hello all,
I am trying to popular a multi-select form field by passing in a user
object suchas request.user so that I can filter a table based on that
object. Below is what I came up with but it is still not working.
I get the following error: 'ChoiceForm' object has no attribute
'accounts'
On Thu, Dec 18, 2008 at 5:05 PM, knight wrote:
>
> Hi,
>
> I have unittests in my django applications and I have a strange
> behavior:
> When I run the tests, I am getting each print-out to log from my
> application twice.
> I am using the standard python logging libraries.
I`m a python newbie so bear with me
I use the django framework and get the following error:
DoesNotExist at /
UserProfile matching query does not exist.
Request Method:
GET
Request URL:
http://surftracker.example.com/
Exception Type:
DoesNotExist
Exception Value:
UserProfile matching query
Ah I see. Thanks for the explanation!
On Dec 18, 9:38 am, "alex.gay...@gmail.com"
wrote:
> The reason this occurs, even with valid data, is because is_valid()
> triggers the validation procedures which set the cleaned_data
> attribute.
>
> Alex
>
> On Dec 18, 2:33 am,
The reason this occurs, even with valid data, is because is_valid()
triggers the validation procedures which set the cleaned_data
attribute.
Alex
On Dec 18, 2:33 am, marty3d wrote:
> Thanks for the English lesson! :)
>
> As you both pointed out, the .is_valid()
Thanks Malcom,
I think I was not clear enough. I will try again.
So I am at the "Submission Page" (submit.html), with a form where I set some
parameters and then I click "submit". This form is linked to action
"run_aria" (run_aria.html) defined in views.py as:
def run_aria(request):
if not
Thanks for the English lesson! :)
As you both pointed out, the .is_valid() should be used here. I
skipped that part because the data was indeed valid and still got the
error message. It has been tried, sorry for not mentioning that.
But actually, by trying it again, with the Werkzeug debugger
Hi,
I have unittests in my django applications and I have a strange
behavior:
When I run the tests, I am getting each print-out to log from my
application twice.
I am using the standard python logging libraries.
Does anyone know this issue?
Thanks,
Arshavski Alexander.
57 matches
Mail list logo