TabularInlineAdmin queries waaaaaayyyyyy too much.

2023-02-02 Thread Mark Jones
I have an admin with 1 row in the tabular inline. I have a custom queryset in class ExtensionTabularInlineFormSet(BaseInlineFormSet): def get_queryset(self) -> QuerySet[Extension]: qs = super().get_queryset() This gets called 20 times to display that one row. When you have more

Re: Django tests appear to be getting substantially slower

2019-06-15 Thread Mark Jones
lib On Sat, Jun 15, 2019 at 8:16 AM Simon Charette wrote: > I meant Django 2.0 -> 2.1. As long as you are using Django 2.2 with SQLite > 3.20+ > the slowdown I mentioned should be effective. > > Simon > > Le samedi 15 juin 2019 08:32:56 UTC-4, Mark Jones a écrit : >> &

Re: Django tests appear to be getting substantially slower

2019-06-15 Thread Mark Jones
tests > against SQLite the 2.1 to 2.2 slowdown is likely caused by the fact > database constraints are > now checked of each TestCase[0]. > > Cheers, > Simon > > [0] https://docs.djangoproject.com/en/2.2/releases/2.2/#tests > > > Le samedi 15 juin 2019 07:26:35 UTC-4, Mar

Django tests appear to be getting substantially slower

2019-06-15 Thread Mark Jones
I was fixing up a Django app https://github.com/mark0978/django-softdelete and setting up tox to make sure it worked with all the listed versions because of issues opened on the original repo. While I was running tox locally I noticed that with every version of Django, the tests ran slower,

Re: Accessing Django project models from CGI

2013-04-10 Thread Mark Jones
Can't imagine why you would want to do this via CGI, it can't perform very well. There is a TON of stuff that gets setup during initialization for wsgi/runserver, etc.. Syntax wise your import is way off since your models do not live in the Django folder, you can't import them like this.

Re: Problems creating django project in Windows 7

2012-03-08 Thread Mark Jones
I use WingIDE and one license covers all 3 platforms for a developer. And the guys that make it are incredibly nice and helpful with features and how to use. I Highly recommend it. (30 day free trial too) -- You received this message because you are subscribed to the Google Groups "Django

Re: Problems creating django project in Windows 7

2012-03-08 Thread Mark Jones
I've created a manage.cmd and put it on my path so I can type less while on windows the command is just @echo off python manage.py %* this makes it more like linux The "@echo off" part is important because mange dumpdata >filename doesn't want to see the command line echoed into the json file.

Re: Saving the query object for later

2010-04-28 Thread Mark Jones
I was thinking I could pickle/unpickle the request then run it thru with an extra flag of (send email) thru the same code that wsgi uses. If I jsonify the data, how would I get that back into a python object? Is it really as simple as str=json.dumps(request) and request = json.loads(str) I don't

Saving the query object for later

2010-04-28 Thread Mark Jones
When someone searches for something on the site and finds nothing, I want to save that query for later reuse (so I can run it each night to see if anything new matches their request, and email what is found to the user). What is the best way to go about this? 1. Save the SQL that is generated

Django Filter parser slightly less than intuitive

2009-08-12 Thread Mark Jones
{{ datevar|date: dateformat}} won't parse. You get the error: Could not parse the remainder: ': dateformat' from 'datevar|date: dateformat' Turns out that unlike most other places, spaces ARE significant here. It could be fixed by changing the filter_raw_string on line 448 of

Re: Trying to understand Django and Python from a C++ perspective

2009-06-29 Thread Mark Jones
Yea, I'm not wanting to use stuff.objects, but I'm wanting to pull some of the same voodoo, probably not safe for a python novice like myself :-) On Jun 29, 5:24 pm, Alex Gaynor <alex.gay...@gmail.com> wrote: > On Mon, Jun 29, 2009 at 5:19 PM, Mark Jones <mark0...@gmail.com> wrote

Trying to understand Django and Python from a C++ perspective

2009-06-29 Thread Mark Jones
I can't seem to reason out why/how this works. I have a class Named Stuff I can say Stuff.objects.filter(.) and that will return valid set of data. What I can't understand is what exactly is objects, and why is it I can call it with Stuff.objects, but I can't call it with stuff.objects (an

