If you're using apache you might want to consider wiring your app to
generate mod_auth_token URLs and have apache receive these.
On Dec 15, 8:29 am, NoviceSortOf wrote:
> What is the best way to allow authorized downloads
> to specific users in Django.
>
> We have 2 possible scenarios that could
It looks like order is important. I don't think there's much you can
do other than declare it twice in this case.
On Aug 5, 8:59 am, Alessandro Ronchi
wrote:
> If I load jquery-ui (a custom full download) in my admin I get this script
> error:
> c is undefined
>
> If I load 2 times jquery with
>
AFAIK mail_admins is designed to send error messages to the site
administrator, not for the purpose you are proposing, so you won't get
the original email. Your proposal seems reasonable enough to me since
you're not using mail_admins as designed.
Why take only the second admin email address?
On
Why would you want to do such a thing? md5 is very week compared to
sha1 and has known vulnerabilities, e.g.
http://searchsecurity.techtarget.com/news/article/0,289142,sid14_gci1430587,00.html
On Aug 3, 2:45 pm, Seaky wrote:
> Hi,
>
> I want to modify type of hash by default in auth (sha1 -> md5)
I believe ModelChoiceField is meant to be used with ModelForm. I'd
stick to one or the other. Either use ModelForm and let it do the
work, or use Form and do the work yourself rather than trying to get
ModelChoiceField to work.
Euan
On 29 July, 05:23, Carlos Daniel Ruvalcaba Valenzuela
wrote:
>
For the UserProfle model you've provided you won't be able to user
the UserCreationForm as there are a load of extra fields. Moreover
because User is a foreign key from that model it isn't a straight-
forward matter of using a model form. To get a single model form to
split the work to two underly
The traceback tells you exactly what the problem is. The correct kwarg
is max_length
On Jul 21, 2:00 pm, balu wrote:
> Respected sir
>
> This is balu studying B.Tech third year. I started working on django
> in order to create dynamic website. My Python version is 2.6.5. While
> I'm using creati
I think you need to install readline before you compile python.
iPython doesn't work properly without it, although I've never seen it
give a traceback - it usually just looks a bit forlorn.
On Jul 21, 2:02 pm, Ingo86 wrote:
> Hello all,
> i'm on MacOSX Snow Leopard and I have an issue with iPytho
Django doesn't support the query type you're trying to do. You've
already discovered F which is about as complicated as it gets, bt the
update syntax is pretty much limited to setting a field's value to a
consant.
Looping over the minimum set of things and calling save on each one if
your only opt
This is a standard encode/decode situation you are descibing. Django
automatically decodes the GET string the the browser encodes. If you
need spaces, then they wil be encoded and decoded appropriately, so
don't worry about that.
If you want to pass a list in the GET string, do:
url?var=1&var=2&v
I think the problem you're facing is that you're trying to concatenate
a string and an object together. Before I dive into the explanation,
you might want to bear a couple of things in mind:
1) Your unicode method doesn't explicitly return a unicode object
which will be a problem if any of the var
I'm not sure I understand exactly what the problem is. The post you
cite seems to have the exact solution you are looking for. I
appreciate that you don't want to violate DRY, but pretty much every
Django view I've written ends with render_to_response. In your
situation you just give the "templates
I have created a decorator for Django views which handles AJAX
tracebacks and sends the traceback back to the AJAX application as
JSON, e.g.
{'status':'error', 'message': }
It uses the traceback module to output the full traceback. Obviously
you need to have a handler that receives this data and
I've never found any documentation. It's pretty useful if you're
having import issues.
On Jul 8, 7:25 am, Kenneth Gonsalves wrote:
> hi,
>
> any reason why get_model() in django.db.models is not documented? Or is it
> just that I cannot find it?
> --
> Regards
> Kenneth Gonsalves
> Senior Associa
eplacing the url that the user sees? IE,
> instead of showing ://admin/auth/user, show ://admin/auth/
> user_delete_confirmation? And if so, how does one do this? I don't
> think you can replace the url with render_to_response, right? I could
> do a redirect, but if I did that,
Hi again,
I've had a read over your blog tutorial and have the following
suggestions:
1) Make it PEP-8 (http://www.python.org/dev/peps/pep-0008/) compliant
- it's a lot easier to read.
2) Except only the error that might occur in the paginatior example.
Bare excepts are BAD.
3) Maybe consider ena
As stated there is no way to filter on any non-field attribute,
property or method.
However, don't despair. If the result of your permission check can be
expressed as another Django query then it should be possible to
construct something in the ORM that uses this. That said, we have had
trouble wi
I'm not entirely sure whether you're asking one question or two here.
Firstly, I think that in the RESTful sense, there's nothing wrong with
having a confirmation page that uses the same URL to perform an action
*providing* the HTTP verb is different. In this case the confirmation
page is accessed
You'll need to do the test in the view and then pass the result of the
test into the template.
On Jul 7, 10:13 am, grimmus wrote:
> Hi,
>
> I need to show a javascript lightbox popup for new visitors to my
> site.
>
> I presume using a cookie is the best way to achieve this. But how can
> i check
I think the solution is pretty self-explanatory. Could you give
details of the specific problem you're encountering, because, as far
as I can see, the snippet given in the referenced post is excellent,
although I fail to see why any one would want to support a cross-PHP/
python application out of c
tra() clause or perhaps look at using a property bound to a
> method however at this point you're outside the scope of the ORM.
>
> Any ideas on how I can best acheive this?
>
> I'm trying to stay away from using a foreach and looping over a
> potentially large number of r
The link to your snippet doesn't work for me.
It sounds like a neat idea. However, I've never come across a
situation where I've needed to do that in 2.5 years of developing
Django templates, and, whilst I agree that we don't want to get into a
holy war about whether stuff should be done in templa
a bit about startup steps.
>
> Graham
>
> On Jul 5, 4:25 pm, "euan.godd...@googlemail.com"
>
>
>
> wrote:
> > If you read the source for django.core.management.__init__ you'll find
> > a function called "setup_environ. This is called by all
Glad to be of assistance. Let me know when it's finished or if you
want another look over,
Euan
On 3 July, 15:22, Rainy wrote:
> Thanks for great feedback, Euan. I've added some comments below.
>
> On Jul 3, 8:26 am, "euan.godd...@googlemail.com"
>
> wrote:
Erm. You don't seem to have specified what to order by. In this case,
surely you want ... .order_by('date_time') However, this field doesn't
seem to appear in your models.
One thing I've found handy for debugging Django's ORM to SQL is
something which I don't think is documented in django docs at
If you read the source for django.core.management.__init__ you'll find
a function called "setup_environ. This is called by all management
commands (i.e. manage.py). If you note here the os.environ is set
unconditionally. I suppose for your setup to work correctly django
should be doing:
if not "DJ
I had a look over your tutorial and it looks pretty sweet. Definitely
gets down into explaining how to use the admin interface and taught me
things I hadn't realized. I have a few suggestions for you (feel free
to ignore :)):
1) I'm not sure how good an idea it is to call the attribute on your
Dat
Seems good to me. You could have a preferences model which has a one-
to-one relationship to a User. Your method is sound that it saves an
additional SQL query to get the extra info, but if you have the auth
context processor enabled you can always do:
{{ user.preferences.employee }} # where emplo
When you say "an apache 404 error" do you mean a non-Django styled
one? If so, I think there's something wrong with your apache
configuration and not your Django app. What mechanism are you using to
serve the application? I have seen issues like with this mod_wsgi when
the reload mechanism isn't tr
We have a Django solution that blends both SSL and none SSL. We did it
by creating a decorator for views that adds an attribute to the view
function and then some middleware that ensures these views are always
server over SSL (with a permanent redirect to the SSL equivalent if
necessary). We also r
I think you're maybe a bit confused about what exactly LAMPP provides.
If you're going to use phpmyadmin, you might want to re-think going
for Django in the first place. Django provides a much more tailored
admin interface than phpmyadmin will give you (although the latter is
great for custom SQL,
If you're going to use Mako and SQLAlchemy I'd use Pylons or
repoze.bfg rather than trying to crowbar them into Django.
Django's templating engine and ORM are used on many high volume sites
without any issues of scalability, so if you're keen to learn the rest
of Django I'd stick to that.
On the
The frozenset wasn't any commentary on your approach or speed of
parsing, I just like to use them where-ever possible.
My only concern with your approach was that you were expecting every
field on the model to be in the dictionary. Looping over the
dictionary's items and ignoring any fields that a
, value in dictionary_of_field_values.iteritems():
if field in allowed_fields:
setattr(obj, field, value)
Euan
On Jun 30, 1:36 pm, Tim Chase wrote:
> On 06/30/2010 02:10 AM, euan.godd...@googlemail.com wrote:
>
> > I think you need to be careful messing with __dict__ as Django tu
I think you need to be careful messing with __dict__ as Django turns
most fields in descriptors behind the scenes so setting them in the
__dict__ could break these.
I'd stick to setattr and maybe verify that the key in the dictionary
is one of the model's fields. I think there is a method on _meta
I'm not sure whether you could define tags with these names yourself
that do nothing (or a safe version of what Django allows). I suspect
Django might not allow this and give a name clash.
Alternatively you could parse any such tags out of the user defined
templates before passing them to the temp
the admin files is responsible
> for the search engine so that I can extend it?
>
> On Mon, Jun 28, 2010 at 10:27, euan.godd...@googlemail.com
>
> wrote:
> > I think that would be quite an undertaking as you would need to write
> > an expression parser and monkey around w
Django admin can't differentiate between empty string and None and
picks empty string which makes sense in most cases.
If you don't like the idea of empty string override the save method
and coerce empty string to None before calling the super classes save,
e.g.
class YourModel(models.Model):
I think that would be quite an undertaking as you would need to write
an expression parser and monkey around with the search code in admin.
If you succeed, I'd be interested to see the result.
Euan
On Jun 28, 8:36 am, Massimiliano della Rovere
wrote:
> I'd like to modify the default search engi
That's a great solution. Much better than messing around with the
metaclass :)
On Jun 27, 5:47 am, Lee Hinde wrote:
> On Fri, Jun 25, 2010 at 2:54 PM, patjenk wrote:
> > In our application, we have a Model that has a boolean field named
> > "deleted". When the delete() method is called, we set t
It may be possible to sub-class admin.ModelAdmin so that when your two
instances are registered the code won't throw an exception. I suspect
it might be a bit nasty as many such things in Django are often
fraught when you stray off the beaten path.
If I get a chance I'll take a look at the source
There is no reason why all views should pass that variable to the
template. It is more efficient to only pass the minimal variable
necessary to render the template Even the list is lazily evaluated
there is still unnecessary overhead in passing it when not needed.
Euan
On 26 June, 08:50, derek w
LOL. Yeah bpython is interesting. Some of the features were pretty
nice last time i tried it, but it was a bit flaky so I stuck with
iPython. Could have well improved since then though.
On Jun 25, 12:26 pm, Kenneth Gonsalves wrote:
> On Friday 25 June 2010 16:48:49 euan.godd...@googlemail.
> The latter, as I don't have to do at across 200 different boxes, I
> just edit one file in my NFS home directory?
That was joke btw. But for one person running on a single machine with
plenty of resources, I honestly think that iPython is the best option.
I had a read of the link you posted and
> To be a bit pedantic, python itself supports many of these features
> (tab completion, history) if you tell it to.
What's easier, sudo easy_install iPython, or making alterations to the
existing python interpreter and still not having colour :) ?
--
You received this message because you are su
You could possibly alter the metaclass for the media for your model,
but I suspect this would lead to a whole world of hurt.
On 24 June, 20:18, ringemup wrote:
> Is there any way to change the order in which admin media are output
> (e.g. outputting a ModelAdmin-level javascript after a widget-le
Do you mean that you want to include this code in your own app or want
to alter the structure of the admin app?
Either of these actions will require the view that renders the page to
pass the variable app_list into the context as }% if app_list %} will
always be False as Django's templating system
iPython is great for this sort of thing, especially the code
completion with tab.
You could also use the reload statement. This only works when you do:
import foo.bar.MyClass
and doesn't always work correctly, but it might save a bit of typing.
On 25 June, 06:24, Kenneth Gonsalves wrote:
> On
We are in the process of switching from a custom Xapain installation
to Solr as we found Xapian quite limited in its ability to do
faceting, spelling suggestions, or highlighting. If you don't need any
of those things, I would recommend Xapian (although I've not used it
through Haystack). I have us
I can't understand the comments in your code, but it looks like some
graph generating software.
I think the problem you're having is that the first function returns a
HttpResponse half way through (line 53), but then there is some
further processing which will never be accessed.
The second functi
I'd add to Michael's comment that if you're unhappy with this syntax
(I personally find it a bit odd in some cases), you can customize
exactly what word is used there in your model definition.
If you alter the choice model and add the "related_name" keyword to
the foreign key definition, e.g.:
cl
If you do:
python manage.py shell
you will get a python shell with all the necessary paths set up so
that you can do your testing. You may also want to consider some sort
of automated testing as it makes this sort of thing a lot easier and
quicker.
Euan
On 24 June, 05:04, robinne wrote:
> I ha
First of all you might want to reconsider not using the name "type"
for one of your fields as it is a builtin in python.
I guess what you could do it limit the choices using the choices
keyword in the field constructor. However, since this appears to be
dynamic you would need to set it in the mode
Karen's suggestion is great. You can also pass initial data into the
form constructor. So using the example above if you do (in your view):
my_form = F1(initial=dict(rs_field='N'))
you'll achieve the same result. Don't think there's much to be said
for either way other the way I just suggest migh
er be more pythonic than eg running raw sql. Nonetheless, I
> view this as a weakness in Django's ORM, and would plead with TPTB to
> provide a solution, not that it would affect my current problem.
>
> On Jun 21, 11:46 am, "euan.godd...@googlemail.com"
>
> wrot
Do you absolutely need to use MySQL? I've found for development that
sqlite is the most hassle-free. I use OS X for development at home and
it is the easiest option. The only drawback is that if you have
multiple clients accessing the DB you can get locking issues. If it's
just you, then you're sor
Are you doing some image related work in Django admin?
We have had lots of trouble with libjpeg and PIL. We use PIL 1.1.6 and
libjpeg 6. Our install process requires using apt to install the
libjpeg62-dev package before installing PIL 1.1.6.
If you're using a Debian based OS, I'd remove your cust
You could try using Spinhx if you don't think docutils gives you
enough flexibility. The autodoc extension is great.
On Jun 22, 5:24 am, pk wrote:
> Answering my own question -- it is django.contrib.admindocs.view that
> limits the admindocs view to only list methods on a model that has a
> singl
If i understand you correctly you've got a couple of solutions. You
can define a "through" relationship between Student and Teacher usinf
Techer_profile as the "through" table (http://docs.djangoproject.com/
en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships).
Then you should be ab
AFAIK there is no direct way to do this sort of thing in a single
query. select_related will only get foreign key relations into the
query so the ORM will always do an SQL query for each row in your many
to many. In these types of situations I tend to select everything I
need and then run some sort
urllib2 can handle cookies and therefore you should be able to handle
the login. It will probably be a fair bit of work to get the client to
submit the various parts, but I'm sure I've seen some examples around
on how to do such a thing.
Euan
On Jun 21, 3:52 pm, srn wrote:
> Hello to all,
>
> I'
You want:
parent = models.ForeignKey('self', null=True, blank=True)
On Jun 21, 3:37 pm, Magnus Valle wrote:
> Hi,
> I'm trying to make model that has itself as a foreign key, in an
> attempt to store a reverse tree in Django.
> However, I can't find a way to set a default value to
> models.Forei
It sounds like your project is pretty fully featured and if you claim
to be "inexperienced" in Django development this much work is pretty
impressive on a part-time basis over 6 months!
Currently the Django project I am working on has taken over 2.5 years
(and is ongoing). Although we don't just d
Why can't you change the dictionary? Can't you just create a copy of
the dict and rename the keys in your copy using _ rather than - like
so:
>>> bad = {'var-1':'Apples', 'var-2':'Pears'}
>>> good = dict()
>>> for k,v in bad.items():
>>>good[k.replace('-','_')] = v
>>> good
{'var_1': 'Apples
64 matches
Mail list logo