Re: passing data to template

2017-06-13 Thread Simon McConnell
{{a.nat_balance}} sure it shouldn't be spelt {{a.net_balance}} ? On Wednesday, 14 June 2017 06:57:30 UTC+10, suabiut wrote: > > Hi ludovic, > Thanks for your response. > when i did what you say it print out the date and sum in an array. Date > still in Julian date but i don't worry about the d

Re: Why does combining multiple annotations work in my case?

2017-08-13 Thread Simon Charette
documentation examples spans results over two different multi-valued relationships (authors and store). Hope that makes things a bit clearer to you, Best, Simon Le vendredi 11 août 2017 16:32:42 UTC-4, gaazkamm a écrit : > > > The documentation advises against combining multiple annotatio

Re: regarding virtualenv and python version 3.5 or 3.4 or other versions

2017-08-14 Thread Simon Charette
stall python3.5. Best, Simon [0] https://launchpad.net/~fkrull/+archive/ubuntu/deadsnakes Le dimanche 13 août 2017 08:51:17 UTC-4, Seo Brain a écrit : > > Hi, the question is about which python version suppose to use. On web > server is ubuntu 14.4 - python v3.4 (i assume) with virtualen

Re: Mixing Q objects and lookups with When conditionals

2017-09-21 Thread Simon Charette
or trial and error? Best, Simon Le jeudi 21 septembre 2017 10:13:11 UTC-4, Jason a écrit : > > I have a model in which I was trying to get a count for records that > matched three variable values and found an interesting edge case not in the > documents > for condi

Re: Get last instance object per each month and sum per month in Django

2020-02-25 Thread Simon Charette
27;status_month', ).annotate( progress_sum=Sum(actual_progress) ) That will return an iterable of lists of the form [activity_id, status_month, progress_sum] If you want to annotate your Activity instances you'll need to use window functions[0]. Simon [0] https://docs.djangoproject.c

Re: is there any way to django3.0 & oracle 11g together?

2020-03-21 Thread Simon Charette
like Oracle 11g has not been supported since August 2013 [3] If you can't upgrade your Oracle setup I suggest you consider moving to a different database such as PostgreSQL. Simon [0] https://docs.djangoproject.com/en/3.0/releases/3.0/#dropped-support-for-oracle-12-1

Re: Impossible d'utiliser language_code 'fr-fr' avec django 3.0.4

2020-03-26 Thread Simon Charette
E_CODE = 'fr' plutôt que 'fr-fr' Simon Le jeudi 26 mars 2020 21:47:11 UTC-4, Anselme SERI a écrit : > > Je suis un nouveau dans le développement python et je teste actuellement > Django. > Il m'est impossible d'utiliser le language_code 'fr-fr'

Re: ValueError: The database backend does not accept 0 as a value for AutoField.

2020-04-06 Thread Simon Charette
| | 2 | ++ This ORM level check is to prevent you from shooting yourself in the foot by expecting that providing a zero will assign this value. Cheers, Simon Le lundi 6 avril 2020 09:35:22 UTC-4, Hamza Mirchi a écrit : > > Hi Everyone, > > I'm Saving My Mail Model but

Re: ValueError: The database backend does not accept 0 as a value for AutoField.

2020-04-06 Thread Simon Charette
Something in your code is assigning a id=0 to Mail before calling .save() on it. If you identify its origin then removing it should address your problem. Simon Le lundi 6 avril 2020 11:51:46 UTC-4, Hamza Mirchi a écrit : > > How Can I Fix That Via Django? > > On Mon, Apr 6, 2020

Bootstrap drop down menu not clickable.

2020-05-16 Thread Simon A
Try to include the dependencies inside the block content. Here is what I did {% block content %} {% load bootstrap3 %} {% bootstrap_css %} {% bootstrap_javascript %} -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this g

Re: Bootstrap drop down menu not clickable.

2020-05-16 Thread Simon A
Is it in you installed apps? On Sat, May 16, 2020, 22:04 sunday honesty wrote: > I did that and got a TemplateSyntaxError stating that bootstrap4 is not a > registered tag library > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django users" group

Re: Bootstrap drop down menu not clickable.

2020-05-16 Thread Simon A
Try to run the pip install command if you havent already. Check the correct command to install bootstrap3 or 4 if forgot the complete package name. On Sat, May 16, 2020, 22:45 sunday honesty wrote: > I included it to installed app and got an error message on the console. > "Module not found, no

Re: Bootstrap drop down menu not clickable.