Re: How can one template extend multiple templates?

2009-02-24 Thread Mark Jones
It seems like maybe I don't understand the question but it will extend an infinite number of templates Just add {% extends "base.html" %} into every template you want to extend. You can even do {% extends "derived.html" %} which extends base.html On Feb 24, 8:41 am, lzhshen

Re: Securely storing passwords

2009-02-24 Thread Mark Jones
How about integrating with something like OpenID? Not sure if it would do the trick, but it might be a step in the right direction, assuming the sites you are interoperating with are 'friendly' On Feb 24, 5:49 am, LaundroMat wrote: > Hi - > > I'm working on a small django

Re: Django App build - the right process?

2009-02-24 Thread Mark Jones
The first 2 saves are overly complex: def save(self): if self.unit_price and not self.price_discount == '0': adjust = float(self.price_discount / 100.0) val_result = str(adjust) discount = Decimal(self.unit_price - (Decimal(val_result) * self.unit_price))

Re: Not understand help_text

2009-02-24 Thread Mark Jones
I occurred to me last night right before sleep that I can patch this in my code by deriving all my forms from my MyForm, fixing it in one place and remaining DRY. Nice to see I'm not the only one that found this to be a bit strange. --~--~-~--~~~---~--~~ You

Re: Not understand help_text

2009-02-23 Thread Mark Jones
That is exactly the kind of WET I was talking about. as_p() with appropriate CSS styling will render really nice forms as is, with the exception of the help_text. I even think that could be fixed without any major rework, just a change in the as_p() string from def as_p(self):

Not understand help_text

2009-02-23 Thread Mark Jones
When a model field has help_text, that text will be show in the form. I'm a little bothered by this because effectively the model is doing something that really belongs in the view, but I understand the point is to make it easy to create forms based on a model and I can just live with it. What

Re: Is safe unsafe?

2009-02-23 Thread Mark Jones
Kind of sucks that you are worried about your server, but not worried about the people that might use your site. I'd answer your question regarding JS except for the fact I think the server and the clients should be safe for the general public, and I don't want to make it that easy on you.

Re: CheckboxInput widget has a flaw when used with an IntegerField

2009-02-19 Thread Mark Jones
t; On Thu, Feb 19, 2009 at 11:56 AM, Mark Jones <mark0...@gmail.com> wrote: > > > forms.IntegerField(widget=forms.CheckboxInput(attrs={'value':1}), > > required=False) > > > won't work because > > >    def value_from_datadict(self, data, files, name): > >

CheckboxInput widget has a flaw when used with an IntegerField

2009-02-19 Thread Mark Jones
forms.IntegerField(widget=forms.CheckboxInput(attrs={'value':1}), required=False) won't work because def value_from_datadict(self, data, files, name): if name not in data: # A missing value means False because HTML form submission does not # send results for

Re: checkboxInput values

2009-02-18 Thread Mark Jones
and you do that like so: answer0 = forms.IntegerField(label='', widget=forms.CheckboxInput (attrs={'value':0})) for the next bloke that doesn't want to have to figure it out. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: can't clear form data in runserver (works in shell)

2009-02-03 Thread Mark Jones
to clearsent: self.data._mutable=True # this doesn't seem right, but what the heck its 1am On Feb 3, 1:21 am, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > On Mon, 2009-02-02 at 23:05 -0800, Mark Jones wrote: > > I have a form that is working well.  However I wan

can't clear form data in runserver (works in shell)

2009-02-02 Thread Mark Jones
I have a form that is working well. However I want to allow them to reuse the form multiple times. Each time they submit the form, I will send up to 6 emails. Then, if an email is sent successfully, I want to remove that email address from the form that I present to them. If the email isn't

Re: Changing database fields

2009-01-28 Thread Mark Jones
This is where Rails rocks and DJango doesn't. I haven't been able to find any kind of DB Migrations in Django like those in Rails. Sad too, because other than that, Python is a lot nicer than Ruby (Syntax wise for an old C++ programmer) On Jan 28, 3:29 pm, Oleg Oltar

