Sorry guys, apparently I found a solution, but...
Well I swear I tried it before, but now it's working. I did this:
try:
tarfile.open(fileobj=file)
except:
raise forms.ValidationError(msg2)
Anyway.
Cheers,
Alan
On Tue, Dec 23, 2008 at 21:18, Alan wrote:
> Hi,
>
I want to share the solution to my problem. I appreciate the kindness
of Malcolm for the suggestions.
After some searching in tinyMCE site, I found a note that recommends
to explicitly leave
option "entities" to empty, I show you a sample:
tinyMCE.init({
// General options
Thanks :-)
On Dec 22, 4:01 am, leveille wrote:
> You're 14. You recognize that you're having a problem and you post to
> the Django group for help. You're not stupid at all. I would say
> you're very intelligent!
>
> On Dec 21, 2:43 pm, Chris
Hi,
I'm trying to do something fairly simple (and doable), but I was
wondering if there was a "best practices" approach. I'm developing a
client-heavy app, and I'd like to return something like this to my
JavaScript:
{"posts": Post.objects.all(), "comments": Comment.objects.all()}
Right now,
vernon wrote:
> Hi,
>
> I'm trying to do something fairly simple (and doable), but I was
> wondering if there was a "best practices" approach. I'm developing a
> client-heavy app, and I'd like to return something like this to my
> JavaScript:
>
> {"posts": Post.objects.all(), "comments":
Hi I have a ManyToMany field names in my class and I would like to show the
names in sorted order (according to 'name') in the admin interface when I
edit a Person. Right now it's showing by the pk order of Name. What's the
right way to override this order? Thanks
class Name(models.Model):
name
http://docs.djangoproject.com/en/dev/topics/http/file-uploads/
here is a sample how to handle file upload
And have tried:
MyForm.save()?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post
The other reply was correct; it's a character encoding issue. Take a
look at http://www.postgresql.org/docs/8.3/static/multibyte.html - I
suspect you will need to run initdb -E UTF8 to set the default
character set for the postgres install. Alternatively that page
instructs how to create a
Hi There,
So I have a form where users can upload zip and tgz file. In my def
clean_file() for class MyForm, I can clean zip files smoothly and now I am
trying the same for a tgz file but missing things.
First, fileobj = self.cleaned_data['file'] will return a fileobj, so I
tried:
tar =
Wiadomość napisana w dniu 2008-12-22, o godz. 20:40, przez Matias:
> You can add a hidden input named "next" where you put the value of
> next in the GET variable.
> Like this
>
>
>
>
>
>
> Or you can change the action variable of the form to include the
> current GET variables.
Hello :) (sorry I'm French)
When I create a ticket (for a blog), I select various tags.
I would save these with the save_model and save_tagged_items methods
below :
class TicketAdmin(admin.ModelAdmin):
# ...
def save_model(self, request, ticket, form, change):
# Save the
Thanks. Sadly though I don't want it to extend base.html, I want it to
replace base.html but only under certain circumstances.
As an example, base.html will have the current structure:
__header__
| |
nav | content | content
| |
__footer___
I have also missed out a last line at the end of the Traceback ...
this may be important in fishing out the error. The last line is:
OSError: [Errno 2] No such file or directory
Looking forward to some kind of suggestions.
Thanking you all once again and with Regards.
On Dec 22, 11:51 am,
I have found a workaroud to this, by using the AdminSplitDateTime
widget and then rendering field in the template, the right thing
happens:
in form code:
from django.contrib.admin import widgets as adminWidgets
class Dummy1Form(forms.ModelForm):
name = forms.CharField(max_length = 100)
Hi,
look at the module reference at python documentation:
http://www.python.org/doc/2.5.2/lib/module-tarfile.html
You can see there an is_tarfile to check if it is a tar file, or you can
use TarFileCompat to check if it is a tar_gzipped file.
Alan wrote:
> Hi There,
>
> So I have a form where
Jeff Kowalczyk wrote:
> I'm working with a model using a CharField primary key, ...
> I need to prevent other objects from being created/updated
> if save() is called with a changed pk value.
>
> class Widget(models.Model):
> identifier = models.CharField(primary_key=True, max_length=10)
I
On Monday 22 Dec 2008 4:21:31 pm Anurag wrote:
> comd = [\
> "tar -xf x.tar.gz", \
nothing to do with python:
[law...@localhost programs]$ tar -xf x.tar.gz
tar: x.tar.gz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
btw, there is no need to put '\'
Strange, that thread is down for me. Maybe it has something to do with
cacheing in a different locale...
Anyhow, the idea is to create a new django instance and point to
different settings.py files for different wildcard subdomains. here
is current Vhost:
ServerAlias
I really like the concept of generating a form from a model using
ModelForm but would like to customize the apprearance slightly (e.g.
size of the TextInput etc.).
Any suggestion as to how to do this?
I looked at the forms module code but got lost in the maze of the meta
programming...
Thanks
Hey,
I'm getting a weird issue in Django with my css and Safari - displays
great in all browsers except for Safari. Happens in two different
django installations on two separate servers so clearly I'm doing
something wrong. CSS files are accessible directly via URL in both
cases... odd
Apart
OK tracked it down - appears Safari doesn't sit well with a
master .css file and @import url(blah.css); I guess that's because of
the way I'm serving up static files.
Direct " wrote:
> Hey,
>
>
I just saw your message below after sending the vhost.
I don't think i'd mind whether it's separate processes or one really
fat one. I think perhaps separate processes with a quite a short
inactivity timeout might work quite well? I'd rather keep the overall
footprint as small as
Hi,
Trying to implement a very simple template tag that will output a
company's age. So idea being if company was established in 1860 then
it should output '148 years old' if my math is right ;-)
this is what I've got:
from django.template import *
register = Library()
@register.filter
def
On 23 déc, 11:57, Kura wrote:
> Thanks. Sadly though I don't want it to extend base.html, I want it to
> replace base.html but only under certain circumstances.
Either I don't get you or you didn't get what I said...
> As an example, base.html will have the current
Thank you all for your response. I will try the encoding resolution.
Ana
On Dec 23, 1:29 am, SteveMc wrote:
> The other reply was correct; it's a character encoding issue. Take a
> look athttp://www.postgresql.org/docs/8.3/static/multibyte.html- I
> suspect you will need
I answer django developpers (http://groups.google.com/group/django-
developers/t/280bca5001faca07) so wait and see.
On 6 déc, 09:34, Thierry Stiegler wrote:
> Hello,
>
> I got some errors by using the Meta optionsorder_with_respect_to:
>
> class
Hello,
I am having some trouble serving static files with the development
server. I have read the docs and various blogs out there and nothing
seems to work. I am going nuts over this :) I have tried tweaking the
values in my settings.py but I reverted them back to their defaults.
Below is the
Sorry...
ADMIN_MEDIA_PREFIX=/media/admin/
On Dec 23, 9:38 am, "tom.s.macken...@gmail.com"
wrote:
> Hello,
>
> I am having some trouble serving static files with the development
> server. I have read the docs and various blogs out there and nothing
> seems to work. I
On Dec 23, 10:38 am, "tom.s.macken...@gmail.com"
wrote:
> Hello,
>
> I am having some trouble serving static files with the development
> server. I have read the docs and various blogs out there and nothing
> seems to work. I am going nuts over this :) I have tried
sagi s wrote:
> I really like the concept of generating a form from a model using
> ModelForm but would like to customize the apprearance slightly (e.g.
> size of the TextInput etc.).
>
> Any suggestion as to how to do this?
A standard way to do this is via CSS. When you render your form in
your
On Dec 23, 9:53 am, Alfonso wrote:
> Hi,
>
> Trying to implement a very simple template tag that will output a
> company's age. So idea being if company was established in 1860 then
> it should output '148 years old' if my math is right ;-)
>
> this is what I've got:
Hello,
I am having slowness issues with my local set-up.
My system was 10.4.x when django was set up and everything was fine.
I upgraded to 1.5.6 (went from a 10.5.4 install disc to 10.5.6 via
updates). After the update my local django is very slow.
It seems to struggle with serving up the css
Thanks Rajesh! it works!
On Dec 23, 10:47 am, Rajesh Dhawan wrote:
> On Dec 23, 10:38 am, "tom.s.macken...@gmail.com"
>
>
>
> wrote:
> > Hello,
>
> > I am having some trouble serving static files with the development
> > server. I have read
Cheers :)
Damn, I must have been a bit tired coding that up lol
Here's my working code (incase anyone else is as stupid as me):
Login:
Username:
Password:
On Dec 23, 4:23 pm, Malcolm Tredinnick
wrote:
> On Mon, 2008-12-22 at 19:03 -0800,
You can always add your own custom fields, by default they override
the default fields that becomes with the modelform, and there is an
optional parameter "attributes", which is used to add css class to
your fields.
On Dec 23, 9:47 am, sagi s wrote:
> I really like the concept
Hi,
I would like to find a straightforward way to get the defaults
['empty_permitted'] = False in a BaseFormSet to True, which means that
all forms in a formset should be not empty by default.
Thanks in advance,
Sergio Hinojosa
--~--~-~--~~~---~--~~
You received
Almost resolved :)
I tried everything to find the error and finally I did, but I don't
know how to resolve :(
the error is casued by this line in a imported script:
CITY_URL = reverse('get_city_list')
if I remove that line the project works fine, but I need that line :(
Ps. the url
Hi, I'm trying to save on a FileField some generated data (a text file
obtained from a template):
The relevant code is:
out = Template(open("/path/to/template").read())
context = Context({})
if request.POST["name"] != "":
name =
i'm trying to do some instantiation of models, based on run time
parameters. i'm new to django/python so not sure the term, but the
relative java term is reflection.
for example, if i have a model, in my django models.py:
class Foo(models.Model):
name = models.CharField(max_length=20)
now
i'm working on a simple concept i'm sure others have solved, but i
can't get it.
basically, given some input, i parse it, find which objects to
create, and do it.
so with a model:
class Foo(models.Model):
name = models.CharField(max_length=20)
and input xml of bar
my view would parse
On Tue, Dec 23, 2008 at 12:11 PM, dick...@gmail.com wrote:
>
> i'm working on a simple concept i'm sure others have solved, but i
> can't get it.
>
> basically, given some input, i parse it, find which objects to
> create, and do it.
>
> so with a model:
>
> class
yeah, but that's hardcoding in the "Foo" and "name" value, where they
may be dynamic. Ie, imagine the xml is today
would require the python code to instantiate a Bar(date="today")
class.
> Does this work?
>
> from myproject.test.models import Foo
> f = Foo(name="bar")
> f.save()
>
> Colin
On Dec 23, 8:11 pm, "dick...@gmail.com" wrote:
> i'm working on a simple concept i'm sure others have solved, but i
> can't get it.
>
> basically, given some input, i parse it, find which objects to
> create, and do it.
>
> so with a model:
>
> class Foo(models.Model):
>
Hi,
Thanks for the hint, however, they only applies to tar archive file (give by
path) and not to 'file objects' as you get from "file =
self.cleaned_data['file']" in django models.
More specifically, how to make class tarfile to
handle django.core.files.uploadedfile.InMemoryUploadedFile objects.
looking at the serialization serializers, is is possible to save "new"
instance of a model object represented in xml?
i'm getting an error:
node is missing the 'pk' attribute, but basically, there
isn't one, because i don't want the object retrieved from the db, i
want to instantiate it from
thanks DR! yeah, i'm just learning python, and was fuzzy on the object
model stuff.
works perfect.
On Dec 23, 1:09 pm, Daniel Roseman
wrote:
> On Dec 23, 8:11 pm, "dick...@gmail.com" wrote:
>
>
>
> > i'm working on a simple concept i'm sure
On 23 déc, 20:23, "dick...@gmail.com" wrote:
> i'm trying to do some instantiation of models, based on run time
> parameters. i'm new to django/python so not sure the term, but the
> relative java term is reflection.
The term in Python is... well, it isn't. With a dynamic