Creating a image gallery form model

2011-01-08 Thread Simon W
Hi, I have a 'project' model. Each project can have a gallery (im using the photologue-app as model). Now, when I want to let my users edit his project I want to show him all the photos in the gallery and for each photo he can tick a "Remove"-checkbox and/or check a radio button that says "Use as

Django's documention is horrible

2011-01-10 Thread Simon W
Hey, For such a good web framework it's a shame that the documention is not structured well .. at all. It consists of massive text put on a page with some random examples. But examples is all there is. In other languages and frameworks I'm used to have at least a well structed API documention listi

Get request object in class based generic view and form

2011-01-13 Thread Simon W
Hi, I'm trying to put up a modelform for users to edit their 'projects'. But I can't figure out how I can retrieve the request object in the class based generic view. I need it to verify the user. Also, when the form is submitted, I want to re-verify the user once again to make sure his authentic

Are there any Django events we're missing on Lanyrd?

2011-01-28 Thread Simon Willison
we have 47 session videos in our Django collection which are worth browsing through, and we're keen on gathering more: http://lanyrd.com/topics/django/video/ We even have video from the first event after Django was released to the public, way back in 2005! http://lanyrd.com/2005/snakes-and-rubies/

Date internationalizaation

2011-02-05 Thread Simon W
Hey, I have a datetime field in my models. When I format the date into letters it appears in english and I'd like it in another langue. How to? Thank you! // Simon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to t

Re: Postgresql transaction error

2011-03-22 Thread Simon Riggs
hrows an error then you must explicitly rollback the transaction before you continue. This is a requirement of the SQL standard, not just a PostgreSQL issue. I can see it would be fairly hard to Google an answer for. I would guess you started a transaction and then didn't check for success

Re: Prefetching a single item

2015-03-02 Thread Simon Charette
bjects.select_related('seat').order_by('train', 'order').distinct('train')) for train in trains: first_seat = train.first_train_seats[0].seat Hope it helps. Simon Le lundi 2 mars 2015 17:23:29 UTC-5, cool-RR a écrit : > > Hi, > > Say that I

Re: Using proxy kind of Table in Admin Interface

2015-03-02 Thread Simon Charette
Hi Rootz, Unfortunately there's a long standing ticket to solve inconsistency with permissions for proxy models <https://code.djangoproject.com/ticket/11154>so your chosen approach won't work until this is fixed. Simon Le lundi 2 mars 2015 11:16:36 UTC-5, Rootz a écrit : >

Re: Query optimization - From 3 queries to 2

