Thanks Tom for replying!
The code used to create the dict is:
my_dict = collections.defaultdict(lambda: collections.defaultdict(list))
for obj in queryset:
my_dict[int(obj.position.split('-')[0])][int(obj.position.split('-')[2])].append(obj)
Basically I have one field in the queryset calle
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
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 once. The page is a list
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, Mik
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 pl
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
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
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': '#99
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
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 wou
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 uni
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 is
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 emails
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 can
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:
https://github.com/django/django/blob/master/django/core/context_proces
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
sing
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 = Locat
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)
self.fields["amount"
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 on
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 timezone'
>>
>>
>> On Sun, Aug
20 matches
Mail list logo