2020-05-16 Thread Simon A
did > other bootstrap features worked well except for the dropdown? > > On Sat, May 16, 2020, 3:51 PM sunday honesty > wrote: > >> All right >> >> On Sat, May 16, 2020, 3:49 PM Simon A wrote: >> >>> Try to run the pip install command if you haven

Re: Django SECRET_KEY : Copying hashed passwords into different Django project

2015-08-05 Thread Simon Charette
Hi Angit, It shouldn't be an issue since Django's default password hashers are not relying on settings.SECRET_KEY. Simon Le mercredi 5 août 2015 05:12:47 UTC-4, Ankit Agrawal a écrit : > > > > Hi everyone, > > > I have a Django powered site(Pro

Re: 1.7 to 1.8 upgrade: test suite failing

2015-08-25 Thread simon . shillaker
com/en/1.8/topics/testing/tools/ Thanks again, Simon On Monday, July 20, 2015 at 11:03:42 AM UTC+1, simon.s...@eporta.com wrote: > > Hi Tim, > > Thanks again for the responses. Tom is now on holiday for a week but we'll > pick up where he left off and try to replicate

Re: Adding dynamic methods to ModelAdmin fails in 1.8

2015-09-08 Thread Simon Charette
n/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.fields>, just make sure you also override ModelAdmin.get_readonly_fields() <https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_readonly_fields> to return them as well. Cheers, Simon Le mard

Re: Adding dynamic methods to ModelAdmin fails in 1.8

2015-09-09 Thread Simon Charette
a patch/PR if you don't want the ticket to rot in Trac make it to Django 1.9 which should enter feature freeze soon enough. I'd be glad to review your proposed changes if you're interested. Simon Le mercredi 9 septembre 2015 10:31:12 UTC-4, Malcolm Box a écrit : > > Hi Simon, &

Re: Adding dynamic methods to ModelAdmin fails in 1.8

2015-09-10 Thread Simon Charette
going on here but I highly doubt checks are ran against the get_readonly_fields() return value since it's a method bound to a ModelAdmin instance and requires a `request` argument to be called in the first place. Simon Le jeudi 10 septembre 2015 06:27:13 UTC-4, Malcolm Box a écrit :

Re: Adding dynamic methods to ModelAdmin fails in 1.8

2015-09-10 Thread Simon Charette
is only the properties of the instances should be checked and not the return value of methods that could depend on request properties such as the user. Simon Le jeudi 10 septembre 2015 13:32:32 UTC-4, Malcolm Box a écrit : > > Hi Simon, > > On Thursday, 10 September 2015 16:57:51 UTC+1,

Re: Prefetch() with through models

2015-09-16 Thread Simon Charette
ct.lesson_id].append(lesson_subject.subject) Simon Le mercredi 16 septembre 2015 04:54:13 UTC-4, Erik Cederstrand a écrit : > > Hi folks, > > I'm working on a school timetable app. I want to fetch hundreds of > thousands of Lesson instances with prefetched m2m relations

Re: DJango 1.8 test case fails with IntegrityError error

2015-09-21 Thread Simon Charette
Hi Jose, I looks like ibm_db_django doesn't support Django 1.6+ yet <https://pypi.python.org/pypi/ibm_db_django/>. Simon Le lundi 21 septembre 2015 07:14:39 UTC-4, Jose Paul a écrit : > > I am trying to run DJango 1.8 test cases with DB2 > > Several insert statement

Re: Problem with date validator

