Unicode sort order for CharField data in several scripts

2013-08-25 Thread Will Tuladhar-Douglas
Gentlefolk, We have a research database (GeoDjango 1.5.1 on Postgres 9.2/PostGIS 2.0) including one model for words in any human language, where these words are entered in locally legible scripts (thus Sanskrit or Newari terms are in Devanagari, Persian in Perso-Arabic, Mandarin in Traditional

Re: Single form displayed multiple times on one page with different values.

2013-08-25 Thread Lachlan Musicman
I think I solved a similar problem with Formsets and Model Formsets? cheers L. On 26 August 2013 10:48, Brian Millham wrote: > I have the this simple form: > > class MistagForm(forms.Form): > artist = forms.CharField() > > And I want to display it on a page more than

Re: pycharm constant error

2013-08-25 Thread Ezequiel Bertti
isn't a pycharm error, is your's. Your *args must to be on end of method definition, before of **kwargs On Sun, Aug 25, 2013 at 12:41 PM, Patrick Larmann < rails4product...@gmail.com> wrote: > Hello, > Thx Mike for the advice. Will do! > > > On Sunday, August 25, 2013 12:09:13 AM UTC-4,

Re: Model QuerySet used in base.html template

2013-08-25 Thread Radomir Wojcik
I have to run some benchmarks and see. I am using SQLite and I have heard some people say that it cannot handle concurrent transactions. From what I read it can handle some 50,000 transactions/ sec depending on your disk IO. For a small deli website I take it should be fine, even if the user

Re: Passing variables to css file in django

2013-08-25 Thread Robin Lery
Oh! I am sorry. What I meant was, how do I let users customize their page if they wanted to? I suppose I could have done this without using external stylesheet, but yes, CSS is served fastest if it's static. I hope, I made myself clear. Please guide me if there's a way to achive this On Mon, Aug

Single form displayed multiple times on one page with different values.

2013-08-25 Thread Brian Millham
I have the this simple form: class MistagForm(forms.Form): artist = forms.CharField() And I want to display it on a page more than once. The page is a list of artists, and each artist has a link to the above form that will be a popup form. I want the default value of artist in the form to

Re: Passing variables to css file in django

2013-08-25 Thread Andy McKay
Any string can be rendered as a template. This is covered pretty well in the docs: https://docs.djangoproject.com/en/dev/ref/templates/api/ For example: >>> from django.template import Context, Template >>> t = Template("body { background-color: {{ bgcolor }} }") >>> c = Context({'bgcolor':

Research study: Structuring software documentation around tasks and concepts

2013-08-25 Thread Christoph Treude
Hi, We are a group of researchers in the School of Computer Science at McGill University working on a tool to extract meaningful tasks and concepts from the documentation available on https://docs.djangoproject.com/en/dev/. To evaluate whether our extraction was successful, we are looking for

Passing variables to css file in django

2013-08-25 Thread Robin Lery
Is it possible to pass variables in css files, like in html file. Example: In views.py: def home(request): bgcolor = "#999" ... ... In the css file: body { background-color : {{bgcolor}}; } If yes, can you please guide me how to achieve this? I

Re: pycharm constant error

2013-08-25 Thread Patrick Larmann
Hello, Thx Mike for the advice. Will do! On Sunday, August 25, 2013 12:09:13 AM UTC-4, Mike Dewhirst wrote: > > On 25/08/2013 1:21pm, Patrick Larmann wrote: > > Hello, > > Thanks for your response. I reinstalled it but am still getting the > > error. How would I do a full revert? > > $ pip

Re: Model QuerySet used in base.html template

2013-08-25 Thread Kamil Gałuszka
I'm just preferring if something have to be done before template rendering and store that in context variable. Difference to your solution is that variables are just only created before starting template rendering. In your solution you evaluate QuerySet in template rendering time. Sometimes

Re: Model QuerySet used in base.html template

2013-08-25 Thread Radomir Wojcik
Hey Kamil, Isn't that overkill though? templatetag was an easy solution but you still do a query on the locations model on each page load. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Re: Model QuerySet used in base.html template

2013-08-25 Thread Radomir Wojcik
I simply added an assignment tag instead as follows: @register.assignment_tag def get_locations(): from store.models import Location locations = list(Location.objects.all()) return locations And use it like so in template {% get_locations as all_locations %} then

Re: Model QuerySet used in base.html template

2013-08-25 Thread Kamil Gałuszka
Hi Radomir, If you have something like that you should use in my opinion template context processor. It's very easy to write one, because it's simple python function. Here you have some context_processor from django core:

Re: Model QuerySet used in base.html template

2013-08-25 Thread Radomir Wojcik
I am actually thinking using some sort of templatetag now instead of passing the query each time since its used in base.html. It can return the exact html string that can be displayed in base.html. Right now I have the " locations = Location.objects.all() " passed to the template in every

Model QuerySet used in base.html template

2013-08-25 Thread Radomir Wojcik
I wanted to add location address in the menu. I have a model called locations so this is easy enough to do. But now I have to add the queryset to every view, because every view has a template that extends base.html. So do I have to add this queryset as such to every view now? locations =

Re: DecimalField

2013-08-25 Thread Thomas Scrace
You're creating an entirely new DecimalField, rather than altering the error messages of your existing field. I think what you want is: class YourForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(YourForm, self).__init__(*args, **kwargs)

DecimalField

2013-08-25 Thread Derrick Jackson
Hi All, My Model has a DecimalField: amount = models.DecimalField(max_digits=19, decimal_places=2, verbose_name='Amount') My ModelForm has the following: self.fields['amount'] = forms.DecimalField(error_messages={ 'required': 'Amount is required.', 'invalid': 'Numbers

Re: Import Error: cannot import name timezone

2013-08-25 Thread Robin Lery
Good to hear that! On Sun, Aug 25, 2013 at 7:19 AM, Patrick Larmann wrote: > Thanks fixed it? > > > On Saturday, August 24, 2013 5:45:47 PM UTC-4, Robin Lery wrote: > >> It should be >> 'from django.utils import timezone' >> and not >> 'from django.db.utils import