bruar 2019 kl. 15.47.10 UTC+1 skrev Mikkel Kromann:
>
> Hi.
>
> I have a collection of apps where I find repeating myself when rendering
> tables in the templates.
> In the stylised example below I have three types of tables, foo, bar and
> baz.
> Each app is supposed to ren
Hi.
I have a collection of apps where I find repeating myself when rendering
tables in the templates.
In the stylised example below I have three types of tables, foo, bar and
baz.
Each app is supposed to render various combinations of tables from its own
models, but also from other models' tabl
class, but not from the parent class.
Mikkel
torsdag den 27. december 2018 kl. 20.59.43 UTC+1 skrev Mikkel Kromann:
>
>
> Hello.
>
> I have a parent Meta class and some child classes.
> I would like to read the decimal_places attribute from DecimalField of my
> child ins
Hello.
I have a parent Meta class and some child classes.
I would like to read the decimal_places attribute from DecimalField of my
child instances using a function in my parent class.
I am able to read the attribute from inside my child classes, but I cant
crack how to read from a function in
Dear Django users.
I am looking into the so-called Point-In-Time architecture for databases
with version history. See e.g.
https://www.red-gate.com/simple-talk/sql/database-administration/database-design-a-point-in-time-architecture/
One reason I like PTA is that a version history for my projec
values function. Values limits the result set
> to the columns you specify.
>
>
>
> I suggest reviewing the annotation and values docs here:
>
>
> https://docs.djangoproject.com/en/2.1/topics/db/aggregation/#order-of-annotate-and-values-clauses
>
>
>
>
&g
irsdag den 14. august 2018 kl. 15.28.01 UTC+2 skrev Matthew Pava:
>
> Ah, the error has the answer. contract_row is a dictionary, so you need
> to access it as if it were a dictionary.
>
> contract_sum = contract_row['contracted']
>
>
>
> *From:* django...@googlegroups
ct_row['contracted']
>
>
>
> *From:* django...@googlegroups.com [mailto:
> django...@googlegroups.com ] *On Behalf Of *Mikkel Kromann
> *Sent:* Monday, August 13, 2018 11:51 PM
> *To:* Django users
> *Subject:* Re: GROUP BY
>
>
>
>
>
> Th
“ownProduction” in your values list prior to the
> annotation.
>
>
>
>
>
> *From:* django...@googlegroups.com [mailto:
> django...@googlegroups.com ] *On Behalf Of *Mikkel Kromann
> *Sent:* Monday, August 13, 2018 3:22 PM
> *To:* Django users
> *Subject:
I'm trying to sum the field "ownProduction", grouping it by the foreign key
"market" (using the market's human readable name, __name from the Market
table) and the week number (which is built-in function __year of the date
field "dateContract").
However, when I try to read the results of the que
stage')
.annotate(contract_sum=Sum('contractSum'))
.annotate(expected_own_production_sum=Sum(
'id', field='contractSum * probability'))
)
cheers, Mikkel
lørdag den 4. august 2018 kl. 14.11.27 UTC
Dear Django users.
I'm trying to do the sums of the product of two columns ('contract_sum' and
'probability', decimal fields), grouping by a third column, 'stage' (a
choice variable).
I'm also reporting the grouped sums of one of the single columns
('contract_sum')
The single column works just
=i+'_update' ) )
paths.append(path( 'delete/'+i+'//', ItemDeleteView.as_view(
model=m),name=i+'_delete' ) )
return paths
>From urls.py:
from . models import GetItemPaths
urlpatterns = GetItemPaths() + [
path('/to/some/other/views
del1 I get the following
error:
'str' object has no attribute '_default_manager'
So it certainly seems that using model=i will not pass the model name.
Is this because the argument for model= expects not a string but an object?
thanks, Mikkel
torsdag den 21. juni 2018 kl
I have a lot of models (say 30 or 40) which are so similar, that I have
handled them using slightly modified class based views.
In urls.py:
urlpatterns = [
path('list//',ItemListView.as_view()),
path('create//', ItemCreateView.as_view()),
path('update//', Ite
nt to loop over something use a
>> list. Like this:
>>
>>
>>
>> return {
>>
>> 'items': [
>>
>>{'name': 'year', 'readable': 'Year', 'urlname': 'year_list' },
>>
&g
> {% block sidebar %}
>
> {{year.readable}}
> {{region.readable}}
> {{location.readable}}
>
> {% endblock %}
>
> The reason for needing to add year, region and location, is because that
> is the way you are creating the dictionary in your context processor.
&g
Hi.
Once again thanks for all your invaluable advice to me so far. Now, I'm
battling context_processors.
I really struggle to find a good example that can help me understand how to
use them.
They seem quite helpful to a lot of stuff I plan to do.
I think I got the configuration in settings.py a
n-a-django-template?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
>
>
>
>
>
> *From:* django...@googlegroups.com [mailto:
> django...@googlegroups.com ] *On Behalf Of *Mikkel Kromann
> *Sent:* Wednesday, June 13, 2018 3:54 PM
> *To:* Django u
ple each row as a list of the
> values in the order that they should appear
>
> On Wed, Jun 13, 2018 at 4:54 PM Mikkel Kromann > wrote:
>
>> Dear Django users.
>>
>> Thanks to the good advice of many people on this list, I've managed to
>> create some
Dear Django users.
Thanks to the good advice of many people on this list, I've managed to
create some nice generic class based views that work simultaneously with
many models.
The models may differ from each other with regards to the number of columns
in their data tables as well as the naming
t is invalid, making your code try to do something weird.
>
> Anyway, good luck on your project!
>
> On Wed, Jun 6, 2018, 14:51 Mikkel Kromann > wrote:
>
>> Thanks Daniel.
>>
>> Both your proposed solutions worked very well.
>> For now, I don't ha
e which form fields to display to the user based on which model the
> user is updating, so you could just specify the form_class attribute on the
> path (just as you did with the model).
>
> Hope it helps!
>
>
> On Wed, Jun 6, 2018, 10:36 Mikkel Kromann > wrote:
>
>>
he Model, you used to be able to call a
> .get_field_names() or something like that but that is depreciated since
> 1.10. Now to do that you should use the Model._meta to get_fields(). Check
> the documentation for the Model._meta to check its full potential.
>
> Hope it helps!
>
in the
> class?
>
> Regards,
>
> Andréas
>
> 2018-06-05 21:56 GMT+02:00 Mikkel Kromann >:
>
>> Dear Django-users.
>>
>> I'm slowly working towards a Django "data-warehouse" framework, where I
>> can easily add a lot of models (ea
Dear Django-users.
I'm slowly working towards a Django "data-warehouse" framework, where I can
easily add a lot of models (each containing a table with data), while
sticking to only few reusable views.
I've realised that in urls.py, it is possible to specify the model on which
the UpdateView i
6.01 UTC+2 skrev Mikkel Kromann:
>
> Dear Django users.
>
> I'm testing whether Django is a good choice for a web based application
> that I need to handle (create, read, update, delete) a lot of data tables.
> I've discovered the built-in Class Based View, which are going
Dear Django users.
I'm testing whether Django is a good choice for a web based application
that I need to handle (create, read, update, delete) a lot of data tables.
I've discovered the built-in Class Based View, which are going to save me
from a lot of repetitive code lines - yay!
Now, I've g
eeded.
cheers, Mikkel
lørdag den 14. april 2018 kl. 16.10.27 UTC+2 skrev Mikkel Kromann:
>
> Hi.
>
> I'm new to Django, and I'm working my way into Django by going through the
> nice Djangoproject.com turorial.
> I'm trying to find out whether Django is the right
Hi.
I'm new to Django, and I'm working my way into Django by going through the
nice Djangoproject.com turorial.
I'm trying to find out whether Django is the right tool for my task, which
is maybe a bit unusual for Django.
My task is to build a web interface to a database for an calculation too
30 matches
Mail list logo