2015-09-23 Thread Simon Charette
_past_date(value): if value > datetime.date.today(): raise ValidationError('This date can't be in the future') Cheers, Simon Le mercredi 23 septembre 2015 17:06:54 UTC-4, felix a écrit : > > > When today's date is entered in the form it shows a form er

Re: Problem with date validator

2015-09-24 Thread Simon Charette
Hi Felix, >From what I know model and form DateField are completely TIME_ZONE agnostics. This is not the case for DateTimeField however. Is this what you're using? Simon Le jeudi 24 septembre 2015 15:13:01 UTC-4, felix a écrit : > > El 23/09/15 17:12, felix escribió: > >

Re: Converting implicit m2m through table to explicit through model with Django 1.7 migrations

2015-09-28 Thread Simon Charette
m and your approach is safe. Could you add a mention on the ticket tracking this feature addition about the workaround you and your team used to achieve similar results? I think this could be valuable to other users until the ticket is fixed. Cheers, Simon Le lundi 28 septembre 2015 09:56:58

Re: Load a static file with a variable name

2015-10-07 Thread Simon Charette
You'll want to use Because François' suggestion will break if you use a static file storage that doesn't allow missing files reference such as the ManifestStaticFilesStorage <https://docs.djangoproject.com/en/1.8/ref/contrib/staticfiles/#manifeststaticfilesstorage>

Re: Validating data for use directly in a model (not via forms)

2015-10-21 Thread Simon Charette
define Model form for your models and use them to perform conversion and validation of your scrapped data. Simon Le mercredi 21 octobre 2015 13:49:08 UTC-4, Yunti a écrit : > > I have a django project where I want to save web scraped data to the > database via the django ORM- which will be u

Re: Locking / serializing access to one element in database

2015-10-21 Thread Simon Charette
ext even if now rows match the provided id? Simon Le mercredi 21 octobre 2015 18:01:50 UTC-4, Joakim Hove a écrit : > > Hello; > > this arises in the context of a django application - but it might be a > more general Python/Postgres/... problem. > > [ The django application

Re: Reverse query name clashe with a M2M and through

2015-10-23 Thread Simon Charette
Hi Gagaro, Intermediate models are just like other in this regard, they create a related relation hence the reported clash. You should either add related_name='+' on your Wishlist related fields or give them a unique name. Simon Le vendredi 23 octobre 2015 06:01:30 UTC-4, Gaga

Re: Reverse query name clashe with a M2M and through

2015-10-23 Thread Simon Charette
ppens with this implicit query name. Simon Le vendredi 23 octobre 2015 10:27:26 UTC-4, Gagaro a écrit : > > Hi Simon, thanks for the answer, it cleared some things up. > > However, I still have a question. The reverse relation is *wishlist_set* > by default. Why is Django bothe

Re: Missing default callable breaks migration

2015-10-28 Thread Simon Charette
I would add that since migration files are normal Python modules you can simply replace the previously imported callable in the referencing migrations by inlining it. Simon Le mercredi 28 octobre 2015 11:33:28 UTC-4, Tim Graham a écrit : > > Please read > https://docs.djangoproje

Re: Custom QuerySet and __date field lookup

2015-11-05 Thread Simon Charette
today() return self.filter(start__date=today) class Entry(models.Model): start = models.DateTimeField() objects = EntryQuerySet.as_manager() Are you sure you are actually using Django 1.9? Simon Le mercredi 4 novembre 2015 14:45:33 UTC+1, aprzy...@gmail.com a écrit : > > Hello, >

Re: Prefetch object with to_attr set to the same name as the field triggers rows deletions

2015-11-05 Thread Simon Charette
relationship. Thanks, Simon Le jeudi 5 novembre 2015 15:04:31 UTC+1, mccc a écrit : > > I'm using a Prefetch object to follow some GenericRelation, and I was > playing around with the to_attr parameter; > I had the DB debug turned on, as I was checking whether it was making any &g

Re: Prefetch object with to_attr set to the same name as the field triggers rows deletions

2015-11-05 Thread Simon Charette
escriptor for the specified `to_attr` at least until this behavior is deprecated since it looks like a major footgun to me. I guess we should move the discussion to the development mailing list <https://groups.google.com/forum/#!forum/django-developers> to gather feedback. Au plaisir, Simon

Re: Prefetch object with to_attr set to the same name as the field triggers rows deletions

2015-11-07 Thread Simon Charette
Hi Michele, I don't if someone beat you to it but a ticket for this exact issue just surfaced[1]. Please chime in on Trac if you'd like to follow the progress of the resolution. Thanks, Simon [1] https://code.djangoproject.com/ticket/25693 Le vendredi 6 novembre 2015 11:01:35 UTC

Re: How do I add permissions in admin for proxy model?

2015-11-11 Thread Simon Charette
thub.com/django/django/blob/53ccffdb8c8e47a4d4304df453d8c79a9be295ab/django/contrib/auth/apps.py#L14-L17> . Cheers, Simon Le mercredi 11 novembre 2015 11:06:18 UTC-5, frocco a écrit : > > This is still not working. > > > On Tuesday, November 10, 2015 at 11:36:39 AM UTC-5, frocco wro

Re: Usage of select_related() on a OneToOneField with parent_link=True doesn't work

2015-11-14 Thread Simon Charette
JOINed by default (unless values() and friends are involved). Django should warn you about this. Please file a new bug ticket <https://code.djangoproject.com/newticket> so we don't loose track of this issue. Thanks! Simon Le samedi 14 novembre 2015 08:03:56 UTC-5, Gilad a écrit : &

Re: Model Meta option default_related_name not setting related_query_name

2015-11-14 Thread Simon Charette
com/newticket> to track your effort. Simon Le samedi 14 novembre 2015 10:03:57 UTC-5, Tim Graham a écrit : > > I guess it would be backwards incompatible if we changed the behavior now, > wouldn't it? > > On Friday, November 13, 2015 at 1:40:27 PM UTC-5, Alejandro Do Nascime

Re: Fixed column width in admin interface?

2015-11-14 Thread Simon Charette
isplay = ['text_field_ellipsis'] def text_field_ellipsis(self, obj): if len(obj.text_field) > max_length: return "%s..." % obj.text_field[:max_length] return obj.text_field Cheers, Simon Le samedi 14 novembre 2015 10:49:09 UTC-5, Jorge Fernandez-de-Cossio

Re: How can you use the @cache_page decorator with Django class based views?

2015-11-14 Thread Simon Charette
Hi Daniels, There's a tentative API being worked on Github. You might want to have a look at it <https://github.com/django/django/pull/5637>. Simon Le samedi 14 novembre 2015 13:38:18 UTC-5, daniels a écrit : > > The only method that seems to be working is adding the decora

Re: Requesting data from an API and rendering data on website

2015-11-18 Thread Adam Simon
With all respect Jani, I do not think this is the right answer. Django-cms per se does not give top level access to the views, so integrating pure python is not as easy as it sounds. Adam On Wednesday, November 18, 2015 at 3:50:46 AM UTC-8, Jani Tiainen wrote: > > Then I suggest that you do

Re: Unicode in email addresses

2015-12-01 Thread Simon Charette
Hi Zac, There's a ticket <https://code.djangoproject.com/ticket/25452> and a pull request <https://github.com/django/django/pull/5612/files> suggesting to improve the actual email validation based on RFCs. You might want to join the conversation there. Simon Le mardi 1 dé

Re: Migrating from OneToOneField to ForeignKey in Django models

2015-12-03 Thread Simon Charette
Hi Cajetan, You can visit the ticket [1] and have a look and the commit messages. In this case the fix have been backported to 1.7.4[2] and should be part of Django 1.8+. Simon [1] https://code.djangoproject.com/ticket/24163 [2] https://github.com/django/django/commit

Re: Bi-directional ManyToMany with through gets broken when creating test database

2015-12-04 Thread Simon Charette
.Model): all_pizzas = models.ManyToManyField( Pizza, related_name='available_toppings', verbose_name='available pizzas' ) Cheers, Simon [1] https://docs.djangoproject.com/en/1.8/releases/1.8/#model-meta-api [2] https://docs

Re: Nested ArrayField error in 1.9

2015-12-04 Thread Simon Charette
hould have a `model` attribute. Please file a new bug ticket[1] for 1.9. Thanks, Simon [1] https://code.djangoproject.com/newticket Le vendredi 4 décembre 2015 07:16:32 UTC-5, J. Gourds a écrit : > > Nested ArrayField seems to be broken in 1.9, it creates an error when > running the

Re: SubfieldBase deprecation

2015-12-07 Thread Simon Charette
).contribute_to_class(model, name) setattr(model, name, Converter(self)) This is mostly what SubfieldBase use to do. Cheers, Simon Le samedi 5 décembre 2015 12:04:10 UTC-5, matus moravcik a écrit : > > Hi, > > according to the docs, SubfieldBase is going to be removed in 1.10