2015-03-02 Thread Simon Charette
countries` and `user` reference). Simon Le dimanche 1 mars 2015 18:33:17 UTC-5, Humberto Moreira a écrit : > > I basically have to display a list of service providers and in each, I > need to display the categories of service they offer. > > So as an example: > > Possible

Re: Can the new `Prefetch` solve my problem?

2015-03-02 Thread Simon Charette
27;, filtered_chairs, to_attr='filtered_nearby_chairs'), ) from itertools import chain for desk in desks: for chair in chain(desk.filtered_chairs, desk.filtered_nearby_chairs): # It will issue only three queries independently of the number of Chair or Desks you have. Simon Le mercr

Re: Custom lookup field for text comparison in Django 1.6

2015-03-04 Thread Simon Charette
( 'customcomparison', 'replace(lower(%s), " ", "") = %%s', db_prepare=db_prepare_customcomparison, ) Note that you should use this code at your own risk since it's messing with Django's internal and I would strongly advise you to move

Re: Prefetching a single item

2015-03-04 Thread Simon Charette
WHERE seat.train_id = train.id LIMIT 5 ) s ON TRUE WHERE train.id IN (1,2,3) Le mercredi 4 mars 2015 16:27:16 UTC-5, cool-RR a écrit : > > Thanks Simon! That worked. > > I would say it's a bit devious though, and it was nice if there was a > method that didn't use `distinct`,

Re: Sharing templates across multiple projects

2015-03-06 Thread Simon Charette
in all you projects and use the 'django.template.loaders.app_directories.Loader' loader. Simon Le jeudi 5 mars 2015 21:24:04 UTC-5, JHeasly a écrit : > > Hello — > > I'm looking for any blogposts/best practices for deploying a common set of > templates across multiple Django projects. > > My

Re: Django 1.8 ImportError: No module named formtools

2015-03-10 Thread Simon Charette
jango-formtools and replace all your references to *django.contrib.formtools* to *formtools*. Simon Le mercredi 11 mars 2015 00:33:29 UTC-4, Neto a écrit : > > I'm trying to use form wizard but when I put 'django.contrib.formtools', in > INSTALLED_APPS appear on my ter

Re: Django 1.8 post_save without recursion

2015-03-13 Thread Simon Charette
e(update_fields={'ok'}) Simon Le vendredi 13 mars 2015 01:35:46 UTC-4, Neto a écrit : > > What is the best way to avoid recursion when using post_save? > > @receiver(post_save, sender=Person) > def do(sender, instance, *args, **kwargs): > instance.ok = True > instanc

Re: Need your advices to optimize when annotate foreign key

2015-03-16 Thread Simon Charette
Hi Sardor, Are you using PostgreSQL? Simon Le lundi 16 mars 2015 05:19:38 UTC-4, Sardor Muminov a écrit : > > > > Hello there, > > > I am trying to perform aggregation from all objects which have one foreign > key. > > > These are my models: > > ...

Re: Need your advices to optimize when annotate foreign key

2015-03-16 Thread Simon Charette
Hi Sardor, I think you've hit a long standing bug: #19259 Annotations generating inefficient SQL on PostgreSQL <https://code.djangoproject.com/ticket/19259> Simon Le lundi 16 mars 2015 11:56:19 UTC-4, Sardor Muminov a écrit : > > > Hi Simon. > > Yes I am. I forgot

Re: Django ReverseSingleRelatedObjectDescriptor.__set__ ValueError

2015-03-18 Thread Simon Charette
ge exception is because you're trying to assign a content type instance from a foreign `apps` instance. I guess the error message could be improved when the expected model apps doesn't match the assigned one, feel free to open a ticket with this enhancement proposal. Simon Le mercre

Re: Django project for multiple clients

2015-03-26 Thread Simon Charette
a database router. Simon Le jeudi 26 mars 2015 12:23:38 UTC-4, Steven Nash a écrit : > > We are design a DJango based application to be used my multiple clients. > Each client will have there own database but share the same code base. > > In the past, when I've done somethin

Re: QueryDict and its .dict() method - why does it do that?

2015-03-27 Thread Simon Charette
also open a door for subtle attack vectors, let's not forget that those implementation assumes a parameter to be a collection or not based on user submitted data. I strongly prefer how Django forces you to explicitly declare you're expecting to retrieve a collection from a specific paramete

Re: Jinja2 with Django 1.8c1 & cannot import name 'Environment'

2015-03-28 Thread Simon Charette
ld be working. Simon Le samedi 28 mars 2015 18:00:47 UTC-4, Rolf Brudeseth a écrit : > > Does anybody see what I may be doing wrong here? > > I followed this example: > > https://github.com/aaugustin/mtefd/blob/master/multiple-template-engines.rst#jinja2-backend > > <ht

Re: Jinja2 with Django 1.8c1 & cannot import name 'Environment'

2015-03-29 Thread Simon Charette
Hi Rolf, Did you install jinja2 <https://pypi.python.org/pypi/Jinja2/2.7.3> in your python environment (I assumed /www/pbs-venv was a virtualenv)? What does /www/pbs-venv/bin/pip --freeze outputs? Simon Le dimanche 29 mars 2015 14:53:49 UTC-4, Rolf Brudeseth a écrit : > > &g

Re: Jinja2 with Django 1.8c1 & cannot import name 'Environment'

2015-03-29 Thread Simon Charette
Hi Rolf, Django 1.8+ adds built-in support but doesn't ship with Jinja2, the same way it has built-in support for PostgreSQL but doesn't ship the psycopg2 package. You must install it in your environment just like you did with the Django package. Simon Le dimanche 29 mars 2015 16

Re: Jinja2 with Django 1.8c1 & cannot import name 'Environment'

2015-03-30 Thread Simon Charette
You're welcome Rolf. Your question lead an initiative by Tim to clarify Jinja2 needs to be installed <https://github.com/django/django/pull/4414>. Cheers, Simon Le lundi 30 mars 2015 19:47:46 UTC-4, Rolf Brudeseth a écrit : > > >> >> Django 1.8+ adds built-in

Re: setup.py for project?

2015-04-02 Thread Simon Brunning
On 2 April 2015 at 11:56, Thomas Güttler wrote: > There are many books about this topic. Which one do you recommend? Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation, ISBN 978-0321601919 Very good indeed. Cheers, Simon B. @brunns 07963 351

Re: Accessing to my user

2015-04-02 Thread Simon Charette
Hi! Personna.objects.get(user__username='foo') should do. Simon Le jeudi 2 avril 2015 11:24:48 UTC-4, somen...@gmail.com a écrit : > > I have this > class Persona(models.Model):7 > <http://178.79.181.191/openbouches/browser/gargamella/quedar/models.py#L7> >

Re: "The outermost 'atomic' block cannot use savepoint = False when autocommit is off." error after upgrading to Django 1.8

2015-04-02 Thread Simon Charette
xcept instead: *Wrong* with transaction.atomic(): try: # Do database stuff possibly raising database errors except DatabaseError: pass *Right* try: with transaction.atomic(): # Do database stuff possibly raising database errors except DatabaseError: pass Sim

Re: Context manager to pick which database to use?

2015-04-28 Thread Simon Charette
f a context manager would require the addition of a thread-local global state that a database router could rely on. Simon Le mardi 28 avril 2015 15:26:48 UTC-4, Peter Coles a écrit : > > When using multiple databases, I would love for a simple way to declare > which database should be used

Re: Django model inheritance: create sub-instance of existing instance (downcast)?

2015-05-13 Thread Simon Charette
quot;Bob's Place").parent bar = Bar(parent=parent, happy_hour=True) bar.save_base(raw=True) Keep in mind that this could break with any new version of Django. Simon Le mercredi 13 mai 2015 05:25:50 UTC-4, guettli a écrit : > > Thank you for this link. The InheritanceManager is good to kno

Re: Improve Performance in Admin ManyToMany

2015-05-14 Thread Simon Charette
foo') return formfield Simon Le jeudi 14 mai 2015 07:29:36 UTC-4, Timothy W. Cook a écrit : > > It isn't that the individual queries are very slow. But that there are so > many of them. Attached is a screenshot of DjDT. > I see that I am not using a cache at all. T

Re: Improve Performance in Admin ManyToMany

2015-05-14 Thread Simon Charette
I meant if db_field.name == 'bars': Sorry for noise... Le jeudi 14 mai 2015 11:15:49 UTC-4, Simon Charette a écrit : > > The last example should read: > > if db_field.name == 'baz': > > > > Le jeudi 14 mai 2015 11:14:24 UTC-4, Simon Charette a écrit

Re: Improve Performance in Admin ManyToMany

2015-05-14 Thread Simon Charette
The last example should read: if db_field.name == 'baz': Le jeudi 14 mai 2015 11:14:24 UTC-4, Simon Charette a écrit : > > It's a bit hard to tell without your model definition and the executed > queries but is it possible that the string representation method (__str__

Re: select_related() / prefetch_related() and sharding

2015-05-21 Thread Simon Charette
Small correction, prefetch_related doesn't issue any JOIN unless a is query with a select_related is specified with a Prefetch object. Simon Le jeudi 21 mai 2015 17:53:30 UTC-4, Ash Christopher a écrit : > > Hi David, > > *select_related* does a JOIN under the hood, and you

Re: Reduce number of calls to database

2015-06-02 Thread Simon Charette
Hi Cherie, A `id__in` queryset lookup should issue a single query. levels = Level.objects.filter(id__in=level_ids) Cheers, Simon Le mardi 2 juin 2015 11:42:19 UTC-4, Cherie Pun a écrit : > > Hi, > > I am new to Django and I am performing some iteration on a queryset. W

Re: Core error in showing records?

2015-06-16 Thread Simon Charette
ango/blob/09f2cdbe1a43e79e31f5ea509b59d4c87db29832/django/contrib/admin/templatetags/admin_list.py#L176-L179> . Make sure it either return True, False or None. Cheers, Simon Le mardi 16 juin 2015 09:11:12 UTC-4, MikeKJ a écrit : > > Can anyone shed any light on what this is please? > > Exception T

Re: custom model fields with to_python()/from_db_value() for different django version...

2015-06-17 Thread Simon Charette
Hi Jens, I haven't tested your alternative but it looks like it would work. I prefer the explicit check against django.VERSION since it makes it easy to search for dead code branch when dropping support a version of Django. Simon Le mercredi 17 juin 2015 10:59:27 UTC-4, Jens Diemer a

Re: Get the name of the method in QuerySetAPI

2015-06-17 Thread Simon Charette
Hi Utkarsh, I guess you could define a __getattribute__[1] method on your manager? from django.db import models class MyManager(models.Manager): def __getattribute__(self, name): print(name) return super(models.Manager, self).__getattribute__(name) Simon [1] https

Re: 1.7 to 1.8 upgrade: test suite failing

2015-07-20 Thread simon . shillaker
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 the issue in a minimal project. Cheers, Simon On Wednesday, July 15, 2015 at 3:03:31 PM UTC+1, Tim Graham wrote: > > A minimal project to reproduc

Google App Engine / Django / Django-nonrel Best Practices

2014-07-05 Thread Adam Simon
Hello, What is the status of Django-nonrel, it seems that there have been a few changes recently on github, but not much overall news, especially on their website? If i try to use Django 1.5 (GAE's latest version) are there any good tutorials / blogs on how to get it working with NDB other t

Google App Engine / Django / Django-nonrel Best Practices

2014-07-16 Thread Adam Simon
Anybody? -- 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 group, send email to django-users@googlegrou

Re: Google App Engine / Django / Django-nonrel Best Practices

2014-07-18 Thread Adam Simon
Thanks Russ. I don't mean to answer my own question, but this is what I found to date: There is a website: http://django-nonrel.org I found that seems to be pretty recent even though for some reason it has a copyright of 2011 There's also an installation guide at: https://media.readthedocs.

Multilingual search with Haystack

2014-08-17 Thread Simon Bächler
ontani.github.io/Django/2012/09/20/multilingual-search/> about how to create a multilingual router for Solr to get and post data to the search server. It could be easily modified for Elasticsearch. But I haven't found a solution for multilingual index creation. Regards Simon -- You re

Re: Multilingual search with Haystack

2014-08-19 Thread Simon Bächler
It's not that simple. When using a search server you should have a separate index per language. Search server are processing text to improve indexing such as saving only the stem of a verb or removing plurals. This is highly language specific. The main problem is therefore the schema creation a

Re: Django ORM generate inefficient SQL

2014-08-26 Thread Simon Charette
This is already tracked in #19259 . Le jeudi 21 août 2014 06:49:41 UTC-4, Alex Lebedev a écrit : > > Hi, guys! > > I have encountered a problem. When I use the following code in django > shell: > > from django.contrib.auth.models import Group >

Re: Django ORM generate inefficient SQL

2014-08-28 Thread Simon Charette
ase backend (I tested it on PostgreSQL and MySQL) > > среда, 27 августа 2014 г., 12:37:00 UTC+6 пользователь Simon Charette > написал: >> >> This is already tracked in #19259 >> <https://code.djangoproject.com/ticket/19259>. >> >> Le jeudi 21 août 2

Re: Django ORM generate inefficient SQL

2014-08-28 Thread Simon Charette
statement, or would you like to do it yourself? > > четверг, 28 августа 2014 г., 20:36:19 UTC+6 пользователь Simon Charette > написал: >> >> The issue on MySQL should be tracked in another ticket I guess -- you're >> right that it should be able to GROUP only b

Re: related_query_name - what is it?

2014-08-29 Thread Simon Charette
The documentation is wrong, it should be: # That's now the name of the reverse filter Article.objects.*filter*(tag__name="important") I'll commit a documentation admonition and give you credit. Thanks for spotting this! Le vendredi 29 août 2014 22:27:38 UTC-4, Petr Glotov a écrit : > > Correcti

Re: Best way to batch select unique ids out of pool for sequences

2014-09-04 Thread Simon Charette
The following should do: Item.objects.bulk_create([ Item(pool_cd=pool_cd.unique_code) for pool_cd in pool_cds ]) Le jeudi 4 septembre 2014 12:44:08 UTC-4, James P a écrit : > > I forgot to include the code where I set the pool codes to NOTFREE, here > is the whole snippet. > > code_count

Re: Preventing race conditions when submitting forms

2014-11-25 Thread Simon Charette
Hi Paul, You might want to take a look at the third party packages listed under the *concurrency* category <https://www.djangopackages.com/grids/g/concurrentp-edit/>. I've used django-concurrency <https://github.com/saxix/django-concurrency> in the past and it worked well f

Re: Foreign Key Deletion Problem

2014-11-25 Thread Simon Charette
L(collector, field, sub_objs, using) class MyModel(models.Model): a = models.CharField(max_length=255, null=True, blank=True) b = models.ForeignKey( 'MyOtherModel', null=True, blank=True, on_delete=SetNull(a) ) Simon Le mardi 25 novembre 2014 12:19:48 UTC-5, Yan a é

Re: Preventing race conditions when submitting forms

2014-11-25 Thread Simon Charette
I can't think of a generic way of solving conflict resolution. I'd say it's highly application specific. Le mardi 25 novembre 2014 15:06:53 UTC-5, Paul Johnston a écrit : > > Tim, Simon, > > Thanks for the responses. Looks like django-concurrency is a good fit,

Re: ModelAdmin.has_change_permission gives 403

2014-11-26 Thread Simon Charette
s def get_readonly_fields(request, obj=None): # Put your business logic here to determine whether or not # the whole model should be read-only based on request.user # and obj. return flatten_fieldsets(self.get_fieldsets(request, obj)) Simon Le mardi 25 novembre 2014 22:20:33 UTC-5

Re: Query set append

2014-12-01 Thread Simon Charette
Try using a subquery for this: tableC_QuerySet = models.TableC.objects.filter( tableC_id__in=models.TableB.objects.filter(table_ID = ).values() ) Le lundi 1 décembre 2014 14:07:59 UTC-5, check@gmail.com a écrit : > > Hello > > I am very new to python and Django . I have a basic question

Re: How to get the class name of a ContentType in django

2013-11-29 Thread Simon Charette
Do you want to retrieve the class name of the model class associated with a content type? Le jeudi 28 novembre 2013 12:04:34 UTC-5, Aamu Padi a écrit : > > How do I get the class name in string of a ContentType? I tried it this > way, but it didn't worked out: > > class StreamItem(models.Model):

Re: View decorators before CSRF verification?

2013-12-15 Thread Simon Charette
cks (@csrf_exempt). Could you file a ticket<https://docs.djangoproject.com/en/dev/internals/contributing/>to report this incompatibility? Simon Le dimanche 15 décembre 2013 11:38:10 UTC-5, Dalton Hubble a écrit : > > I have a function based view that should only respond to GET and HEAD >

Re: Honest feedback

2014-01-31 Thread Simon Charette
Just wanted to add/correct two points. > That also means some of the warts are still there like the difficulty in > writing reusable apps, file based settings, multiple user profiles, that 30 > char username length on the contrib.auth.User model. > Django 1.5 ships with a configurable user

Re: Postgres and backup/restore

2014-02-06 Thread Simon Riggs
g it to another machine but I haven't done that yet. > > One day real soon now. Today is good. Streaming replication does exactly that. http://www.postgresql.org/docs/9.3/static/warm-standby.html#STREAMING-REPLICATION -- Simon Riggs http://www.2ndQuadrant.com/ Post

Re: Model validation across relationships

2014-03-23 Thread Simon Charette
I'd say that's exactly what you should use `Model.clean()` for. In this case you're *doing validation that requires access to more than a single field.* What sounds vague to you in the documentation? Le vendredi 21 mars 2014 19:43:07 UTC-4, Joshua Pokotilow a écrit : > > Given these models, wou

Re: Missing ORDER BY in subselect?

2014-04-16 Thread Simon Charette
I pretty sure this is related to #22434 . There's a patch on Github I'm actually reviewing and it's looking pretty good. If all goes well it should make it to Django 1.7. Le mercredi 16 avril 2014 15:16:0

Re: How to create Union in Django queryset

2014-04-17 Thread Simon Charette
I'm not sure this will work but you could try creating a VIEW on the database side that does the union there and access it through an un-managed model. CREATE VIEW *view_name* AS SELECT id, name FROM *a* UNION SELECT id, name FROM *b*; class C(models.Model): name = models.CharField()

Re: 3 table many to many relationship

2014-04-23 Thread Simon Charette
els.ForeignKey('B') c = models.ForeignKey('C') However you'll loose the ability of directly adding objects to relationships (A().b_set.create() won't work). You'll need to explicitly create `R` instances instead: R.objects.create(a=a, b=b, c=c). Simon Le

Re: Django explicit `order_by` by ForeignKey field

2014-04-25 Thread Simon Charette
ket/19195> . In the mean time you can get the correct ordering by issuing a order_by('group__pk') but you'll have to live with the extraneous JOIN. Thanks, Simon Le vendredi 25 avril 2014 18:50:55 UTC-4, alTus a écrit : > > Hi. So I have some small models: > >

Re: Django explicit `order_by` by ForeignKey field

2014-04-25 Thread Simon Charette
n forward to django-developers in order to get feedback from the community. Simon Le vendredi 25 avril 2014 18:50:55 UTC-4, alTus a écrit : > > Hi. So I have some small models: > > class Group(models.Model): > name = models.CharField() > > class Meta: >

Re: migrate command fails with foreign key to user model

2014-04-28 Thread Simon Charette
This is a release blocker for Django 1.7 which is being tracked in #22485 . Le lundi 28 avril 2014 04:54:32 UTC-4, Ryan a écrit : > > I have used django in the past, but not for some time. So the changes > surrounding the user models are new to me.

Re: Is it a django's bug or something mistaken,when I can't encode chinese characters in django environment?

2014-04-28 Thread Simon Charette
Maybe those API's expect you to pass them bytes and not text. Did you try encoding your subject and your body as 'utf-8' bytes (using .encode('utf-8'))? Simon Le lundi 28 avril 2014 23:00:03 UTC-4, jie.l...@gmail.com a écrit : > > > My environment is python

Re: django-mutant

2014-04-30 Thread Simon Charette
Definition CharFieldDefinition.objects.create(model_def=, name='mycharfield', max_length=100) Simon Le mercredi 30 avril 2014 04:12:27 UTC-4, Eddilbert Macharia a écrit : > > Hello Guys, > > I'm trying to create dynamic models using django-mutant and im having alot &g

Re: Creating an object using Foreign Key for Users but filtered by group

2014-05-05 Thread Simon Charette
You could use the `ForeignKey.limit_choices_to` option : class Message(models.Model): moderator = models.ForeignKey(User, limit_choices_to={'groups__name': 'Moderator'}) user= models.

Re: Using IN clause with parameterized raw queries

2014-05-29 Thread Simon Charette
Did you try: cursor.execute("SELECT username FROM users WHERE username NOT IN (%s, %s, %s)", ['user_a', 'user_b', 'user_c']) Le jeudi 29 mai 2014 18:10:04 UTC-4, J Y a écrit : > > Let say I have this query I would like to execute: > > SELECT username FROM users WHERE username NOT IN ('user_a', '

Re: Django on App engine

2014-06-11 Thread Adam Simon
This is a great question! I would also like to hear some answers ... Adam On Thursday, May 1, 2014 4:46:38 AM UTC-7, Venkatraman.S. wrote: > > Hi, > > Has anyone or is anyone running a reasonably large django webapp on GAE? > Looks like it has become >

Re: Add a processing page between submit page and result page

2017-11-07 Thread Adam Simon
page to tall users that it is running on the >> server. When the result is ready, it will automatically jump to the result >> page. >> I do not know what I should do to get these! >> >> Is there anyone can help me! >> >> Thank You! >> >> Best, &g

Re: Django - Pass a model instance specified by template tags to the view

2017-11-08 Thread Adam Simon
put, separated by commas, and have that hidden field submitted via the form Then on the backend separate out each ID and have the invites sent one by one. I would be happy to write some code if you wish. -- -- Adam F. Simon, PhD Calabasas, CA. cell: 818-425-3719 home: 818-880-8405 Fee

Re: Django - Pass a model instance specified by template tags to the view

2017-11-09 Thread Adam Simon
gt;>> <https://groups.google.com/d/msgid/django-users/bd0439e2-7fdd-4f7c-b6ce-4847d4a877c8%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> It seems to me that the quic

Re: Django - Pass a model instance specified by template tags to the view

2017-11-09 Thread Adam Simon
gle.com/d/msgid/django-users/eab1a4c0-2cc1-41d0-aace-f8ef3fd73112%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/eab1a4c0-2cc1-41d0-aace-f8ef3fd73112%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google

Re: Django - Pass a model instance specified by template tags to the view

2017-11-09 Thread Adam Simon
2017 at 6:19 PM, Adam Simon > wrote: > >> >> Hi Jack. I will write some more details when I get home. Have you ever >> used Ajax? >> >> On Thu, Nov 9, 2017 at 3:14 PM Jack wrote: >> >>> Ok I'm very stuck. Thought very hard about it but can

Re: Django Templates and Conditional CSS classes

2017-11-10 Thread Adam Simon
d/msgid/django-users/6a3adb62-f3d7-4cc2-8c97-add34cf757ce%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/6a3adb62-f3d7-4cc2-8c97-add34cf757ce%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > --

Re: Django Templates and Conditional CSS classes

2017-11-10 Thread Adam Simon
end email to django...@googlegroups.com. >> >> >>> Visit this group at https://groups.google.com/group/django-users. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/6a3adb62-f3d7-4cc2-8c97-add34cf757ce%40googleg

Re: Strange query when using annotate and count

2017-11-23 Thread Simon Charette
best approach would be to avoid annotating the queryset if your don't need to reference the score. Cheers, Simon [0] https://code.djangoproject.com/ticket/27719 Le mardi 21 novembre 2017 08:46:21 UTC-5, Cristiano Coelho a écrit : > > Hmm, should I try with the dev mailing list? Guess i

Re: Strange query when using annotate and count

2017-11-23 Thread Simon Charette
the result in any way. You can clear annotations using `queryset.query.annotations.clear()` but be aware that it is a private API that could change under your feet. Make sure to make a copy of the queryset (e.g. copy = queryset.all()) before performing this change as it will alter the queryset

Re: Strange query when using annotate and count

2017-11-24 Thread Simon Charette
n annotation is referenced before removing it from query.annotations and report your finding on the aforementioned ticket but I expect this to be relatively hard to do correctly. Still it would make implementing `alias()` way easier and provide help for users in the situation as you. Best, Simon

Re: Error on execute migration (create index) when set db_name with quoted string

2017-11-27 Thread Simon Charette
Hey Carlos, I believe the trailing quote truncation issue might be solved in the yet to be released 1.11.8[0][1] version. Could you confirm whether or not it's the case? You'll have to regenerate your migration. Best, Simon [0] https://github.com/django/dja

Re: Error on execute migration (create index) when set db_name with quoted string

2017-11-28 Thread Simon Charette
ket[1] referencing this thread and detailing the issue you are encoutering? It should be eligible for a backport since this is a bug in a newly introduced feature. Until a 1.11.x version fixing the issue is released you can work around the issue by defining an Index(name)[2] manually. Cheers,

Re: Django 2.0 released

2017-12-03 Thread Simon Charette
> My mistake? My "requirements.txt" file did not mention package versions. You should definitely make sure to lock/freeze your requirements to prevent your application's behavior from changing under your feet. Best, Simon Le samedi 2 décembre 2017 15:02:55 UTC-5, Adler Nev

Re: RenameField with django 2.0: AttributeError: 'ManyToManyRel' object has no attribute 'field_name'

2017-12-04 Thread Simon Charette
Hello there, This looks like a regression in Django 2.0 caused by 095c1aaa[0]. Please file a new ticket mentioning it's a regression in Django 2.0 and mark it as a release blocker. [1] Thanks, Simon [0] https://github.com/django/django/commit/095c1aaa898bed40568009db836aa8434f1b983d [1]

Re: PRIMARY KEY in view PostgreSQL

2017-12-11 Thread Simon Charette
ticket until the ORM gains enough introspection power to determine whether or not we should be using the optimization on unmanaged model. Here's the Trac ticket for reference[2]. Cheers, Simon [0] https://github.com/django/django/commit/daf2bd3efe53cbfc1c9fd00222b8315708023792 [1] https:/

Re: Many to Many fields and through table

2017-12-19 Thread Simon Charette
. You can read more about the subject in the documentation[0] Best, Simon [0] https://docs.djangoproject.com/en/2.0/topics/db/models/#intermediary-manytomany Le mardi 19 décembre 2017 16:54:08 UTC-5, mark a écrit : > > Is there any downside to creating a through table in a many to many

the version 2.0.1 login function refuses to take arguments... Login(request user)

2018-01-24 Thread simon munuve
Check the attached file ... -- 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 group, send email to djan

StaticLiveServerTestCase: database emptied after first test after upgrading to Django 1.11

2018-02-23 Thread Simon McConnell
Nothing to do with this? https://docs.djangoproject.com/en/2.0/releases/1.11.2/ -- 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...@googleg

Re: ChoiceField avec valeur cochée par défaut

2018-03-01 Thread Simon Charette
7;deux', 'trois']) form = MyForm(initial={'field': 'deux'}) Au plaisir, Simon Le jeudi 1 mars 2018 16:46:58 UTC-5, Niche a écrit : > > Bonjour! comment faire pour avoir un radiobox (ChoiceField) coché avec une > valeur par defaut ? > -- You receiv

Re: how to do inner join using 3 tables

2018-03-08 Thread Simon Charette
Hello Angel, Did you try the following transaction = Transaction.objects.filter( user=user, status=F('detail__status'), ).first() Best, Simon Le jeudi 8 mars 2018 09:52:44 UTC-5, Angel Rojas a écrit : > > Hello friends, I have a little problem with a relationsh

Re: How to add an OR criterion to an existing QuerySet?

2018-03-14 Thread Simon Charette
Hello Bern, You're actually pretty close to the solution. You should be able to OR an existing querysets filters by using the "|" operator between querysets of the same model. That would be the following: qs |= Model.objects.filter(Q(...)) Simon Le mercredi 14 mars 2018 23:45:

Re: How to add an OR criterion to an existing QuerySet?

2018-03-15 Thread Simon Charette
#x27;t find any mention of it yourself. Best, Simon Le jeudi 15 mars 2018 02:32:18 UTC-4, Bernd Wechner a écrit : > > Simon, > > Thanks enormously. A little experimentation and I got that to work! > Brilliant. Am most pleased it was possible. Good ol' Django to the rescue. > &g

Re: IntegrityError: FOREIGN KEY constraint failed: Django 2.0.3

2018-03-21 Thread Simon Charette
t for database level on_delete constraints[0]. Cheers, Simon [0] https://code.djangoproject.com/ticket/21961 Le mercredi 21 mars 2018 10:50:25 UTC-4, Anon Ymous a écrit : > > Hi, > > I am learning python by trying to create a small Django app. I may have > found a bug related to

Re: A django bug on Queryset.delete

2018-03-28 Thread Simon Charette
Hello Yue, You probably have a model with a ForeignKey where you set on_delete=True. Best, Simon Le mercredi 28 mars 2018 07:11:04 UTC-4, yue lan a écrit : > > Hi, > I think I found a bug of django. My python version is 3.6.3 and Django is > 2.0.3. And the bug is showed below:

Re: How to formulate a query over two models?

2018-04-11 Thread Simon Charette
Hello there, If you are using PostgreSQL you can achieve it using ArrayAgg[0] queryset = MetaData.objects.annotate(values=ArrayAgg('metadatavalue__value')) map = dict(queryset.values_list('name', 'values')) Cheers, Simon [0] https://docs.djangoproject.c

Re: Multiple settings files with sites framework

2018-04-18 Thread Simon Barnett
Ah, I think you've slightly misunderstood me. I already have staging and production sites and settings files - I don't use the Sites framework for that - I just use the DJANGO_SETTINGS_MODULE to control which settings file to use. But now, I need to start using the Sites framework to serve mutl

Re: looking for the right way to work with JSONField - behavior inconsistent between strings and integers

2018-04-24 Thread Simon Charette
ieved from the database. Cheers, Simon [0] https://stackoverflow.com/questions/9304528/why-json-allows-only-string-to-be-a-key#9304820 Le mardi 24 avril 2018 20:21:13 UTC-4, Oliver Zhou a écrit : > > Using Django 1.11, Python 2.7, PostGres, and JSONField I'm getting > behavior I d

Django and Visual Studio Code

2018-04-30 Thread Simon Connah
g a few tutorials on the subject. Has anyone got any tips for setting up these two things, please? Thank you. 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,

Re: Django ORM - better handling of connections

2018-05-14 Thread Simon Charette
nnection when appropriate. Is there any reason you opted for an in-application connection pool instead of using pgbouncer or pgpool instead? Best, Simon Le lundi 14 mai 2018 13:02:15 UTC-4, an...@cabine.org a écrit : > > Hello. > > For the last 6 years I've been using gevent&#x

Re: money field question

2018-05-22 Thread Simon McConnell
I'm in a similar boat at the moment. There is https://github.com/vimeo/py-money too. Note that django-money uses py-moneyed which does not yet use Babel, so rendering of the correct symbol is limited to a few hardcoded currencies. https://github.com/python-babel/babel On Tuesday, 22 May 20

Re: money field question

2018-05-28 Thread Simon McConnell
On Mon., 28 May 2018, 7:50 pm Mike Dewhirst, wrote: > On 24/05/2018 12:03 PM, Mike Dewhirst wrote: > > On 23/05/2018 12:31 PM, Simon McConnell wrote: > >> I'm in a similar boat at the moment. There > >> is https://github.com/vimeo/py-money too. > > > >

<    1   2   3   4   5   6   7   8   >