Re: Javascript in external file not working

2012-11-26 Thread Pankaj Singh
On Tue, Nov 27, 2012 at 4:34 AM, Loai Ghoraba wrote: > Hi all > > When I have a script like this: > window.onload=function f(){} it is working fine. but when > I create an external js file and put it within the static directory, and > call the function like this > >

Re: Javascript in external file not working

2012-11-26 Thread Bill Beal
I think {{STATIC_URL}} should have spaces, like {{ STATIC_URL }}. On Mon, Nov 26, 2012 at 6:04 PM, Loai Ghoraba wrote: > Hi all > > When I have a script like this: > window.onload=function f(){} it is working fine. but > when I create an external js file and put it within

Re: django 1.6.0: admin pages not using unicode methods declared in my model

2012-11-26 Thread Anton Baklanov
Hi. I've just checked - it uses __unicode__() to display object names. Please show us your full admin.py and models.py -- Regards, Anton Baklanov -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Django/Selenium how to prevent fixtures from being created more than once (during LiveServerTestCase run)?

2012-11-26 Thread Federico Mendez
Problem: I'm using factory_boy to create some mock up objects so I don't have to use fixtures in my tests (this isn't causing the problem though). I have a function called _create_fixtures() that is called in the setUp() of my class which is causing the following IntegrityErrors:

Re: Django ORM

2012-11-26 Thread Russell Keith-Magee
On Tue, Nov 27, 2012 at 3:33 AM, Alexandra Paredes <05-38...@usb.ve> wrote: > Ok, well the things we're looking to add and/or improve are: Composed > primary key (although we're worried of the difficulty of this one > in particular . A lot of work has already been done on this problem. See

Re: how should I get the request object?

2012-11-26 Thread Russell Keith-Magee
This is an often proposed solution to the problem, but one that I can't recommend to anybody. The very name of your proposed middleware -- GlobalRequest -- should point at why it's a bad idea. You've just defined a global variable, and you've architected your entire system around the availability

Re: Confused about model save/update

2012-11-26 Thread Lachlan Musicman
On Tue, Nov 27, 2012 at 11:16 AM, wrote: > I may se the formating incorrectly (on a phone) but it looks like your save() > method does nothing if self.pk already exists (i.e. model is not new) You are right, quite embarrassing. But it does work in other contexts.

Re: Confused about model save/update

2012-11-26 Thread jirka . vejrazka
I may se the formating incorrectly (on a phone) but it looks like your save() method does nothing if self.pk already exists (i.e. model is not new) HTH Jirka -Original Message- From: Lachlan Musicman Sender: django-users@googlegroups.com Date: Tue, 27 Nov 2012

Re: memory leak? Am I taking crazy pills?

2012-11-26 Thread Dan Ancona
Ah ok. So it sounds like if I drop "print(gc.garbage)" into my code at the right points, I will be able to see where the leak is occurring? I did that and then load tested it (not via anything tricky, I'm just using "ab") via the dev server running locally, but I'm not seeing anything, it's

Re: Confused about model save/update

2012-11-26 Thread Lachlan Musicman
On Tue, Nov 27, 2012 at 11:00 AM, wrote: > Hi there, > > a long shot since you have not provided your save() method. Are you calling > super() there? Jirka, yes I am, but it's only been modified to set the slug: def save(self, *args, **kwargs): if not

Javascript in external file not working

2012-11-26 Thread Loai Ghoraba
Hi all When I have a script like this: window.onload=function f(){} it is working fine. but when I create an external js file and put it within the static directory, and call the function like this window.onload=f It is not working at all. (by the way the url is mapped correctly to the js

Re: Confused about model save/update

2012-11-26 Thread jirka . vejrazka
Hi there, a long shot since you have not provided your save() method. Are you calling super() there? Cheers Jirka -Original Message- From: Lachlan Musicman Sender: django-users@googlegroups.com Date: Tue, 27 Nov 2012 10:14:03 To:

Re: django 1.6.0: admin pages not using unicode methods declared in my model

2012-11-26 Thread Javier Guerra Giraldez
On Mon, Nov 26, 2012 at 12:10 PM, Anton Baklanov wrote: > __str__ method works fine with python 3. that's how it's supposed to be according to the six library. kinda makes sense, since in Py3 all strings are unicode -- Javier -- You received this message because you

Confused about model save/update

2012-11-26 Thread Lachlan Musicman
Hi Sorry about the last email - fat fingered it. For some reason I can't get the model.save() method to actually save the data I want it to. I have tried using both save() and save(force_update=True) without any joy. I have the following model: class Applicant(model.Models): ... successful =

Confused about model save/update

2012-11-26 Thread Lachlan Musicman
Hi I have the following model: class Applicant(model.Models): ... successful = NullBooleanField() ... def mark_successful(self): self.successful = 0 self.last_change_by = request.user self.save(force_update=True) -- ...we look at the present day through a rear-view mirror. This is

Re: Is this a bug or am I doing it wrong? (trans tag)

2012-11-26 Thread Some Developer
On 10/11/12 21:49, Some Developer wrote: In the documentation it is quite clear that the following syntax is correct in templates: {% load i18n %} {% trans "my_string" as blah_string %} {{ blah_string }} etc etc. This works fine if the original trans tag is inside a block but then the

Re: how to auto-populate(auto-update) model's field(s) via custom button or on Save

2012-11-26 Thread Sergiy Khohlov
1. You dont need ManyToMany field class urlclass(models.Model): url =models.CharField() class itemclass(models.Model): url = models.ForeignKey(urlclass) myitem = models.CharField() #somewhere in view def saveitems(url, itemlist): for item in itemlist: item = itemclass(url=

Re: Django ORM

2012-11-26 Thread Alexandra Paredes
Ok, well the things we're looking to add and/or improve are: Composed primary key (although we're worried of the difficulty of this one in particular . Other thing we notice is that Django emulate the DELETE ON CASCADE, making select and deletes instead of using the DB constraint and we would

Re: Seeking pattern for building URLs with all query parameters intact

2012-11-26 Thread Bill Freeman
On Sun, Nov 25, 2012 at 3:17 AM, Darren Spruell wrote: > I've got a handful of applications that feature paginated object lists > as well as a search dialog allowing users to search for simple object > attributes. > > What is the common pattern to use in Django apps to

Re: mod_wsgi using a subpath in combination with a middleware that calls django.core.urlresolvers.resolve is not working

2012-11-26 Thread Bill Freeman
On Thu, Nov 22, 2012 at 11:28 AM, Jan Murre wrote: > Hi, > > I have the following peculiar problem that is very easy to reproduce. > I use a simple middleware the attaches the 'app_name' that is defined in > the urlconf to 'request.user' for subsequent use. > > > from

Re: how should I get the request object?

2012-11-26 Thread Mike S
Sometimes it is very inconvenient to make the `request` object available deep in the call stack, so I wrote a short middleware to work around this issue: http://djangosnippets.org/snippets/2853/ On Monday, November 26, 2012 5:16:01 AM UTC-5, Miaobing Jiang wrote: > > how should I get the

Re: how to auto-populate(auto-update) model's field(s) via custom button or on Save

2012-11-26 Thread Andriyko
The problem is not how to fetch, but how to save. On Monday, November 26, 2012 2:37:31 PM UTC+2, Sergiy Khohlov wrote: > > >>> import httplib > >>> myhost = httplib.HTTPConnection('www.google.com') > >>> myhost.request("GET") > >>> googleanswer = myhost.getresponse() > >>> print

Re: Questions about unicode

2012-11-26 Thread Bill Freeman
On Fri, Nov 23, 2012 at 1:15 PM, Santiago Basulto < santiago.basu...@gmail.com> wrote: > Hey guys, i'm kind of confused here... > > If I get data from a request, say: > > request.GET.get("something") or request.POST.get("something") > > Is it automatically being encoded based on the Encoding of

Re: django 1.6.0: admin pages not using unicode methods declared in my model

2012-11-26 Thread Anton Baklanov
__str__ method works fine with python 3. i will continue searching the truth here and will create ticket (if it will be required after finding truth) thanks On Mon, Nov 26, 2012 at 6:56 PM, ajendrex wrote: > Yes, I'm using python 3. I think there is no ticket for this yet,

Re: django 1.6.0: admin pages not using unicode methods declared in my model

2012-11-26 Thread ajendrex
Yes, I'm using python 3. I think there is no ticket for this yet, but I would prefer someone with better english and more time using django posted it. On Monday, November 26, 2012 1:38:04 PM UTC-3, bak1an wrote: > > No need for that. I've reproduced your problem. With python 3 __unicode__ >

Re: django 1.6.0: admin pages not using unicode methods declared in my model

2012-11-26 Thread Anton Baklanov
No need for that. I've reproduced your problem. With python 3 __unicode__ method is ignored. We should search for corresponding ticket on trac, or create new one. On Mon, Nov 26, 2012 at 6:31 PM, Anton Baklanov wrote: > Hi. I've just checked - it uses __unicode__() to

Re: How to config my django project to use tastypie and mongoengine

2012-11-26 Thread carlos
well mongodb actually no run en django core, but exist other alternative https://github.com/django-nonrel/django-nonrel and http://django-mongodb.org/ Cheers On Sun, Nov 25, 2012 at 3:19 AM, Chanh Le wrote: > In the settings.py > import mongoengine >

Re: django 1.6.0: admin pages not using unicode methods declared in my model

2012-11-26 Thread ajendrex
That doesn't solve the problem I stated. I still will be seeing a bounch of "Company Object" for every company that I register on the database. I the image https://docs.djangoproject.com/en/dev/_images/admin04t.png from the tutorial, part 2, we can see how the poll objects are listed by using

Re: how to auto-populate(auto-update) model's field(s) via custom button or on Save

2012-11-26 Thread Sergiy Khohlov
>>> import httplib >>> myhost = httplib.HTTPConnection('www.google.com') >>> myhost.request("GET") >>> googleanswer = myhost.getresponse() >>> print googleanswer.read() 302 Moved 302 Moved The document has moved http://www.google.com.ua/;>here. >>> Need more ? 2012/11/25 Andriyko

Django 1.5 custom User model error. "Manager isn't available; User has been swapped"

2012-11-26 Thread Benoit Petit
Hi, I extend the django user model as described in the dev doc. I wan't to keep most of the original User model features so I extend the AbstractUser class. I've defined in settings.py: AUTH_USER_MODEL = 'myapp.CustomUser' My user class: class CustomUser(AbstractUser):

Re: many "Broken INTERNAL link" with end string "/undefined/"

2012-11-26 Thread ferran
Hello, For the url pattern www.example.com/xxx/cache/[hex] it's a bug in chrome extension extension ID bodddioamolcibagionmmobehnbhiakf http://code.google.com/p/chromium/issues/detail?id=132059 El jueves, 19 de julio de 2012 09:21:20 UTC+2, Thomas Orozco escribió: > > Did you visit the page

Vim Django template syntax checker

2012-11-26 Thread Some Developer
I've been using Syntastic along with Vim for Django development for sometime but I'd like to see if I could improve my Vim configuration. The problem with Syntastic is that it does not work too well when checking partial HTML documents (which is often the case with Django because of template

thumbnail image from original on the fly without using a model field?

2012-11-26 Thread MikeKJ
Trying to port up from *old* django this class/function and having a bit of trouble with the im.save which returns Exception Type: IOError Exception Value: [Errno 2] No such file or directory where the no file or directroy string is a correct path from MEDIA ROOT concatenated with

Re: row = cursor.fetchone() / row = cursor.fetchall()

2012-11-26 Thread Nebros
I found the answer by myself... it was just to add this: ret = request.POST form = ret['kunde'] and use this "form" as a variable... "%s" %form Am Freitag, 23. November 2012 08:31:30 UTC+1 schrieb Nebros: > I saw your answer and it was long and with a lot of time, i thanks for >

Re: Django MongoDB

2012-11-26 Thread Victor Manuel Quiñones Victor
Hi guys thank you Yati, this really help me. Will check right away. Cheers On Mon, Nov 26, 2012 at 2:32 AM, yati sagade wrote: > Hi. I've used django-nonrel for interfacing with the Google datastore on > appengine and I use mongoengine for the rest. I guess mongoengine

Re: count resulting rows in sliced valuesqueryset

2012-11-26 Thread Peter of the Norse
I did some research on windowing functions since your post. They tend to be slower since they ignore optimizations. For example, when using count(*), indexes are used whenever possible to avoid hitting the table data and outer joins are ignored altogether. And limited searches quit as soon as

Speeding up test database creation

2012-11-26 Thread Andres Reyes Monge
The tutorial uses a sqlite file database not a in memory database, try omitting the name parameter and it should speed things up -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit

Re: I install v1.5 Django, and run a my first site, then have an error: 'utf-8' codec can't decode byte 0xbc in position 0: invalid start byte. I use Sublime editor.

2012-11-26 Thread Duda Nogueira
If you use different characters on your code (comments, strings, etc), such as é, í, ç or, on your case, you sign the code with your name, 名宏贾, you need to add: # -*- coding: utf-8 -*- on the beginning of the file. This is a guess about what is happening with your code. Pasting the entire

ForeignKey in forms: select existing or create new with embedded form

2012-11-26 Thread mikegolf
Hi, is there any ready to use django package / code snippet for creating a complex forms for a data which is distributed along many tables? I have quite complex data structure, in many cases when creating new record (for example "Book") one needs to create new "Author", and "Agreement" (related to

Re: how should I get the request object?

2012-11-26 Thread Daniel Roseman
On Monday, 26 November 2012 10:16:01 UTC, Miaobing Jiang wrote: > how should I get the request object when I need that object in some places > rather than in the view for each view has request as its first parameter? > Pass it from the view into whatever functions need it. -- DR. -- You

Speeding up test database creation

2012-11-26 Thread John Maxwell
Hi all, I've been doing the test-driven Django tutorial at http://www.tdd-django-tutorial.com/ I'm partway through the tutorial, and when I run the command "python manage.py test fts", the message "Creating test database for alias 'default'..." gets shown for 4-5 seconds before anything else

how should I get the request object?

2012-11-26 Thread Miaobing Jiang
how should I get the request object when I need that object in some places rather than in the view for each view has request as its first parameter? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit

Re: Django-Classifieds image upload issue

2012-11-26 Thread Swaroop Shankar V
Any help please..thanks On Nov 25, 2012 3:34 PM, "Swaroop Shankar V" wrote: > > Hello All, > I am trying to create a classifieds for my sites using django calssifieds. When ever I try to upload files from the user side, am getting the error > > OSError at

Re: overwrite field value in subclasses

2012-11-26 Thread Emmanuel Jannetti
Hi, checking on my side. All this works as soon as upper class are not abstract. regards manu On Monday, November 26, 2012 10:19:18 AM UTC+1, Emmanuel Jannetti wrote: > > Hi, > > Thank for the reply. > > Digging into _meta.fields of a created instance I see, as you said that * > myfield* is

Re: overwrite field value in subclasses

2012-11-26 Thread Emmanuel Jannetti
Hi, Thank for the reply. Digging into _meta.fields of a created instance I see, as you said that * myfield* is still defined as in the upper class. If I understood correctly your answer sub-class should have the field "redefine" instead of assigned . something like *myfield =

Re: Seeding Foreign Key with known object with Class Based Views

2012-11-26 Thread Sergiy Khohlov
I'm proposing to add form_valid function and make next trick def form_valid(self, form) # avoid to early savind od the new address newaddress = form.save(commit=False) # you need to update object by correct client id value. Keep in mind that I'm writing without django from