Re: Model Meta option default_related_name not setting related_query_name

2015-12-09 Thread Simon Charette
Hi Alejandro, Did you get the reply to your previous similar question[1]? Simon [1] https://groups.google.com/d/topic/django-users/OGavpqJrw6g/discussion Le mercredi 9 décembre 2015 03:13:46 UTC-5, Alejandro Do Nascimento a écrit : > > Hello, > > I have a doubt, In a model I'

Re: ajax POST request being sent as GET

2015-12-15 Thread Simon Charette
Hi Larry, It's more of a JavaScript question but my first guess would be you'd need to use the `type` option instead of `method` because you are using an old version of jQuery? Simon Le mardi 15 décembre 2015 17:25:12 UTC-5, larry@gmail.com a écrit : > > I am sending an a

Re: 'CharField' object has no attribute 'model'

2015-12-26 Thread Simon Charette
Hi Billlu, Does one your model use an ArrayField? Le samedi 26 décembre 2015 01:34:02 UTC-5, Billu a écrit : > > I'm trying to make a single choice quiz (i.e. Choose one from 4 options). > I'll populate the quiz (with 30 questions) depending upon what topic the > user chooses. I'm made some mod

Re: Conditional annotation super slow

2016-01-06 Thread Simon Charette
Hi Mark, I suppose you opened #26045 <https://code.djangoproject.com/ticket/26045> about the same issue. Are you using PostgreSQL? If it's the case the issue I suppose the issue is fixed in Django 1.9 <https://github.com/django/django/commit/dc27f3ee0c3eb9bb17d6cb764788eeaf73a3