Re: changing form field rendering dependent on field type

2009-01-26 Thread Mark Jones
That almost sounds like you will have to write the renderer for that class. I don't think this will be easy to do in the template, but if you override django.forms.widgets.Select.render. you can probably make it work. On Jan 26, 11:51 am, mattsouth wrote: > I wish to

Re: Strange Model behavior

2009-01-26 Thread Mark Jones
I guess I was just too tired when I wrote it, I just forgot the * and ** on the 2 arguments. I have some initialization that I'm doing in __init__ but had removed that to make the example shorter and was still seeing the problem. Thanks for the help, those 3 *'s fixed the whole problem On Jan

Strange Model behavior

2009-01-25 Thread Mark Jones
Sample.py includes the following: == from django.db import models class Good(models.Model): code = models.CharField(max_length=64) quizid = models.IntegerField(null=False, blank=False) published_on = models.DateTimeField(auto_now_add=True) class

Re: Putting pieces back together again

2009-01-13 Thread Mark Jones
ssentially go away. > > http://docs.djangoproject.com/en/dev/topics/forms/#topics-forms-indexhttp://docs.djangoproject.com/en/dev/topics/forms/formsets/ > > -Jeff > > On Jan 12, 12:46 am, Mark Jones <mark0...@gmail.com> wrote: > > > I have some fields on my page that

Putting pieces back together again

2009-01-11 Thread Mark Jones
I have some fields on my page that have more than one attribute for simplification, lets say two attributes answer = {'txt':'something', 'allowblank':0} laid out on the page as: {% for answer in quiz_question.answers %} {% endfor %} the first is pulled from an input field, and if

Re: NewBie Question about ForeignKey relationships

2009-01-07 Thread Mark Jones
Thanks for the pointer, I had read all around that. The short version is: maker.auto_set.all() There was was Dry(er) more elegant method to be found. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

NewBie Question about ForeignKey relationships

2009-01-07 Thread Mark Jones
Ok, here is some simple code: class Maker(models.Model): name = CharField(max_length=20) class Auto(models.Model): name = CharField(max_length) maker = ForeignKey(Maker) maker = Maker.objects.get(pk=1) How do I get all the Autos made by this maker I don't see a maker.autos

Re: to understand MEDIA_URL

2009-01-05 Thread Mark Jones
Are you closing the file after you write to it and before you try to send it? Why do you have to write it to a file to deliver it as a static file, why not just render it to a response directly? On Jan 5, 4:13 am, Alan wrote: > Hi List, > Because I couldn't find any idea

Re: I would like to report a bug but I can't log in

2009-01-04 Thread Mark Jones
Well, I think we can all see where you get your nickname. On Jan 4, 12:03 am, Friendless wrote: > On Jan 4, 2:42 pm, "Karen Tracey" wrote: > > > I'll admit your tone here is starting to make me lose interest in your > > problem report. > >

Re: File Download

2009-01-04 Thread Mark Jones
Are you trying to get your source code off a server, and instead find it being executed by the webserver? If you have shell access, tar the files up and download that, create a folder where the files aren't executable and download them that way. If it is your source, I would assume you have

Re: Do sth on time ?

2009-01-04 Thread Mark Jones
You need a process running outside the bounds of the webserver that reads the database every so often, and then sleeps with a wakeup every so often, and a list of when things "expire". It updates the database, the webpage reflects the update. You could of course do this via a wget driven by

Re: Redirect parent from within iframe without losing session

2009-01-04 Thread Mark Jones
are you redirecting to the same port? I think redirection to a different domain OR port would keep the cookie from getting back to the server, thus killing your session. On Jan 3, 10:33 am, Berco Beute wrote: > My page shows a (logged in) user an iFrame but when the iframe >

Could someone help me understand the finer points of import

2009-01-04 Thread Mark Jones
For the discussion below, ALL the code is in .../intomec/tenq I wrote some code in tests.py like so: from tenq.models import * self.expectedValue = Answers((1,2,3,4)) within the to_python() method of AnswersField in models.py: def to_python(self, _value): print