Weird issue with a form

2024-03-19 Thread 'Simon Connah' via Django users
then moved to /user/accounts/. I have added the get_success_url to point to the correct URL using reverse but even that doesn't work. Can someone help me out with this please? Thank you. Simon. -- You received this message because you are subscribed to the Google Groups "Django users&q

Registration form in template

2024-03-17 Thread 'Simon Connah' via Django users
? 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, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web vi

Strange bug with Firefox

2023-10-14 Thread 'Simon Connah' via Django users
extension so I removed them all (apart from Bitwarden) and completely cleared the history but none of that seems to have fixed the issue. I'm at a loss. Can someone suggest what might be going on here? As I said it works fine in Chrome. Simon. -- You received this message because you are subscribed

Re: Unit test to make sure correct template is returned from a specific URL?

2023-09-25 Thread 'Simon Connah' via Django users
Sun, 24 Sept 2023 at 22:37, 'Simon Connah' via Django users > wrote: > > > I can write a unit test which checks say the title on a page and compares > > it to a string but that is really prone to breakage. What I want to do > > instead is to check that the template that is

Unit test to make sure correct template is returned from a specific URL?

2023-09-24 Thread 'Simon Connah' via Django users
I can write a unit test which checks say the title on a page and compares it to a string but that is really prone to breakage. What I want to do instead is to check that the template that is returned by the URL is the same one that is expected in the unit test. Is there an easy way to do this?

Re: Splitting views.py and urls.py into a directory rather than single files

2023-09-18 Thread 'Simon Connah' via Django users
s file > > On Mon, Sep 18, 2023 at 5:28 PM 'Simon Connah' via Django users > wrote: > > > Hi, > > > > I have an app which has a lot of views and URLs and keeping them in just > > one file makes it really hard to manage because it is so long. I'd like to > &g

Splitting views.py and urls.py into a directory rather than single files

2023-09-18 Thread 'Simon Connah' via Django users
about doing that is. Can someone point me in the right direction 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, send an email to dj

Re: UpdateView and DeleteView

2023-08-27 Thread 'Simon Connah' via Django users
26, 2023, 16:23 'Simon Connah' via Django users > wrote: > > > Thank you! That is very helpful. > > > > > > --- Original Message --- > > On Saturday, August 26th, 2023 at 14:07, Ruby > > wrote: > > > > > > > Yo

Re: UpdateView and DeleteView

2023-08-26 Thread 'Simon Connah' via Django users
efault/#django.contrib.auth.decorators.user_passes_test) > > On Sat, Aug 26, 2023, 11:20 'Simon Connah' via Django users > wrote: > > > I want to make sure that the only people who can update and delete an > > object are either superusers or the person that originally created them but > > I'm not sure h

UpdateView and DeleteView

2023-08-26 Thread 'Simon Connah' via Django users
I want to make sure that the only people who can update and delete an object are either superusers or the person that originally created them but I'm not sure how to go about doing it. Can someone point me in the right direction? I'm not sure which method(s) to override. Thank you. -- You

Building a modular app?

2023-04-02 Thread 'Simon Connah' via Django users
Hi, I want to make a blogging platform and have a question about organising the project. With my blog, I'll have the blog in one Django app and then have something like a forum in another app, along with additional functions in other apps. Also, I'd like to have a single-user system that uses

Possible bug with Q objects

2022-05-19 Thread Simon Van De Keer
items of that tree node* has "456" in its some_field value. The second one joins with the outer query based on the individual treenode_items links, thus checking the filter for each individual item as well, hence *keeping individual items* that do have "123", but don't have

Re: counting the same words within a song added by a user using Django

2021-07-05 Thread Simon Charette
it for existence of a particular lexeme or multiple of them. You could then a union of all a user's song lyrics tsvector and even apply weights based on their listening frequency or their favorite songs. Cheers, Simon [0] https://stackoverflow.com/questions/25445670/retrieving-position-and-number

Re: MODEL CONSTRAINT (based on two dates)

2021-06-30 Thread Simon Charette
Short answer is that you can't; constraints cannot spans across JOINs. You might be able to use database triggers to emulate though. Le lundi 28 juin 2021 à 08:08:27 UTC-4, ngal...@gmail.com a écrit : > I have two models like this > > How can I make models constraint based on the dates as shows