Re: CachedStaticFilesStorage and collectstatic for the very first time

2016-01-08 Thread Simon Charette
) Restart your server. Simon Le vendredi 8 janvier 2016 09:19:30 UTC-5, Andrzej Mateja a écrit : > > Hi, > > I have a problem with using CachedStaticFilesStorage as a > STATICFILES_STORAGE and with external package containing its own static > files (easy_select2 to be specifi

Re: CachedStaticFilesStorage and collectstatic for the very first time

2016-01-08 Thread Simon Charette
sible share the full traceback of the error raised when `collectstatic --traceback` is run. Simon Le vendredi 8 janvier 2016 15:36:54 UTC-5, Andrzej Mateja a écrit : > > Thank you Simon for sharing your remarks although it is not the case what > you described. I'm talking about de

Re: Django 1.9.1/python3.4 install errors

2016-01-09 Thread Simon Charette
Hi Nicholas, These warnings should be safe to ignore. See 1.9 release notes <https://docs.djangoproject.com/en/1.9/releases/1.9/#syntaxerror-when-installing-django-setuptools-5-5-x> for more details. Simon Le samedi 9 janvier 2016 16:30:14 UTC-5, Nicholas Geovanis a écrit : >

Re: Compilation Error while installing

2016-01-12 Thread Simon Charette
Hi, These warnings are safe to ignore, please see 1.9 release notes for more details <https://docs.djangoproject.com/en/1.9/releases/1.9/#syntaxerror-when-installing-django-setuptools-5-5-x> . Simon Le mardi 12 janvier 2016 12:06:43 UTC-5, Kshitij Saraogi a écrit : > > Hell

Re: How do I add permissions in admin for proxy model?

2016-01-15 Thread Simon Charette
Hi Manimaran, I can't help you much with the details you provided. Could you come with an example project to reproduce your issue? Simon Le vendredi 15 janvier 2016 10:41:03 UTC-5, manim...@ishafoundation.org a écrit : > > Hi Simon, > > I am also facing the issue. the thing

Re: Filter object by calculating duration from start and end time

2016-01-19 Thread Simon Charette
F('end') - F('start'), output_field=DurationField() ) ).filter(duration__gte=timedelta(minutes=time_in_minutes) Cheers, Simon Le mardi 19 janvier 2016 13:01:36 UTC-5, Steven Nash a écrit : > > Hi, > > Given an object such as: > > class Entry(models.Mo

Re: Filter object by calculating duration from start and end time

2016-01-19 Thread Simon Charette
Hi Steve, It looks like it might only work on PostgreSQL unti this bug <https://code.djangoproject.com/ticket/24793> is fixed. Simon Le mardi 19 janvier 2016 14:59:57 UTC-5, Steven Nash a écrit : > > Hi Simon, > > Thanks, I'll give that ago. > > Cheers, > &g

Re: Is there a hook to run an SQL Query at every Postgres session start?

2016-02-03 Thread Simon Charette
Hi Bobby, I'm not sure this is what you are looking for but it looks like `connection_created`[1] signal might do. Cheers, Simon [1] https://docs.djangoproject.com/en/1.9/ref/signals/#connection-created Le mercredi 3 février 2016 12:25:36 UTC-5, Bobby Mozumder a écrit : > > I'

Re: __unicode__ rather than __str__ in Part 2 of 'Writing you first Django app"?

2016-02-11 Thread Simon Charette
code base without shipping the boilerplate required to handle the conversion correctly. If you can't use Python 3 now I suggest you do as documented and use the `python_2_unicode_compatible` decorator as it will make your future transition to Python 3 easier. Cheers, Simon Le jeudi 11 fé

Re: Why Django-User have all perms, even unexistent?

2016-02-21 Thread Simon Charette
This is only the case for superusers have you might have noticed. Le dimanche 21 février 2016 15:26:54 UTC-5, setivo...@gmail.com a écrit : > > Code in ipython > - > > In [51]: from django.contrib.auth.models import User > > In [52]: User.objects.all() > Out

Absolute beginner question -- recipes

2016-02-28 Thread Simon Gunacker
t = { 'recipe': recipe, } return HttpResponse(template.render(context, request)) but it seems I am not allowed to modify the recipes object. Any ideas how to pass all the data which belongs to recipe to the template? Thank you, Simon -- You received this message because

Re: Absolute beginner question -- recipes

2016-02-28 Thread Simon Gunacker
Thank you Rahul, I actually tried that an this is possible for the relationship between a recipe and its steps. But when it comes to the ingredients for a single step, I cannot do this any more since the ingredients depend on steps again. After reading your suggestion I thought about it once mo

Re: Absolute beginner question -- recipes

2016-02-29 Thread Simon Gunacker
my queries with django; I can finally list my steps using: {% for step in recipe.steps.all %} within my template. However, given the model above I am still not sure how to access a single steps ingredients ... any ideas or suggestions on my current model? Thanks, Simon -- You received this mes

Re: Absolute beginner question -- recipes

2016-02-29 Thread Simon Gunacker
Ok ... but how can I access the additional information stored in StepIngredient then? And - to ask more general - is there a way to find all the "nested objects" attached to my current objects? Something to enter in the shell to see __all__ attributes; not just _meta.fields? -- You received t

Re: Absolute beginner question -- recipes

2016-02-29 Thread Simon Gunacker
(yet interesting) discussion here. My current issue is how to access the additional fields of my M2M relationship. In addition to that I will think about hierarchical data in relational databases ;-) Thanks, Simon -- http://www.slideshare.net/billkarwin/models-for-hierarchical-data -- You rec

Re: Absolute beginner question -- recipes

2016-02-29 Thread Simon Gunacker
Thank you Florian. After James pointed out that I can access my steps (and the ingredients in some way) by just passing the recipe object to the templates context, I thought of reducing the view to a DetailView again. But I have to somehow access the ingredients from my template for now ... --

Re: parallel test running throwing pickleError

2016-02-29 Thread Simon Charette
Hi Girish, I think you didn't to install the `tblib` package[1]. Cheers, Simon [1] https://docs.djangoproject.com/en/1.9/ref/django-admin/#cmdoption-test--parallel Le lundi 29 février 2016 12:13:08 UTC-5, girish ramnani a écrit : > > when running the django test in paralle

Re:

2016-02-29 Thread Simon Charette
Hi Aaron, I think this could be related to the version of your PostgreSQL server. Django 1.9 dropped support for PostgreSQL 9.0[1] which doesn't support GROUP BY selected primary keys[2]. Cheers, Simon [1] https://docs.djangoproject.com/en/1.9/releases/1.9/#dropped-support-for-postgresq

Re: more than one field for aggregates? (ArrayAgg, StringAgg)

2016-02-29 Thread Simon Charette
ons)s)' # ... MyModel.objects.aggregate( ArrayAgg(Row(F('field1'), F('field2'))), ) Cheers, Simon [1] https://docs.djangoproject.com/en/1.9/ref/models/expressions/#writing-your-own-query-expressions Le lundi 29 février 2016 19:31:15 UTC-5, Tomasz Nowa

