It is a common practice to pass extra parameters to the __init__
function of the form and save them as properties of the object that
can be later on accessed by any method like the clean method:
class MyForm(forms.Form):
def __init__(self, extra_param=None, *args, **kwargs):
self.ext
hi,
how can i achieve a behaviour like in the admin backend where i can add
a related object through a popup window and have it selectable after i
saved the related form?
for example:
im copleting the form book and i have to select the author but it doesnt
exist yet... so i click on the + (add)
On Oct 13, 3:09 am, LuisC wrote:
> Hi!!!
>
> I am having some trouble trying to output a database record to a
> form
>
> **My form:
> class ClientesFIForm(forms.Form):
> ClienteCodigo = forms.IntegerField(label='Codigo Cliente')
> ClienteNombre = forms.CharField(label='Nombre Cliente'
I am working on a site with a static part (i use the Djano tempate
system to separate menu's and header from the content), and a dynamic
part. For the static part i have a directory structure like:
index.html
page1.html
page2.html
request for / will load index.html
A part of my urls.py:
(r
hi,
It didnt help :/
On Oct 9, 10:33 am, "Bogdan I. Bursuc"
wrote:
> Try to delete the auth_permissions table the sync db
> see if it helps
>
> On Fri, 2009-10-09 at 01:29 -0700,elminiowrote:
> > Up Up
>
> > On Oct 8, 12:10 pm,elminio wrote:
> > > Hi,
> > > I've extended my model with new permi
vpotter wrote:
> Hm.. Using IP for this doesn't seem to be a good idea. What about
> proxy users who will have proxy's IP or users of one subnetwork behind
> the NAT?
> I'd store some kind of id in user's cookies and then use it to detect
> posts made by user anonymously
>
Yes, cookies are the
buttman kirjoitti:
ls.srs.name
> 'WGS 84'
srs.units
> (0.017453292519943282, 'degree')
ls.length
> 0.88329271346608429
>
> So how do I go from degrees to miles? According to the docs, Distance
> does not handle 'degrees' as a unit. Should I somehow convert to
> another srs before I
Hi,
By admin I can choose what users can do with model objects. And what
about certain pages. Do I have to write if in everyone view method (to
check is current user may access given view ?
Or is there any built in tool that makes it possible to restrict
access to given pages.
thanks for help
-
On Oct 13, 11:42 am, elminio wrote:
> Hi,
>
> By admin I can choose what users can do with model objects. And what
> about certain pages. Do I have to write if in everyone view method (to
> check is current user may access given view ?
>
> Or is there any built in tool that makes it possible to r
Hi,
I'm following the advice here :-
http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/
to try and add a custom action to the list display of one of my models in
the admin interface.
Sadly, as hard as I try, the option is not appearing in the drop down list.
Anyone else have this p
On Oct 13, 11:55 am, DrKJam wrote:
> Hi,
>
> I'm following the advice here :-
>
> http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/
>
> to try and add a custom action to the list display of one of my models in
> the admin interface.
>
> Sadly, as hard as I try, the option is not app
This is the default behaviour in Django Admin, dude...
On Oct 13, 9:43 am, andreas schmid wrote:
> hi,
>
> how can i achieve a behaviour like in the admin backend where i can add
> a related object through a popup window and have it selectable after i
> saved the related form?
>
> for example:
>
And specifically the @login_required decorator...
On Oct 13, 12:51 pm, Daniel Roseman wrote:
> On Oct 13, 11:42 am, elminio wrote:
>
> > Hi,
>
> > By admin I can choose what users can do with model objects. And what
> > about certain pages. Do I have to write if in everyone view method (to
> >
thx mate... but i need it on the front end ;)
nabucosound wrote:
> This is the default behaviour in Django Admin, dude...
>
> On Oct 13, 9:43 am, andreas schmid wrote:
>
>> hi,
>>
>> how can i achieve a behaviour like in the admin backend where i can add
>> a related object through a popup wi
With Django sessions I think this can be done easily:
http://docs.djangoproject.com/en/dev/topics/http/sessions/
On Oct 13, 12:08 pm, Ned Batchelder wrote:
> vpotter wrote:
> > Hm.. Using IP for this doesn't seem to be a good idea. What about
> > proxy users who will have proxy's IP or users of
I'm assuming you are doing this somewhere other than the admin, or in
custom views, so I'll explain how the admin stuff works.
Basically, when you create the popup window you give it a name which
can be used the uniquely identify the field that is using the popup
(some variant on the field id wou
2009/10/13 DrKJam
>
>
> 2009/10/13 Daniel Roseman
>
>>
>> On Oct 13, 11:55 am, DrKJam wrote:
>> > Hi,
>> >
>> > I'm following the advice here :-
>> >
>> > http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/
>> >
>> > to try and add a custom action to the list display of one of my mo
2009/10/13 Daniel Roseman
>
> On Oct 13, 11:55 am, DrKJam wrote:
> > Hi,
> >
> > I'm following the advice here :-
> >
> > http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/
> >
> > to try and add a custom action to the list display of one of my models in
> > the admin interface.
> >
thank you very much for pointing me to the right path!!
ill try to understand the behaviour and report about my progress...
Andrew Ingram wrote:
> I'm assuming you are doing this somewhere other than the admin, or in
> custom views, so I'll explain how the admin stuff works.
>
> Basically, when y
Oh all right, sorry, I misread first paragraph
On Tue, Oct 13, 2009 at 1:57 PM, andreas schmid wrote:
>
> thx mate... but i need it on the front end ;)
>
> nabucosound wrote:
>> This is the default behaviour in Django Admin, dude...
>>
>> On Oct 13, 9:43 am, andreas schmid wrote:
>>
>>> hi,
>>>
On Oct 13, 1:20 pm, andreas schmid wrote:
> thank you very much for pointing me to the right path!!
> ill try to understand the behaviour and report about my progress...
>
> Andrew Ingram wrote:
> > I'm assuming you are doing this somewhere other than the admin, or in
> > custom views, so I'll
Thanks,
I guess I made it out to be harder than it was.
Eddie
-Original Message-
From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com]
On Behalf Of Brian McKeever
Sent: October-12-09 1:20 PM
To: Django users
Subject: Re: showing user data in a view
You could write
Emily Rodgers wrote:
>
> On Oct 13, 1:20 pm, andreas schmid wrote:
>
>> thank you very much for pointing me to the right path!!
>> ill try to understand the behaviour and report about my progress...
>>
>> Andrew Ingram wrote:
>>
>>> I'm assuming you are doing this somewhere other than the
Hi,
Imho there's a MEDIA_URL field in settings,
so you could use that, and uset {% MEDIA_URL %} in your template (you
could also add template context processors)
-djibon-
On 10/13/09, rvandam wrote:
>
> I am working on a site with a static part (i use the Djano tempate
> system to separate men
I had to use {{ MEDIA_URL }} instead of {% MEDIA_URL %} (gave me a
template error)
Adding a template context processor was not option for me because for
the static part i have no views/models defined.
Thanks for the answer! I didnt think of solving it this way.
Rob
--~--~-~--~~-
Hi,
I have a model called Link that allows the user to save a URL with a
title and description. The website i am making is full of Links users
have added (like a bookmarking service)
class Link(models.Model):
user = models.ForeignKey(User)
title = models.CharField(max_length=200)
lin
Once you have passed your links queryset to the template context, you
can just do:
{% for saved_link in links %}
{{ saved_link.link.title }}
{{ saved_link.link.pub_date }}
{% endfor %}
(embed your HTML dress and you're done)
Cheers!
Hector Garcia - Web developer, musician
NomadBlue URI
On Tue, 2009-10-13 at 07:23 -0700, grimmus wrote:
> Hi,
>
> I have a model called Link that allows the user to save a URL with a
> title and description. The website i am making is full of Links users
> have added (like a bookmarking service)
>
> class Link(models.Model):
> user = models.For
hello
I have a model.py like this :
class secondaryGroup(models.Model):
id = models.AutoField(primary_key = True)
idGroup = models.ForeignKey(Group,db_column =
'idGroup',verbose_name = 'Groupe',limit_choices_to = Q(state='valid')
| Q(state='modify'))
idUser = models.ForeignKey(User,db_c
It's so simple, thanks alot for the speedy replies !
On Oct 13, 4:31 pm, Héctor García wrote:
> Once you have passed your links queryset to the template context, you
> can just do:
>
> {% for saved_link in links %}
> {{ saved_link.link.title }}
> {{ saved_link.link.pub_date }}
> {% endfo
Hi All,
I'm working with PostgreSQL database.
I wonder how Django handles Check Constraints both (range and value based).
To ensure integrity of data in the database as postresql does.
How are they implemented in models and views.
Please assist in this direction
Many Thanks
Isoscale
--~--~-
I think the problem is not in your wsgi file, but in your apache's vhost
configuration.
You should have this in your vhost configuration, to use your django
application with mod_wsgi :
WSGIScriptAlias / /var/www/conf/myconf.wsgi
So, you should add this line (if your admin/media is url /admin/medi
This may be a matter of using the correct encoding in the file.
Be sure that the editor that you are using is treating the file as UTF-8.
(I presume from the headers that the compile step is treating the
file as UTF-8, but the editor may not look at that header, and may,
for example, be using lati
Hello i have a small application where in the urls i have this :
(r'^scarico/(\d+)/(\w+)/$', 'sitonorme.gestnorme.views.scarico'),
the problem is that in the \w+ sometimes i have name with space li dir
one that i can't rename.
the folder that i pass for example is this:
Request URL: http://12
Maybe you should try smth like this:
(r'^scarico/(\d+)/(.+)/$', 'sitonorme.gestnorme.views.scarico'),
On Tue, Oct 13, 2009 at 7:59 PM, luca72 wrote:
>
> Hello i have a small application where in the urls i have this :
>
> (r'^scarico/(\d+)/(\w+)/$', 'sitonorme.gestnorme.views.scarico'),
>
> the
Ok, moving this code to decoration function really good.
And now do you want to add this template selection logic into third-party
apps you using in this project?
I have no idea.
As i remember this is called monkey-patching
>>> import test
>>> def heh(func):
... def helper():
... print "y"
..
>> Hello i have a small application where in the urls i have
>> this :
>>
>> (r'^scarico/(\d+)/(\w+)/$',
>> 'sitonorme.gestnorme.views.scarico'),
>>
>> the problem is that in the \w+ sometimes i have name with
>> space li dir one that i can't rename.
>
> Maybe you should try smth like this:
>
>
Well, I don't know what is under scarico/(\d+)/ - single file or a directory
tree.
In case of directory tree ".+" seems to be the best way, which is also
documented at
http://docs.djangoproject.com/en/dev/howto/static-files/
In case of single file "[^/]+" instead of ".+" can be used. I think ther
Михаил Лукин wrote:
> Well, I don't know what is under scarico/(\d+)/ - single file or a directory
> tree.
>
> In case of directory tree ".+" seems to be the best way, which is also
> documented at
> http://docs.djangoproject.com/en/dev/howto/static-files/
>
> In case of single file "[^/]+" inst
Making request global definitely sounds like a potentially fragile
solution. I noticed that the template loaders take a directory list
argument, but it doesn't seem to ever get passed in -- it's not even
an argument for loader.get_template() or loader.select_template().
One possibility might be
2009/10/13 Chirolo
>
> Hi Arthur.
> I'm not so experience with linux.
> I can get to the directories and files of apparmor, but how do I
> stopped.
> Thank you.
>
Something like this
> u...@host$ sudo /etc/init.d/apparmor stop
> * Unloading AppArmor profiles
2009/10/13 elminio
>
> Hi,
>
> By admin I can choose what users can do with model objects. And what
> about certain pages. Do I have to write if in everyone view method (to
> check is current user may access given view ?
>
> Or is there any built in tool that makes it possible to restrict
> acces
Try deleting the table for the model in whose Meta class you're
defining the permission. I believe permissions are added only when
the table for the model they're defined in is created.
On Oct 13, 5:08 am, elminio wrote:
> hi,
>
> It didnt help :/
>
> On Oct 9, 10:33 am, "Bogdan I. Bursuc"
>
2009/10/13, Nan :
>
> Making request global definitely sounds like a potentially fragile
> solution. I noticed that the template loaders take a directory list
> argument, but it doesn't seem to ever get passed in -- it's not even
> an argument for loader.get_template() or loader.select_template()
That was it.
Eclipse was treating the file with the default encoding (in my case
MacRoman). As soon as I changed the file properties to UTF-8
compilemessages worked fine (though I did have to fix every single
encoded character in the file).
Thanks for your help.
CE
On Oct 13, 11:45 am, Bill Fr
You're definitely right, that's why I mentioned additional tests in view
function. I'm not sure about win and NTFS, but on *nix os.path.exists() will
likely return False on such weird things as '\x01\x02', while whitelisting
characters may lead to problems with internationalization (or we'll get a
This wouldn't work?
def view(request):
if request.user.theme = "blue":
--~--~-~--~~~---~--~~
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 u
Hello all,
I have roughly the following model:
class Room(models.Model):
number = models.IntegerField(unique=True)
def __unicode__(self):
return str(int(self.number))
class Desk(models.Model):
room = models.ForeignKey('Room', related_name="desks")
people = models.ManyToM
This wouldn't work?
def view(request):
if request.user.theme = "blue":
template = "app/blue/template.html"
elif request.user.theme = "yellow":
template = "app/yellow/template.html"
return render_to_response(template)
--~--~-~--~~~---~--~~
Try ./manage reset auth
On Tue, Oct 13, 2009 at 1:08 PM, elminio wrote:
>
> hi,
>
> It didnt help :/
>
> On Oct 9, 10:33 am, "Bogdan I. Bursuc"
> wrote:
> > Try to delete the auth_permissions table the sync db
> > see if it helps
> >
> > On Fri, 2009-10-09 at 01:29 -0700,elminiowrote:
> > > Up
Djangoids:
Unit tests should run as silent as possible, so we don't get too
familiar with their spew. Ideally, any spew should raise your index of
suspicion, and a test batch that always spews the same things might
make you complacent to any exceptional spew.
So, how to turn off the spew reporti
Thanks Karen for your reply, and sorry for the delay in my reply.
It did turn out to be a PYTHONPATH issue. I finally solved it by
1. making sure the XP PYTHONPATH system variable exists and includes
at least: C:\python26;C:\python26\Lib\site-packages\dd_django;C:
\Python26\Lib;C:\Python26;C:\p
The trouble is that I've got third-party apps that have their own
views that don't include the template logic.
so in thirdpartymodule.views.py:
def thirdpartyview(request, vars):
# Do lots of fancy processing
return render_to_response('template.html', context)
In my project, I need a
./manage.py help test
Does changing verbosity help?
On Tue, Oct 13, 2009 at 10:59 PM, Phlip wrote:
>
> Djangoids:
>
> Unit tests should run as silent as possible, so we don't get too
> familiar with their spew. Ideally, any spew should raise your index of
> suspicion, and a test batch that alway
True. I'd like to find a solution with as few places as possible to
maintain changes, though.
> Even if you patch django and add request argument to get_template you
> also should rewrite all aplication views to push their requests into
> get_template.
>
> It's quite simple to only patch views
Seems that any solution would be dirty, so why don't you set threadlocal
variable with request and monkey-patch template loader?
On Tue, Oct 13, 2009 at 11:03 PM, Nan wrote:
>
>
> The trouble is that I've got third-party apps that have their own
> views that don't include the template logic.
>
>
Михаил Лукин wrote:
> ./manage.py help test
> Does changing verbosity help?
Da! Thanks! and my theory was correct - I wasn't even noticing this
one:
Failed to install custom SQL for searchable.Searchable model: near
"(": syntax error
Don't worry about me I will fix it...
But note the fixture
Definitely one possibility. I've heard threadlocals is unreliable,
though. Is that correct?
Here's another option I'm considering
Say thirdpartyview renders 'template.html'. I can write my own
template.html that looks like so:
{% extends 'template.html'|theme %}
{% block someblock %}
As an aside, it seems curious to me that in a generally flexible
framework like Django a problem like this should have only a dirty
solution. I've encountered a few instances where it would be useful
to have access to request variables, but there's no way to pass them.
On Oct 13, 3:10 pm, Миха
Using template filters doesn't guarantee that given template is rendered in
RequestContext, not in Context. so, you still have to use threadlocal to
pass request through.
You may look at middleware framework to save request variable at threadlocal
in less dirty way. Also you may subclass template l
Are you asking about the technical details of how it's done, or just
how to do it?
If the latter, django uses field and form level validation.
http://docs.djangoproject.com/en/dev/ref/models/fields/#field-options
http://docs.djangoproject.com/en/dev/ref/forms/fields/#ref-forms-fields
On Oct 13
Hi all,
I need to show a confirm message when the data is saves successfully
in the database.
My view function snippet is as following:
def itemSave(request, id=None, d={}):
if request.method == "POST":
if request.method == "POST" and form.is_valid():
if action == 'Save
Daniel,
.get() was one of the several options I tried before with no
results... When I use .get() the form only displays the submit
button... I am asuming that that is because the template is specting
a dictionary and I am only supplying a value...
Also, .get() only returs the" __str__" value,
First of all, you don't need to check request.method == 'POST' twice; you
don't need to check action here.
Finally, you can use user messages to add and display confirmations:
in view:
http://docs.djangoproject.com/en/dev/topics/auth/#messages
Put messages in base template and you can see them eve
Thanks a lot Mihail :-)
Really appreciate it.
Thanks,
Sincerely,
Sonal.
On Oct 13, 1:53 pm, Михаил Лукин wrote:
> First of all, you don't need to check request.method == 'POST' twice; you
> don't need to check action here.
> Finally, you can use user messages to add and display confirmations:
>
On Oct 13, 9:41 pm, LuisC wrote:
> Daniel,
> .get() was one of the several options I tried before with no
> results... When I use .get() the form only displays the submit
> button... I am asuming that that is because the template is specting
> a dictionary and I am only supplying a value...
Wh
Hi!!,
well, I am trying to bind the form... It seems that I was a little
harsh.
You are right... your bind works perfectly and now the forms displays
the data to be updated.
OK with the get()...
Thank You for your time and patience
On Oct 13, 5:27 pm, Daniel Roseman wrote:
> On Oct 13,
On Oct 14, 12:55 am, Geobase Isoscale wrote:
> Hi All,
>
> I'm working with PostgreSQL database.
> I wonder how Django handles Check Constraints both (range and value based).
> To ensure integrity of data in the database as postresql does.
>
> How are they implemented in models and views.
>
Djan
I'd like to show for editing the 'owner' field only to superuser; I'm
using django 1.0:
class ProductAdmin(admin.ModelAdmin):
form = ProductForm
fieldsets = [
('Product Identification', {'fields': ['owner', 'code', ...),
('Product Description', {'fields': ['...]
Matt, I too prefer enforcing check constraints at database level ( database
and model) as opposed to GUI(graphical user interface) i.e. (Forms). Do
your mean that its not possible for Django to recognize postgreSQL defined
Check constraints when data is entered in the Form? (or what do u mean by
Thanks for the reply...
This is the kind of thing I am looking for. However I have tried this
approach and I could not get it working exactly right.
Along this line I have tried the following:
class MyForm(forms.Form):
def __init__(self, extra_param=None, *args, **kwargs):
self.e
On Oct 13, 2009, at 4:46 PM, Geobase Isoscale wrote:
> Do your mean that its not possible for Django to recognize
> postgreSQL defined Check constraints when data is entered in the Form?
That's correct. CHECK constraints on the PostgreSQL database are not
automatically enforced at the form
Has anyone run into this a problem with forms throwing 500 errors
when forms are submitted with just whitespace for a text field?
Django 1.1
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To po
I'm replying to my own message because I was getting some strange
behaviour and this is how I fixed it.
I would occasionally see unformatted debug_toolbar output after my
"under construction" page. I could reliably reproduce this "bug" (I
think it's a bug but I have no idea where) via the
On Tue, Oct 13, 2009 at 8:03 PM, coolis_willis wrote:
>
> Has anyone run into this a problem with forms throwing 500 errors
> when forms are submitted with just whitespace for a text field?
>
> Django 1.1
>
Not here. What is the error? It would help to figure out a diagnoses.
Michael
--~--~
On Tue, Oct 13, 2009 at 10:43 PM, fsaintma
wrote:
>
> hello
>
> I have a model.py like this :
>
> class secondaryGroup(models.Model):
> id = models.AutoField(primary_key = True)
> idGroup = models.ForeignKey(Group,db_column =
> 'idGroup',verbose_name = 'Groupe',limit_choices_to = Q(state='val
On Oct 14, 9:57 am, Christophe Pettus wrote:
> On Oct 13, 2009, at 4:46 PM, Geobase Isoscale wrote:
>
> > Do your mean that its not possible for Django to recognize
> > postgreSQL defined Check constraints when data is entered in the Form?
>
> That's correct. CHECK constraints on the PostgreSQ
I'm trying to use django without resorting to setting the environment
variable, by doing this:
from django.conf import settings
import mysettings
settings.configure(mysettings, DEBUG=True)
The mysettings.py originally just contained those in the default
settings.py file.
However, I keep getting
Please help :(
On Oct 13, 1:52 pm, Benjamin wrote:
> Hello all,
>
> I have roughly the following model:
>
> class Room(models.Model):
> number = models.IntegerField(unique=True)
> def __unicode__(self):
> return str(int(self.number))
>
> class Desk(models.Model):
> room = mod
when i set my test webserver root
C:\app>django-admin.py startproject mysite
I got a error msg
Traceback (most recent call last):
File "C:\Django\build\scripts-3.1\django-admin.py", line 2, in
from django.core import management
ImportError: No module named django.core
what's wrong with
make sure you have installed the django properly.
open a python shell:
type :
import django
import django.core
if the import does not work it means django has not installed
properly.
http://docs.djangoproject.com/en/dev/
On Oct 14, 9:32 am, Gin wrote:
> when i set my test webserver root
>
> C:
Thanks a lot, i found the problem.
I have a PY3.1 before,but the appengine tools doesn't work with it, so
I uninstall it, and setup the PY2.5
now i have setup again, and it works now~
THANKS RAMA~!
On Oct 14, 12:35 pm, Rama Vadakattu wrote:
> make sure you have installed the django properly.
Sorry for my lack of prompt response.
Mostly, we want to hide the underlying user mechanism from the people
that are going to use this admin interface. We want email addresses
to be the unique identifiers in the system, and for records with the
same email address to be automagically associated w
I just tried upgrade to django 1.1, ran ./manage.py runserver, but was
promptly halted due to this exception:
...
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
site-packages/django/utils/translation/trans_real.py", line 180, in
_fetch
app = import_module(appname)
F
84 matches
Mail list logo