Yeah it's really odd. Since I posted I did the test that you've just
shown and it's works fine. As soon as I put the same decorator on a
django view function the as_string parameter is not defined in the
wrapper. It's baffled me!
On Apr 6, 10:48 am, Jonathan S wrote:
> Your code looks perfect.
Hi all, not exactly a django question but here goes... I'm trying to
implement a decorator with one positional argument and one keyword
argument. My wrapper function gets the positional argument just fine
but the keyword argument throws an error "NameError: name 'as_string'
is not defined."
Code i
Thanks for the replies. Looking in the log files got me back on track.
There was a SQL query running against the database that would never
work due to the table to existing. Now i know where to look next time!
On Mar 22, 5:42 pm, Jason Culverhouse wrote:
> On Mar 22, 2011, at 10:03 AM, coote
Hi, I've been trying to use Postgresql because I'm thinking of using
that instead of MySQL due to it's ability to role back transactions
making it easier to use South. However I've hit a wall with it and
can't seem to fix it.
I'm using the psycopg2 python library and have tried postgresql 8 and
no
s to place {% csrf_token %} on the pages where I'm making POST
requests regardless as to if those POST's are via a form or AJAX.
On Mar 9, 2:24 pm, cootetom wrote:
> I have got the jQuery that does the ajaxSetup. However the problem is
> when #csrfmiddlewaretoken isn't o
xhr.setRequestHeader("X-CSRFToken",
> $("#csrfmiddlewaretoken").val());
> }
> }
> });
>
> http://www.djangoproject.com/weblog/2011/feb/08/security/
>
> On 9 Mar, 14:59, cootetom wrote
I am experiencing some off behaviour with CSRF but only in IE
browsers. Using Django 1.2.5 (final).
I have a page that has no form and no use of {% csrf_token %} but it
does make a POST request using JavaScript. I have implemented the
jQuery code to grab the CSRF cookie value for all AJAX requests
I take it you're using PyDev with eclipse? My experience is that
eclipse often says that it can't resolve an import but is wrong. Just
remember an import will work if it is on your python path. When you
run the django project from eclipse it will use the python path as
well as the project directory
Excellent, thank you. That does the trick!
On Dec 1, 3:15 pm, Tom Evans wrote:
> On Wed, Dec 1, 2010 at 3:07 PM, cootetom wrote:
> > Hi, I have a question about the ORM.
>
> > If I have model class's:
>
> > class Event(models.Model):
> >
>
&g
Hi, I have a question about the ORM.
If I have model class's:
class Event(models.Model):
class Ticket(models.Model):
user = models.ForeignKey(User)
event = models.ForeignKey(Event)
.
Then I have a user who has 2 tickets for the same event. If I have the
event object and
I think this should work:
Profile.objects.filter(services__creator__isnull = True)
If you query like this and one of the intermediate models doesn't
exist then django will treat that model as if it did exist but with
all of it's values as null. That is as I understand it anyway!
On Nov 10, 9:
ationError,
> but the error message isn't associated to the field form of the
> modelform.
>
> On 8 nov, 19:17, cootetom wrote:
>
>
>
>
>
>
>
> > If you want to associate an error to a specific field in a model form
> > then you need to populate self._e
If you want to associate an error to a specific field in a model form
then you need to populate self._errors with the error you find. Have a
read about this on the Django docs to see how it is done.
http://docs.djangoproject.com/en/1.1/ref/forms/validation/#ref-forms-validation
The last example s
This is a tough one, everything looks okay. I would try removing the
categories variable from your model class just to see if that is
causing problems. By the way, you can get that categories list from an
instance of the Course class in the following way
c.coursecategories_set.all() presuming Cours
Don't do it in the template layer! Why not get the list of events in
the view layer, do the iterate there and mark which ones the current
user is attending. Then you have the logic in python and he template
layer is kept simple.
On Nov 7, 2:34 am, Patrick Deuley wrote:
> I've got a list of even
What does your PartialCourseForm class look like? The code you have
there looks okay to me.
On Nov 7, 3:21 pm, Torbjorn wrote:
> Hi, I want to update a record but somehow it becomes an INSERT
> instead. This is my code:
>
> def editcourse(request, course_id):
> course= Course.objects.get(id
iew(request):
> return MyWizard([Step1, Step2, Step3, ...])
>
> On Nov 3, 9:54 am, cootetom wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > When creating normal views I can decorate the view with
> > @permission_required('some_permission') bu
Hi,
When creating normal views I can decorate the view with
@permission_required('some_permission') but when I'm using a
FormWizard class I don't know where to limit access to it based on
permissions? I have a FormWizard mapped to a URL:
(r'^my_url/?$', Wizard([Step1, Step2, Step3])),
Then I hav
Hi, a firefox extension was recently released to grab session ID
cookies from a private network for the popular sites like facebook etc
You can read about it here http://goo.gl/x4Z1
I was wondering how Django sits with this type of attack. I know there
are the CSRF tokens, do they prevent this tho
django-admin.py is usually located in the bin directory of the django
source. You can use it from there but you need to also say:
python django-admin.py startproject mysite
You must use the python interpreter in order to run a .py file. Hope
that helps.
On Aug 17, 10:29 pm, Marty wrote:
> Ru
@Mark
Out of interest, what features are you looking to implement in your
project management app?
On Aug 15, 3:02 pm, tiemonster wrote:
> I'm working on a GPL project management application for Django, and
> would welcome contribution. I have a working codebase that is by no
> means feature com
Hi, as far as i'm aware, the delete method on models only get's called
if you delete an instance of that modal directly. So if you delete a
modal who has many children, the child delete methods don't get
called. So I suppose the next question would be are you deleting
TrackCategory's directly or ar
You would use CSS for styling.
li { border:1px solid #FF; }
You might want to create a class for error styling though!
On Aug 12, 4:44 pm, reduxdj wrote:
> Hi,
>
> I can't seem to get my form errors to work with customs forms in
> django, following the examples I have done this:
>
>
I use Django 1.2 on Windows 7 using MySQL-Python and Python 2.6.
What's wrong with using Python 2.6 instead of 2.7?
On Aug 11, 4:13 pm, Sithembewena Lloyd Dube wrote:
> Hi all,
>
> Has anybody used Django 1.2.1. on Windows 7 with MySQL-Python? I see that
> MySQL-Python supports up to Python 2.6
You could try using the set_language redirect view to set your
language
http://docs.djangoproject.com/en/1.1/topics/i18n/internationalization/#the-set-language-redirect-view
On Aug 10, 8:12 pm, Renne Rocha wrote:
> I don't know if it will help you, but reading the chapter of
> international
I can't see anything wrong. Maybe someone else will. Maybe just create
a really simple one page web site from scratch and see if you get the
same issues?
On Aug 10, 6:27 pm, kostia wrote:
> Of couse I included a {% load i18n %} tag and then used {% trans %}
> tags in each file.
>
> Still no sol
Have you set USE_I18N = True in your settings.py file?
On Aug 10, 6:13 pm, kostia wrote:
> My base.html has a header:
>
> {% load i18n %}
>
> {% get_current_language as LANGUAGE_CODE %}
>
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>
> http://www.w3.org/1999/xhtml"; lang="{{ LANGUA
Have a read about how Django chooses the language to display here
http://docs.djangoproject.com/en/1.1/topics/i18n/deployment/#how-django-discovers-language-preference
Also have a read about how you can change the user's language
preference on the site here
http://docs.djangoproject.com/en/1.1/top
Using the language files is the solution here. Even if your site only
supports the English language, it still means that you can have .po
files for just English. Once you understand how it all hangs together
you'll be away.
http://docs.djangoproject.com/en/1.1/topics/i18n/#topics-i18n
I have a si
It's all there, you just need to implement it.
http://docs.djangoproject.com/en/1.1/topics/i18n/#topics-i18n
If you'd like a tool to help edit the translation files then check out
one of the following:
http://poedit.tomcoote.co.uk/
http://code.google.com/p/django-rosetta/
http://translate.sourcefo
7:53 AM, cootetom wrote:> Is it better to have one large database
> with all the data for a web
> > site in it or many smaller databases that hold data for specific
> > area's of a web site in it?
>
> > Thinking that one database with some sort of clustering technology
Is it better to have one large database with all the data for a web
site in it or many smaller databases that hold data for specific
area's of a web site in it?
Thinking that one database with some sort of clustering technology is
better than trying to manage many smaller databases?
Also, if data
I have finished and made this app available via it's own web site.
Take a look http://poedit.tomcoote.co.uk/
On Aug 1, 1:18 pm, cootetom wrote:
> I have found some code that can get the request object.
>
> f = sys._getframe()
> while f:
> request = f.f_locals.get
d on specific pages which I think is really
useful, especially if clients want to get involved with text
translation.
On Aug 1, 4:23 am, James Bennett wrote:
> On Sat, Jul 31, 2010 at 12:37 PM, cootetom wrote:
> > Thanks Carlos but I'm trying to achieve getting the path wit
Thanks Carlos but I'm trying to achieve getting the path without
having to pass the request object.
On Jul 31, 7:11 pm, Carlos Daniel Ruvalcaba Valenzuela
wrote:
> Just add django.core.context_processors.request to your
> TEMPLATE_CONTEXT_PROCESSORS, this way you can access the current
> request
I think perhaps I'll also put this problem another way. I need to
cache data against the current web request without having the Django
built request object.
On Jul 31, 4:56 pm, cootetom wrote:
> Hi all,
>
> Is there any way of getting the request.path value without having the
&g
Hi all,
Is there any way of getting the request.path value without having the
request object that Django pass's around. Is there something similar
to os.environ for the web request where I can get the path?
I'm developing an app that needs to cache data on a page basis but the
data may come from
Hi, I've been reading about the text translation capabilities in
Django just recently. It's something I've not needed yet but wanted to
know more about. I wondered if you are able to create site specific
translation strings? The docs say that Django looks for translation
files firstly in the direct
6, 2010 at 8:05 AM, cootetom wrote:
> > Hi all,
>
> > I've decided to upgrade to 1.2 but have hit a stumbling block with the
> > cycle tag. The release notes
> > herehttp://docs.djangoproject.com/en/dev/releases/1.2/#stateful-template-...
> > say that because of
This is cool. Like the 4 random items that are displayed in the web
site banner. Also love the switch between "things to do" and
"completed things" lists!
Great to see someone coming up with an idea and then doing something
about it. Good luck with it.
On Jun 6, 8:26 pm, shacker wrote:
> Hi
Hi all,
I've decided to upgrade to 1.2 but have hit a stumbling block with the
cycle tag. The release notes here
http://docs.djangoproject.com/en/dev/releases/1.2/#stateful-template-tags
say that because of the new thread safe template renderer that
including another template whilst inside a loop
Hi all,
I've decided to upgrade to 1.2 but have hit a stumbling block with the
cycle tag. The release notes here
http://docs.djangoproject.com/en/dev/releases/1.2/#stateful-template-tags
say that because of the new thread safe template renderer that
including another template whilst inside a loop
You are right though. In my experience, using Pisa to do HTML to PDF
conversion isn't pixel perfect.
On Apr 21, 2:29 pm, derek wrote:
> On Apr 21, 1:14 pm, Alessandro Ronchi
> wrote:
>
>
>
>
>
> > 2010/4/20 cootetom :
>
> > > django and and pisa
django and and pisa are great for creating PDF's because you can
combine django's templating engine with pisa's HTML to PDF conversion.
Pisa uses the reportlab tool kit. http://pypi.python.org/pypi/pisa/
Example:
import ho.pisa as pisa
import cStringIO as StringIO
from django.template.loader imp
tions-for-overriding-djangos-cascading-delete-behaviour
On Apr 13, 7:49 pm, cootetom wrote:
> OK I've tried the pre_delete approach but unfortunately it doesn't
> work for what I'm trying here. It appears that django gets a
> collection of objects that it is going to dele
y more ideas?
On Apr 13, 9:29 am, cootetom wrote:
> Thanks Ian,
>
> I'll give that a go later. I don't suppose it matters what order they
> are called in because it's only clearing references to do with the
> model instance it's calling from.
>
> On Apr
://docs.djangoproject.com/en/dev/ref/signals/#pre-delete
>
>
>
>
>
> On Tue, Apr 13, 2010 at 8:21 AM, cootetom wrote:
> > Hi, I'm trying to figure out the way django deletes models so that I
> > can clear the correct references that I need to prior to deletin
Hi, I'm trying to figure out the way django deletes models so that I
can clear the correct references that I need to prior to deleting. So
I have models set up with overrided delete functions so that I can do
clears before the actual delete. However, it appears the delete
functions in a model don't
You have a mix of techniques here. You are allowing markup to be saved
into the database and then when being displayed in a template you are
again adding mark up there to! Why don't you have a model which has a
"title" field and a "body" field. That way the user doesn't have to
get involved with en
Hi,
The user gets A. Django's caching doesn't know that the database data
changed. You could override the save method on the model so that when
data is saved you clear the cache, or update the cache maybe.
On Feb 21, 9:22 pm, Itay Donenhirsch wrote:
> hi folks, a little question: when using
Hi all,
Thanks for every ones help on this. I have a fix now which is working
well.
from django.forms.models import model_to_dict
values = model_to_dict(model_instance)
for k, v in request.POST.copy().items():
values[k] = v
form = FooForm(data = values, instance = model_instance)
model_inst
request.POST)
It then fails on form.is_valid() because it's trying to match a date
string in a date value that is actually a list with one value in it
instead of a date string!
On Feb 16, 9:22 am, Daniel Roseman wrote:
> On Feb 15, 10:31 pm, cootetom wrote:
>
> > Thanks Javier
gt; On Mon, Feb 15, 2010 at 4:27 PM, cootetom wrote:
> > I'm looking for something in the framework that I think must exist
> > somewhere but can't seem to find anything. I'm after a bit of code
> > that takes a dictionary (a.k.a the POST dictionary) and a model
>
I'm looking for something in the framework that I think must exist
somewhere but can't seem to find anything. I'm after a bit of code
that takes a dictionary (a.k.a the POST dictionary) and a model
instance, then merges the two into a new dictionary. The new
dictionary then contains all values from
What is the problem you are trying to solve with this?
On Feb 7, 12:08 am, adamjamesdrew wrote:
> Does django have the ability to do a callback when a session time out
> occurs?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to thi
Hi John,
Django doesn't server static files. It leaves that up to the web
server software. Have a read here
http://docs.djangoproject.com/en/dev/howto/static-files/
Most people have a condition URL for serving static files through
django whilst in development. In production you can serve through
'public/index.html' is a relative URL. I think the problem is probably
because Apache is trying to open the directory from a place where is
doesn't exist. You can make it an absolute path from the executing
file by using the following code.
import os
os.path.join(os.path.dirname(__file__), 'publi
You are created a PhoneForm but passing it an instance of User. You
need to pass the form an instance of the model it works on.
- Tom
On Jan 30, 3:45 pm, Praveen wrote:
> Hi
>
> here is my views
> def phone_register(request, success_url=None,form_class = PhoneForm,
> template
Hello,
403 is a forbidden error. 301 is a resource moved error. In order to
serve your web site to multiple machines you really need to install
Apache. The development server is used for development and is pretty
unstable for multiple users. Have a read about installing Apache for a
local intranet
This might be of interest to you
http://codysoyland.com/2010/jan/17/evaluating-django-caching-options/
On Jan 28, 8:53 pm, Saravanan wrote:
> I have Django installed in SUSE Linux with postgres. It is working
> great. Kudos
> I have an issue. I have total database structure containing mor
Hello,
The built in admin system for django names it's URL's by application
name then model name. So if you have an application called "polls" and
in that application you have a model called "poll" then the admin URL
to edit those models would be admin/polls/poll
amdin/polls will show all the mod
Hi all,
I recently ran a load test on my django web site which is running on
an Apache server. I tested it up to a load of 5000 users. I got a few
time out error's on a page that queries mySQL on a date field so I'm
going to index that column to see if that solves it.
However I also got another e
Hi, django doesn't deal with static files. Your web server must serve
static files. You can read about how to use static files whilst in
development in the documentation
http://docs.djangoproject.com/en/dev/howto/static-files/
On Sep 8, 6:59 pm, Hrishikesh Dhayagude
wrote:
> Hi,
> I've recen
Thanks, that looks pretty neat so hopefully I'll have no problems with
that route.
On Sep 7, 7:45 am, Daniel Roseman wrote:
> On Sep 6, 9:16 pm, cootetom wrote:
>
>
>
> > Hi,
>
> > I'm looking to try and run some python code that has complete access
Have you tried this through a proper server? You've stated that your
project isn't running in DEBUG but the django development server is
still just that and may be causing this issue. I'm not sure but can't
see any harm in seeing if you get the same result if you run through
apache to see if it wo
Hi,
I'm looking to try and run some python code that has complete access
to the django framework and some existing app models that I have in a
project as a windows service. I have an app that allows a user to set
up an email that should send sometime in the future. I want a windows
service to be
Hi,
When you create the profile assign request.user to the user, so:
profile_obj = UserProfile(user = request.user)
Also in the UserProfile model make sure that the entries that are
allowed to be blank are set up to allow that, eg:
address = models.CharField(max_length=60, blank = True)
birthd
I've always solved this problem in javascript. Plus if you're using
jquery it's a bit easier. Before you set the date picker just format
the date:
$('input#id_date').val($('input#id_date').val().replace(/(\d+)-(\d+)-
(\d+)/ig, '$3/$2/$1')).datepicker({showOn: 'focus', dateFormat: 'dd/mm/
yy'});
When I first started using django I was surprised that it limited
usernames and didn't allow email address's by default. It is probably
the only thing in the whole framework that I have wanted to change.
Yes it would be nice to have a clear solution rather than the approach
I have taken which is t
Another option you have is to modify the User model directly in the
django source code.
You will need to edit:
django.contrib.auth.models.User
django.contrib.auth.forms.UserCreationForm
django.contrib.auth.forms.AuthenticationForm
Find the username field and use the forms.EmailField instead.
You could try file_name.decode('utf-8', 'replace') which will tell the
encoder not to throw errors but for any character it can't encode it
will replace with a ?
On Jul 31, 12:26 pm, alecs wrote:
> Environment:
>
> Request Method: GET
> Request
> URL:http://172.16.23.33/file/4719e0bdedaa4f741
If you are using the django development server whilst developing then
you can use django.views.static.serve to download static or media
files. You should not use this method in production however as it is
not considered stable. Just place this in your url.py file:
from settings import DEBUG, STAT
Use a modal form for this which includes a file field that has
required set to false.
http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#topics-forms-modelforms
http://docs.djangoproject.com/en/dev/ref/forms/fields/#filefield
Easier to let django handle the request then figure it all
You may have to do a bit of computation back on the server in python
code to get the data you're after. From the pagination object you know
what page you are currently on, you also know how many items are on a
page so:
last_item = page_num * items_per_page
first_item = last_item - items_per_page
Yes, have a read of the documentation. When you create a pagination
class you have access to all the variables needed that tell you how
many pages there are, what page you are currently on etc.
http://docs.djangoproject.com/en/dev/topics/pagination/#topics-pagination
On Jul 29, 3:15 pm, Aldo w
To add, something just popped into my head. Have you got
DEFAULT_CHARSET = 'utf-8' in your settings.py file.
On Jul 29, 2:51 pm, cootetom wrote:
> I would imagine that the deserialize function tries to encode the
> input down to ascii. My suggestion would be to find the XML s
I would imagine that the deserialize function tries to encode the
input down to ascii. My suggestion would be to find the XML serializer
code and see what it is doing with the input string you pass to it.
On Jul 29, 2:23 pm, l5x wrote:
> Hello,
>
> first of all, congratulations!
>
> I have a p
e
investigating to try to figure that out.
On Jul 29, 9:32 am, Jarek Zgoda wrote:
> Wiadomość napisana w dniu 2009-07-28, o godz. 21:36, przez cootetom:
>
> > Firstly I have characters encoded by MS Word saved into the database
> > in there encoded form. Retrieving these back from
d figure out how
to convert the MS Word special encoded characters to something
understanding by python.
On Jul 28, 7:04 pm, phoebebright wrote:
> Be very interested in the answer too!
>
> On Jul 28, 4:02 pm, cootetom wrote:
>
> > I know why it's failing when I send it as
I know why it's failing when I send it as an email. The django
EmailMessage class will try to encode any text based attachment down
to ascii. So any attachment containing characters out side of ascii
can't be sent using django's EmailMessage class.
This doesn't really solve my problem, sort of ma
So is there a way of getting that hex back into suitable text?
On Jul 28, 12:06 pm, Jani Tiainen wrote:
> cootetom kirjoitti:
>
> > Hello,
>
> > I'm having some trouble with strange characters that come from MS
> > Word. User's are copying text from MS Wo
The problem might be that the content encoding of the rtf or email
> message is not set properly.
>
> cootetom wrote:
> > Hello,
>
> > I'm having some trouble with strange characters that come from MS
> > Word. User's are copying text from MS Word, pasting
Hello,
I'm having some trouble with strange characters that come from MS
Word. User's are copying text from MS Word, pasting it into a textarea
on the site. I then save that text into MySQL (table charset is set to
utf-8). Then later I retrieve that data to create a RTF document then
an email it
Hi all,
I'm looking for a file browser app that will enable user's to manage
files on the server in a given directory. I've found this app
http://code.google.com/p/django-filebrowser/ with looks great but
seem's to be only for the admin interface. I need one that can be
installed out side of the
84 matches
Mail list logo