Re: Filtering OR-combined queries

2021-05-03 Thread Simon Charette
to be released tomorrow https://docs.djangoproject.com/en/3.2/releases/3.2.1/ Cheers, Simon Le vendredi 30 avril 2021 à 09:58:53 UTC-4, shahee...@gmail.com a écrit : > Hi, > > On Fri, 30 Apr 2021 at 11:52, Sebastian Jung wrote: > >> Take q for or Filterung: >> >> >>

Re: Please help, I can't install django after a fresh installation of python 3.9 on windows 10

2021-03-19 Thread Simon Lankwagh
thank you all, i created a virtual environment and installed it. On Thursday, March 18, 2021 at 9:20:56 PM UTC+1 ule...@gmail.com wrote: > After installing python, you have to install PIP. > To install PIP type in the following: > python get-pip.py > > To install django tye in the following : >

Please help, I can't install django after a fresh installation of python 3.9 on windows 10

2021-03-18 Thread Simon Lankwagh
I have installed python 3.9 and selected 'add to path' during installation, i am now trying to install django 3.1.7 but it generates a lot of errors i can not understand, please what is the right way to setup django development on windows 10? -- You received this message because you are

Re: Questions about code coverage.

2020-11-09 Thread Simon Charette
do the same locally using django-docker-box (https://github.com/django/django-docker-box) Best, Simon Le lundi 9 novembre 2020 à 10:38:13 UTC-5, chris...@gmail.com a écrit : > Folks- > I ran coverage and massaged the data a bit to get a better idea what areas > weren’t covered. Here

Re: Replicating complex query with two dense_rank() functions using ORM

2020-11-04 Thread Simon Charette
This is unfortunately not possible to do through the ORM right now due to lack of support for filtering against window expressions[0] Until this ticket is solved you'll have to rely on raw SQL. Cheers, Simon [0] ticket https://code.djangoproject.com/ticket/28333 Le mercredi 4 novembre 2020 à

Re: Django Mysql Bulk_Create Ids

2020-09-28 Thread Simon Charette
and retrieving their corresponding primary key. Cheers, Simon Le dimanche 27 septembre 2020 à 19:15:11 UTC-4, rohan...@gmail.com a écrit : > How can we make this happen? > What steps would be needed so that bulk_create ends up returning the ids > of the items that just got created? I d

Re: select_for_update + select_related issue

2020-09-26 Thread Simon Charette
"parent" cannot be selected for update since it's "foreign_id" column, which is "nullable", is implied in an outer join. PostgreSQL simply doesn't support that and you'll have to rethink your data model if this is something you need to achieve[0] Cheers, Simon [0] http

Re: Bootstrap drop down menu not clickable.

2020-05-16 Thread Simon A
gt; 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 havent alr

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
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"

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

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

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 i can

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

2020-03-26 Thread Simon Charette
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' dans django 3.0.4. > Le message d'erreur qui s'affiche d

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

2020-03-21 Thread Simon Charette
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 [1] https

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

2020-02-25 Thread Simon Charette
(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.com/en/3.0/ref/models/expressions/#window-functions Le mardi

Re: Django queryset result and mysql query are wrong after updating from 3.0.2 to 3.0.3

2020-02-19 Thread Simon Charette
` as BigIntegerField was likely only working by change. Cheers, Simon Le mercredi 19 février 2020 14:51:53 UTC-5, Ricardo H a écrit : > > Hi Simon, > > It was ok on 2.2.6, only on 3.0.3 it fails. > > I use BigIntegerField because I use it for some calculations after that, > but even if I t

Re: How to store a boolean expression (parse tree) in a model?

2020-02-19 Thread Simon Charette
Could you simply make the connector field nullable to express that? Simon Le mercredi 19 février 2020 12:15:32 UTC-5, test a écrit : > > thanks, do you know how i can create custom leaf nodes when using MPTT or > treebeard? > > My parent nodes should have

Re: Django queryset result and mysql query are wrong after updating from 3.0.2 to 3.0.3

2020-02-19 Thread Simon Charette
ave an output_field of BigIntegerField instead of DurationField. That could be the origin of your issue. Cheers, Simon [0] https://github.com/django/django/commit/02cda09b13e677db01863fa0a7112dba631b9c5c Le mercredi 19 février 2020 13:08:57 UTC-5, Ricardo H a écrit : > > Hello, after I updat

Re: How to store a boolean expression (parse tree) in a model?

2020-02-18 Thread Simon Charette
SQL type[1] to efficiently store such data. Cheers, Simon [0] https://djangopackages.org/grids/g/trees-and-graphs/ [1] https://www.postgresql.org/docs/current/sql-createtype.html Le mardi 18 février 2020 18:13:39 UTC-5, test a écrit : > > Let's say I have: > > Calculator #1: > Ex

Re: Model uniqueness constraint with date extraction

2020-02-18 Thread Simon Charette
Hello Thierry, Django doesn't support support constraints on lookups/expressions but there's ungoing work to do so[0]. In the mean time you'll have to rely on a `RunSQL` operation in your migrations to create the constraint. Cheers, Simon [0] https://code.djangoproject.com/ticket/30916 Le

Re: How to express `foo = (bar < quox)` as a constraint

2020-01-27 Thread Simon Charette
I'd submit an optimization ticket to allow direct usage of Q objects for boolean field lookup right hand sides Cheers, Simon https://docs.djangoproject.com/en/3.0/ref/models/expressions/#django.db.models.ExpressionWrapper Le lundi 27 janvier 2020 14:32:24 UTC-5, Peter Law a écrit : > > Hi

Re: How to express `foo = (bar < quox)` as a constraint

2020-01-27 Thread Simon Charette
it to work on Django 3.0. Cheers, Simon Le lundi 27 janvier 2020 12:47:37 UTC-5, Peter Law a écrit : > > Hi, > > Thanks for adding support for check constraints in Django 2.2, it's > great to be able to move constraints into the model definitions. > > I've been t

Re: Case-insensitve unique = True

2020-01-23 Thread Simon Charette
DDL assuming your backend supports it. Best, Simon [0] https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/fields/#citext-fields [1] https://docs.djangoproject.com/en/3.0/ref/models/fields/#unique [3] https://github.com/django/django/pull/11929 Le jeudi 23 janvier 2020 21:36:29 UTC-5, Mike

Re: UniqueConstraint rises fields.E310 error because of issue with backward compatibility with unique_together

2020-01-20 Thread Simon Charette
Hello Pavel, This is likely a bug because UniqueConstraint was only recently introduced. Please file a bug report about it. In the mean time you can add this check to your SILENCED_SYSTEM_CHECKS setting to silence it. Best, Simon Le lundi 20 janvier 2020 07:21:26 UTC-5, Pavel Garkin a écrit

Re: Prefetching returning empty values for some object

2019-12-30 Thread Simon Charette
a different name based on whether or not you provided a related_name or related_query_name to Folder.files. Cheers, Simon Le lundi 30 décembre 2019 02:20:07 UTC-5, Mohit Solanki a écrit : > > Assume these two models. > > class Folder(model): > name = models.CharField(max_length

Re: FieldError at / Django models how to reslove this issue....

2019-12-19 Thread Simon Charette
You are missing an underscore here. It should be published_date__lte and not published_date_lte. Cheers, Simon Le jeudi 19 décembre 2019 11:40:05 UTC-5, MEGA NATHAN a écrit : > > Hi all. > > Cannot resolve keyword 'published_date_lte' into field. Choices are: author, > auth

Re: Influencing order of internal migration operations

2019-12-11 Thread Simon Charette
of (model_label, field_name) tuples and have index and constraint operations rely on them. Cheers, Simon [0] https://github.com/django/django/blob/8ea3ff155eda8c9aa55e01e756c13faf2eb542d6/django/db/migrations/autodetector.py#L187-L190 Le mercredi 11 décembre 2019 12:27:43 UTC-5, Rich Rauenzahn a écrit

Re: pip install Django==3.0

2019-12-02 Thread Simon Charette
ilable for the Django and Python version constraints you provided. Instead of getting a non-nonsensical SyntaxError crash when trying to run Django on Python 3.5 pip prevents you from shooting yourself in the foot in the first place. Simon Le lundi 2 décembre 2019 11:06:18 UTC-5, Uri a écrit : >

Re: Django GIS query on annotated spatial field

2019-11-18 Thread Simon Charette
Hello Bill! I'd try again with 3.0rc1 which was released today and file a bug report if it still crashes. Cheers, Simon Le lundi 18 novembre 2019 06:08:29 UTC-5, Bill Bouzas a écrit : > > Good day Simon, > > I reproduced with Django 2.2.7, I receive the same error. > > Ki

Re: Conditional Order By

2019-11-15 Thread Simon Charette
Hello there, You'll want to use Coalesce[0] for this purpose. Model1.objects.order_by(Coalesce('effectual_rating', 'rating').desc()) Cheers, Simon [0] https://docs.djangoproject.com/en/2.2/ref/models/database-functions/#coalesce Le vendredi 15 novembre 2019 13:32:46 UTC-5, Kev H a écrit

Re: Django GIS query on annotated spatial field

2019-11-15 Thread Simon Charette
Can you reproduce with Django 2.2.7 (releases November 4th, 2019) Le vendredi 15 novembre 2019 06:04:32 UTC-5, Bill Bouzas a écrit : > > Good morning Simon, > > Sorry for the delayed response. I a using Django 2.2.6 (released October > 1st, 2019) > > Kind regards, > Bill

Re: Django 2.2: how to use to a field "from a foreign model", in a CheckConstraint: ?

2019-11-14 Thread Simon Charette
So this happened not to be supported in Django 3.0 either. But https://github.com/django/django/pull/12067 should add support for it. Le jeudi 14 novembre 2019 15:50:34 UTC-5, Simon Charette a écrit : > > For the record I haven' tested the above myself. > > It might only work o

Re: Django 2.2: how to use to a field "from a foreign model", in a CheckConstraint: ?

2019-11-14 Thread Simon Charette
For the record I haven' tested the above myself. It might only work on Django 3.0+ and require you to pass `output_field=BooleanField()` to Func. Le jeudi 14 novembre 2019 09:46:48 UTC-5, Simon Charette a écrit : > > Hello there, > > I guess your example is not the best since this

Re: Django GIS query on annotated spatial field

2019-11-14 Thread Simon Charette
Hello Bill, Could you give us more details about which version of Django you are using? There was a few Django bugs related to as_sql returning Union[list, tuple] as params that were fixed in recent release but this one might not have been caught yet. Cheers, Simon Le jeudi 14 novembre 2019

Re: Django 2.2: how to use to a field "from a foreign model", in a CheckConstraint: ?

2019-11-14 Thread Simon Charette
nc(F('author'), 18, function='author_age_gt'), name='age_check') Cheers, Simon Le jeudi 14 novembre 2019 02:45:32 UTC-5, Olivier a écrit : > > Hello, > > Let say I want to enforce a database constraint saying a "book's author > age is over 18". > As you m

Re: Performing a query returns an error

2019-11-13 Thread Simon Charette
se that means it expects a "pid_id" column to exist for the Budgettable.pid field. If you column is actually named "pid" you'll want to use the "db_column" option to let the ORM know about it[0]. That is `db_column=pid` in your `pid = ForeignKey` definition. Cheers,

Re: django 2.0 to django 2.2 migration

2019-10-17 Thread Simon Charette
This was tracked in https://code.djangoproject.com/ticket/30673 and fixed and 2.2.5[0] Cheers, Simon [0] https://github.com/django/django/commit/1265a26b2fa3cbd73a2bccd91b700268bc28bc07 Le jeudi 17 octobre 2019 10:31:50 UTC-4, Sijoy Chirayath a écrit : > > I am changing one of my appli

Re: QuerySet not iterable

2019-10-08 Thread Simon Charette
Hello there, >From looking at your code (super() calls) it seems like your are using Python 2. We've seen similar reports about stdlib functions hiding system level exceptions instead of surfacing them[0] so that might it. It's hard to tell without the full traceback though. Best, Simon

Channels chat consumer behaves differently in prodcution vs development

2019-10-06 Thread Adam Simon
I am using channels 2.x (along with nginx, daphne, redis and gunicorn) In the local console I can see the user data I added in the chat consumer but not in my production environment (in production everything else works, but the user is undefined. Note: the user is logged in. Does

Re: Django Foreign Object

2019-09-26 Thread Simon Charette
This error comes from ForeignObject.resolve_related_fields[0]. If you are using ForeignObject directly you have an incompatible from_fields and to_fields definition. It's hard to debug further without the full traceback. Cheer, Simon [0] https://github.com/django/django/blob

Re: MultipleObjectsReturned: get() returned more than one Site -- it returned 2!

2019-09-05 Thread Simon Charette
It's hard to tell what's wrong from the limited context you provided but whatever code is in django_sites_extensions is highly suspicious. Best, Simon Le jeudi 5 septembre 2019 18:02:49 UTC-4, gh a écrit : > > Traceback (most recent call last): >File > "/edx/app/edxapp/v

Re: Error: Not able to create table using models (Backend mysql)

2019-09-03 Thread Simon Charette
Django 2.0 only supports MySQL 5.5+. I suspect you're getting a syntax error when Django tries to create a table mapping a model with a DateTimeField since it resolves to DATETIME(6) which is not supported on MySQL < 5.5. Cheers, Simon Le mardi 3 septembre 2019 09:58:19 UTC-4, johnsi r

Re: Aggregating the results of a .union query without using .raw, is it possible?

2019-08-19 Thread Simon Charette
= itertools.reduce(QuerySet.union, querysets, querysets[0]) queryset = union.annotate(cc=Sum('weighted_car_crashes')).values('date', 'cc') Best, Simon Le lundi 19 août 2019 17:10:47 UTC-4, Jo a écrit : > > I have a table that looks like this > > datecar_crashes

Re: Duplicated django_content_type Query

2019-08-16 Thread Simon Charette
Hello there, These queries should be cached by ContentTypeManager[0] so something must be broken in your Django install or monkey patching this method. Simon [0] https://github.com/django/django/blob/7da6a28a447dc0db2a2c6ef31894094eb968f408/django/contrib/contenttypes/models.py#L34-L44 Le

Re: Recreating SQL query in ORM

2019-07-31 Thread Simon Charette
.values() before an annotation of an aggregate function uses the provided columns from grouping. Cheers, Simon Le mardi 30 juillet 2019 12:56:56 UTC-4, Jonathan Spicer a écrit : > > Hello, > > I have an sql query that I would like to recreate using the ORM. Would it > be possible for

Re: What's the best way to find the number of database accesses being done?

2019-07-23 Thread Simon Charette
you have a look at the dedicated section of the documentation[3]. I've filed a ticket to make sure bulk_update is also mentioned in this section of the documentation. Cheers, Simon [0] https://www.dabapps.com/blog/logging-sql-queries-django-13/ [1] https://docs.djangoproject.com/en/2.2/topics

Re: What's the best way to update multiple entries in a database based on key/value pairs

2019-07-23 Thread Simon Charette
=1 THEN foo WHEN id=2 THEN ...) That you can emulate yourself by using Case and When expressions if you're using Django < 2.2. Cheers, Simon [0] https://docs.djangoproject.com/en/2.2/ref/models/querysets/#bulk-update Le mardi 23 juillet 2019 12:15:20 UTC-4, Don Baldwin a écrit : > >

Re: NotImplemented error combining distinct with annotate

2019-07-21 Thread Simon Charette
('sales_amount') ) for person in persons: print('Salesperson %s sold %d dollars' % (person['salesperson'], person['sum_sales_amount']) Note that .values() before annotating a an aggregation function results in a GROUP BY which should should prefer over using DISTINCT. Cheers, Simon Le dimanche 21

Re: Job board app based in django

2019-06-21 Thread Simon A
Oh really? Yeah I guess it wont be too bad if I create one. On Fri, Jun 21, 2019 at 6:56 PM Omar Abou Mrad wrote: > There are problem N clones of job boards built with django, this shouldn't > affect your decision to create one. > > On Fri, Jun 21, 2019 at 10:59 AM Simon A wrote: &

Re: How to store a bank account number generated into a model field

2019-06-21 Thread Simon A
I think the except block won't trigger since if the code Profile.objects.get(user=request.user) does not get any results, it will return a null result, not throw exception. instead of exception handling, just check if the return value is null or not -- You received this message because you

Re: [Urgent] 500 when requesting a file from browser.

2019-06-21 Thread Simon A
On the last part of your stacktrace, there is a section File "/usr/lib/python3.6/wsgiref/simple_server.py", line 35, in close self.status.split(' ',1)[0], self.bytes_sent could you please check this line out? you can try to print what is *self.status *to check what it is trying to split

Job board app based in django

2019-06-21 Thread Simon A
hey guys, I would like to develop a job board app based in django. I was wondering if there is already an available job board app based in django like jobberbase. There is a jobberbase clone made from django but its version too old already. thank you, Simon -- You received this message

Re: Vicious cycle: Cannot migrate a DB that uses a widget using a model

2019-06-19 Thread Simon Charette
sure the Country.objects.order_by('name') query is only executed when .widgets is accessed for the first time on a PlaceWidget instance instead of at initialization time. Cheers, Simon [0] https://docs.djangoproject.com/en/2.2/topics/performance/#cached-property Le mercredi 19 juin 2019 09:40:23

Re: IndexError: Number of args exceeds number of fields

2019-06-19 Thread Simon Charette
It's hard to tell without the full traceback but Django 1.11 doesn't support Python 3.7 so it'd start by either using Django 2.2 or downgrading to Python 3.6 Cheers, Simon Le mercredi 19 juin 2019 08:16:51 UTC-4, Ezequias Rocha a écrit : > > Hi everyone > > I am doing a modeling of

Re: Package that helps update only changed fields

2019-06-18 Thread Simon Charette
= None def save(self, commit=True): instance = super().save(commit=False) if commit: update_fields = None if instance._state.adding else self.update_fields instance.save(update_fields=self.update_fields) return instance Cheers, Simon Le mardi 18

Re: Django tests appear to be getting substantially slower

2019-06-16 Thread Simon Charette
. A slower Django setup(), I think some changes were part of 1.8 -> 1.11 2. Reliance on now lazily loaded part of Django. Cheers, Simon [0] https://docs.python.org/3/library/profile.html Le samedi 15 juin 2019 11:25:10 UTC-4, Mark Jones a écrit : > > Ah, but the slowdown is happening from 1.

Re: Django tests appear to be getting substantially slower

2019-06-15 Thread Simon Charette
I meant Django 2.0 -> 2.1. As long as you are using Django 2.2 with SQLite 3.20+ the slowdown I mentioned should be effective. Simon Le samedi 15 juin 2019 08:32:56 UTC-4, Mark Jones a écrit : > > Maybe that's the case, I didn't build the python2.7 or 3.7, but I used > pyenv to

Re: Django tests appear to be getting substantially slower

2019-06-15 Thread Simon Charette
Hi Mark, It's hard to tell exactly what's going on without more details but assuming you are running tests against SQLite the 2.1 to 2.2 slowdown is likely caused by the fact database constraints are now checked of each TestCase[0]. Cheers, Simon [0] https://docs.djangoproject.com/en/2.2

SAVING DATA IN FORMTOOL WIZARD MODELFORM

2019-05-28 Thread Simon John
Hi Any one can help on how to save data using formtool wizard and Modelform The view of my models and form and views and the error are here -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Formtools Wizard and Modelform saving data

2019-05-28 Thread Simon John
I am trying to save data to db after all the three from have submited and still getting and error, any work around -- 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

Re: Filtering Data Based On Foreign Key

2019-05-23 Thread Simon A
Have you tried putting the load_price() code inside the init code? like def __init__(self, *args, **kwargs): super(PlayerRegistrationForm, self).__init__(*args, **kwargs) self.fields['club_id'].widget = forms.HiddenInput() membership = request.GET.get('membership_title')

Re: some random problem

2019-05-23 Thread Simon A
share the code here. I know django devs are lazy but don't be this lazy. On Wednesday, May 22, 2019 at 8:07:08 PM UTC+8, Soumen Khatua wrote: > > Hi Folks, > > I'm getting len(cart) is 0 and after iterate *item is not coming from > cart* in this project,plese tell me where is my problem. > I'm

Re: Dealing with global or session objects

2019-05-23 Thread Simon A
operation request.session.get('key', None) # set operation self.request.session['key'] = value Please also see https://docs.djangoproject.com/en/2.2/topics/http/sessions/ for more information. Regards, Simon. On Wednesday, May 22, 2019 at 9:26:15 PM UTC+8, Jean-Noël Colin wrote: > > Hi, &

Re: Django 2.2 creates multiple migration files when AbstractUser is used

2019-05-02 Thread Simon Charette
Hey David, Could you try explicitly defining an objects manager on your User model and see it if helps. e.g. from django.contrib.auth.models import UserManager class User(AbstractUser): ... # fields objects = UserManager() I'm also having trouble reproducing locally though. Simon

Re: Pagination breaks in ListView after migrating from Django 1.11 to 2.2 with SQLite

2019-04-23 Thread Simon Charette
I assume you are either using a Subquery annotation that returns multiple results or an __in lookup against a query with multiple columns. I vaguely remember something changed in this area but it was documented in one of the 2.0, 2.1 or 2.2 release notes. Best, Simon Le mardi 23 avril 2019 10

Merging multiple Django project into one

2019-04-18 Thread Simon Liu
Hello, I am try to migrate users from an old project into a a new project i am working on. I have extracted all the models from my old project into a reusable app. I was able to connect to multiple database, but i wasn't able to make my project be able to read the users and group from my old

Re: Django 2.2 and custom media in the admin

2019-04-09 Thread Simon Charette
ts. [1] Cheers, Simon [0] https://docs.djangoproject.com/en/2.2/releases/2.2/#merging-of-form-media-assets [1] https://docs.djangoproject.com/en/2.2/topics/forms/media/#assets-as-a-static-definition Le mardi 9 avril 2019 11:02:35 UTC-4, Thorsten Sanders a écrit : > > Hello, > > I insert a

Re: UniqueConstraint raises uncaught IntegrityError in Admin

2019-04-09 Thread Simon Charette
until built-in support is added. Submitting a new Trac ticket so we don't loose track of the issue would also be appreciated. Cheers, Simon [0] https://github.com/django/django/pull/10796#discussion_r244216763 Le mardi 9 avril 2019 07:29:53 UTC-4, Ryan Jarvis a écrit : > > Hey there, > >

Re: How to deploy migrations to production

2019-04-02 Thread Simon A
ake a look at > https://github.com/speedy-net/speedy-net/blob/master/contrib/deploy.sh > אורי > u...@speedy.net > > > On Tue, Apr 2, 2019 at 3:51 PM Simon A > > wrote: > >> There is a workflow section in the migration page from the django project >>

Re: How to deploy migrations to production

2019-04-02 Thread Simon A
Ah I see. Thank you Jani for clearing that up. -- 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,

How to deploy migrations to production

2019-04-02 Thread Simon A
There is a workflow section in the migration page from the django project documentation. But there are somethings I am confused about, It says that the migrations need to be created in the non production environment and then checked in to the repository along with the changes in models.py. My

Re: Unit-Testing Django Views

2019-03-28 Thread Simon Charette
] (with or without html=True) and assertTemplateUsed[2] instead. Cheers, Simon [0] https://docs.djangoproject.com/en/2.1/ref/csrf/#how-it-works [1] https://docs.djangoproject.com/en/2.1/topics/testing/tools/#django.test.SimpleTestCase.assertContains [2] https://docs.djangoproject.com/en/2.1/topics/testing

Re: Create models using raw SQL queries

2019-03-27 Thread Simon A
hi Cameron, as Eric said, by doing this you might not fully take advantage of the features of django. But if you still want to proceed maybe you can use the managed option for models. https://docs.djangoproject.com/en/2.1/ref/models/options/#managed. with this approach, you'll create the

Re: Creating Objects from Annotations and Other Models

2019-03-21 Thread Simon Charette
but it was still missing consensus about what to do on other backends. If I remember correctly the two alternatives were to defer the field or perform an immediate SELECT. Cheers, Simon Le jeudi 21 mars 2019 13:06:04 UTC-4, Dylan Young a écrit : > > For example using made-up

Re: Django 2.1.4: Permissions are not updated after migrations

2019-03-18 Thread Simon Charette
point to a model? They point to models through the Permission.content_type foreign key; ContentType have an (app_label, model_name) unique tuple. Best, Simon Le lundi 18 mars 2019 04:35:55 UTC-4, Yevgeny Bar Lev a écrit : > > Thanks Simon! > Two questions: > a) Would the following strateg

Re: Django 2.1.4: Permissions are not updated after migrations

2019-03-17 Thread Simon Charette
Hello Yevgeny, I'd start by deleting your stale content types[0] which your permissions are attached to. That should deal with deleted model case. For the renames I suggest you drop into a shell and manually edit the Permission.name of the misnamed instances. Best, Simon [0] https

Re: Django 2.1.4: Permissions are not updated after migrations

2019-03-17 Thread Simon Charette
Hello Yevgeny, I don't have magic solution to suggest to you given the current state of your permission data after a few iterations but I just wanted to let you know that it's a known issue[0] and a contributor is actively working on getting it fixed[1]. Cheers, Simon [0] https

Re: Why are foreign keys rewritten when adding related_name?

2019-03-01 Thread Simon Charette
Hello HM, I know that some changes have been made to avoid unnecessary foreign key rebuilds on some option changes. Are you experiencing this on 2.1 and 2.2 pre release? Simon Le vendredi 1 mars 2019 02:40:01 UTC-5, HM a écrit : > > I added "related_name" to an exiting Foreig

Re: Help with aggregates needed

2019-02-27 Thread Simon Charette
= element.id ) WHERE expenses.year = $year GROUP BY area.name, element.name ORDER BY area.name, element.name Cheers, Simon Le mercredi 27 février 2019 14:04:21 UTC-5, Felix Lazaro Carbonell a écrit : > > Hi to everyone: > > > > Having models like these: > > >

Re: Working with pk arguments within an included URL

2019-02-18 Thread Simon A
' # get a session variable self.request.session.get('key', None) On Mon, Feb 18, 2019 at 3:10 PM Gavin Boyle wrote: > Hi Simon, > > That’s a great idea, I’ve only ever worked with built in sessions for > logging in. Would you have a link to some documentation or an example that > would

Re: REG: Why my django email settings not sending email notifications?

2019-02-17 Thread Simon A
Just to add, please try to create a python file with the simplest implementation of send mail just to check if it actually works. On Monday, February 18, 2019 at 11:43:22 AM UTC+8, Sid wrote: > > can you check if you your email server is somehow blocking your emails? > Have you enabled your

Re: Working with pk arguments within an included URL

2019-02-17 Thread Simon A
I think I had a similar scenario a few weeks ago. One option that you have is to store the originally selected PK to the session object. Whenever you load a page, for you can retrieve the PK from the session object. Most likely you'll do this on the get_queryset function On Sunday, February

Re: select_for_update Documentation is confusing(?)

2019-02-15 Thread Simon Charette
nly executed when entries are iterated over. Given the documentation clearly mentions "*Evaluating* a queryset" and "Building a queryset" I don't think it's worth amending it. Cheers, Simon Le vendredi 15 février 2019 07:40:51 UTC-5, Philoj Johny a écrit : &

Re: select_for_update Documentation is confusing(?)

2019-02-15 Thread Simon Charette
I meant, and *not* "Building a queryset" in my previous reply. Le vendredi 15 février 2019 14:18:27 UTC-5, Simon Charette a écrit : > > Hello Philoj, > > > Does this mean that the above code example will raise > TransactionManagementError... > > It won't

Re: Is there a package for user-tagging and user-properties?

2019-02-14 Thread Simon A
This might not be a package but django allows to extend the User object via a one to one relationship. Once extended, you can add as many fields as you like. It will be better though if this will happen at the start of the project. Using this method at the middle of the project might cause a

  1   2   3   4   5   6   7   >