Re: Absolute beginner question -- recipes

2016-03-02 Thread Simon Gunacker
Thank you James. Taking your suggestion, I solved it! -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this

Re: Absolute beginner question -- recipes

2016-03-02 Thread Simon Gunacker
;with-tag' or 'install some add-ons'. According to Mikes former suggestion, I expected something easy and elegant here ... regards, Simon -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group

Re: Renaming fields in values statements django 1.8

2016-03-04 Thread Simon Charette
Hi Jonty, There's a ticket tracking the addition of this feature[1] but it has not been fixed yet. Cheers, Simon [1] https://code.djangoproject.com/ticket/16735 Le vendredi 4 mars 2016 08:09:20 UTC-5, Jonty Needham a écrit : > > Is there a way to do it? I've seen the method

Re: Renaming fields in values statements django 1.8

2016-03-04 Thread Simon Charette
Hi Jonty, There's a ticket tracking the addition of this feature[1] but it has not been fixed yet. Cheers, Simon [1] https://code.djangoproject.com/ticket/16735 Le vendredi 4 mars 2016 08:09:20 UTC-5, Jonty Needham a écrit : > > Is there a way to do it? I've seen the method

Re: more than one field for aggregates? (ArrayAgg, StringAgg)

2016-03-04 Thread Simon Charette
queryset's SQL representation would also be useful (str(queryset.query)). Cheers, Simon Le vendredi 4 mars 2016 09:57:43 UTC-5, Tomasz Nowak a écrit : > > Hi Simon, thank you for your suggestion! > I managed to accomplish that for one column with custom ROW function and >

Re: more than one field for aggregates? (ArrayAgg, StringAgg)

2016-03-04 Thread Simon Charette
rated? Meanwhile I'll have a look at both your custom expressions to try to identify the bug. Simon Le vendredi 4 mars 2016 16:02:14 UTC-5, Tomasz Nowak a écrit : > > Hi! > > I would like to create a JSON structure of chosen objects (animals) with > corresponding events in one

Re: more than one field for aggregates? (ArrayAgg, StringAgg)

2016-03-04 Thread Simon Charette
ber')], output_field=CharField() ) ), examinations=JsonAgg( JsonBuildObject( [F('wynikbadania__date_entered')], output_field=CharField() ) ), ).distinct('life_number', 'inseminacja__id', 'wynikbadania__id'

Single Page Application in Django

2016-03-06 Thread Simon Gunacker
do I merge templates? How do I do the URL-routing? Any ideas on how to set this up in a smart way? thanks, Simon -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an

Re: more than one field for aggregates? (ArrayAgg, StringAgg)

2016-03-06 Thread Simon Charette
t to get notified when it's finally fixed and rely on .raw()[3] until then. Cheers, Simon [1] https://code.djangoproject.com/ticket/10060 [2] https://docs.djangoproject.com/en/1.9/topics/db/aggregation/#combining-multiple-aggregations [3] https://docs.djangoproject.com/en/1.9/topics/db/sq

Re: addField ForeignKey during migrations create unusable constraint name

2016-03-09 Thread Simon Charette
_zps_calculated_id_6844dce0603174b2_fk_cartography_zps_id" FOREIGN KEY ("zps_calculated_id") REFERENCES "cartography"."zps" ("id") DEFERRABLE INITIALLY DEFERRED; """)], [AlterField( model_name='myModel',

Re: Odd behaviour of DjangoJSONSerializer when serializing datetimes with/without microseconds

2016-03-10 Thread Simon Charette
oformat() > '2016-01-01T01:01:01' Cheers, Simon > e.default(datetime.datetime(year=2016, month=1, day=1, hour=1, minute=1, second=1, microsecond=123456)) > '2016-01-01T01:01:01.123' I think always including the microseconds could make sense but since it might have b

Re: Odd behaviour of DjangoJSONSerializer when serializing datetimes with/without microseconds

2016-03-10 Thread Simon Charette
It looks like I talked to fast. The microseconds are explicitly stripped because the string format used is based on ECMA-262: http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15 >From what I understand JavaScript dates are limited to millisecond precision. Simon Le jeudi 10 m

Re: POSSIBLE BUG: using Coalesce() with __in=[]

2016-03-30 Thread Simon Charette
e hard to fix correctly as `Coalesce` can be nested. e.g. # This should return `0` Coalesce(Coalesce(Sum('quantity'), Value(0)), F('other_field')) Cheers, Simon [1] https://github.com/django/django/blob/2e0cd26ffb29189add1e0435913fd1490f52b20d/django/db/models/lookups.py#L221-L2

Re: run python function in output of annotated query

2016-03-31 Thread Simon Charette
form or template layer. Cheers, Simon [1] https://docs.djangoproject.com/en/1.9/releases/1.8/#subfieldbase [2] https://docs.djangoproject.com/en/1.9/ref/models/fields/#django.db.models.Field.from_db_value Le jeudi 31 mars 2016 10:15:38 UTC-4, Fabio Caritas Barrionuevo da Luz a écrit

Re: Request works with sqlite not with Postgres

2016-04-03 Thread Simon Charette
).values('title','moyenne') Au plaisir, Simon [1] https://github.com/django/django/blob/fdf5cd3429369954e8deb764d9f30f6374581613/django/db/models/aggregates.py#L45 [2] https://docs.djangoproject.com/en/1.9/ref/models/fields/#durationfield [3] https://github.com/django/

Re: Request works with sqlite not with Postgres

2016-04-04 Thread Simon Charette
Hi Tazo, I just submitted a patch that correctly resolves the `output_field` of `Avg` over non-numeric fields. If it gets merged you shouldn't have to worry about passing an explicit `output_field=DurationField()` in Django 1.10. Simon Le lundi 4 avril 2016 09:46:53 UTC-4, Tazo Gil a

Re: Issue with Django Password Normalization

2016-04-20 Thread Simon Charette
ord") 4. Enforce the usage of at least one numeric character You could also define your own rules and add them to AUTH_PASSWORD_VALIDATORS, Simon [1] https://docs.djangoproject.com/en/1.9/topics/auth/passwords/#module-django.contrib.auth.password_validation Le mercredi 20 avril 2016 06:44

Passing Django Template Vars to JS

2018-06-10 Thread Simon Connah
I know that the standard way to do this is to create a script tag with a global JS variable in your Django template before you import your other JS files but that won't work for my current situation. I have an article detail view which is a single model instance. But I also have a list of comment

Re: Passing Django Template Vars to JS

2018-06-11 Thread Simon Connah
#x27;ll do that then. Simon. On Mon, 11 Jun 2018 at 02:04, Vijay Khemlani wrote: > > I'm not sure why your code does not work (maybe there is a "race condition" > between the JS click handlers), but that global variable is a bad idea in > general. > > You can add th

Re: Aggregation issue

2018-06-20 Thread Simon Charette
r_by(): Financial.objects.order_by().values('financial_year').annotate(Sum('revenue')) FWIW there's currently an issue to stop automatically considering Meta.ordering when performing GROUP'ing through values().[0][1] Best, Simon [0] https://code.djangoproject.com

Re: Django Postgres Intermediary doesn't set ON DELETE CASCADE

2018-06-25 Thread Simon Charette
Hey James, Just to add to what was already said there's a ticket tracking the addition of database level foreign constraints.[0] Cheers, Simon [0] https://code.djangoproject.com/ticket/21961 Le samedi 23 juin 2018 09:56:23 UTC-4, Tomasz Knapik a écrit : > > If you search abou

Including DetailView context in ListView page in the Order history page using Django

2018-07-14 Thread Simon McConnell
item.product.image from your template points to nothing. Product is a CharField so I don't see it having any image attribute. Try to display some text for item.product or item.price and see how you go. -- You received this message because you are subscribed to the Google Groups "Django users"

Re: Optimizing Prefetch for Postgres IN Limit

2018-07-27 Thread Simon Charette
There's two open tickets to work around this issue. https://code.djangoproject.com/ticket/25464 which allows passing queryset override to be used for retrieval and another one that I can't currently find that allows specifying that a subquery should be used instead of a an IN clau

Re: What's the Better approach to do these?

2018-08-21 Thread Simon McConnell
There is some discussion on the topic here: https://www.reddit.com/r/django/comments/8xcbtq/book_announcement_building_multi_tenant/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from

Problems with AbstractUser

2018-08-21 Thread Simon McConnell
https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsub

Re: Django Nested Query with Aggregate.Sum()

2018-09-06 Thread Simon Charette
=0) class Reservation(models.Model): ... event = models.ForeignKey(Event, related_name='reservations') seats = models.PositiveIntegerField(default=0) And perform the following query Event.objects.annotate( seats_remaining=F('seating') - Sum('reservations__se

Re: Django Nested Query with Aggregate.Sum()

2018-09-07 Thread Simon Charette
The annotate(seats_remaining=...) will add a `seats_remaining` attribute to Event instances returned from the queryset so you should be able to use {{i.seats_remaining }} Cheers, Le vendredi 7 septembre 2018 04:38:05 UTC-4, mab.mo...@gmail.com a écrit : > > Thank you Simon. > > I

Re: Possible bug in makemigrations

2018-09-12 Thread Simon Charette
Hello Michèl, I'm pretty sure you hit #28862[0] which should be fixed in Django 2.2. Here's the PR resolving it if you're curious about it[1]. Cheers, [0] https://code.djangoproject.com/ticket/28862 [1] https://github.com/django/django/pull/10178 Le mercredi 12 septembre 2018 06:29:30 UTC-4, M

Re: Chaining Q objects

2018-09-19 Thread Simon Charette
Hey Mike, Please provide the full traceback. Also, since all your conditions are ANDed you could use a dict to build filter() kwargs instead of Q() objects. Cheers, Simon Le mercredi 19 septembre 2018 10:36:13 UTC-4, Matthew Pava a écrit : > > I’m not entirely sure if the error is from

Re: Django Channels - core.py error

2018-10-09 Thread Simon Vézina
Hi itsnate_b, Would you mind elaborating on your fix? I'm getting this exact error and I'm at a complete loss. Everything works fine in local, but on my live server, after a couple of minutes/hours of working fine, I start getting this error in the logs. Thanks! Le dimanche 2 septembre 2018

Re: AnonymousUser.is_authenticated woes

2018-10-11 Thread Simon Charette
Are you sure you are using Django 1.11? What does ./run.sh manage --version yields? User/AnonymousUser was made a property in Django 2.0+ which I assume your version of Django CMS is not compatible with. Best, Simon Le jeudi 11 octobre 2018 14:26:27 UTC-4, Stefan Bethke a écrit : > >

Re: AnonymousUser.is_authenticated woes

2018-10-11 Thread Simon Charette
://github.com/django/django/blob/66ac7a129a70a225adc263602bcf7f5750698e8d/django/contrib/auth/models.py#L428-L433 Which is why I suspect you have Django 2.0+ installed. Cheers, Simon Le jeudi 11 octobre 2018 14:58:33 UTC-4, Simon Charette a écrit : > > Are you sure you are using Django 1.11? > &g

<    1   2   3   4   5   6   7   8   >