Re: Migrate a many-to-many field to an explicit intermediate ("through") model?

2015-07-20 Thread Carsten Fuchs
Hi Gergely, Am 16.07.2015 um 20:44 schrieb Carsten Fuchs: 3) change the m2m field by adding the through option, and add this change to the migrations file. [...] And won't this last step trigger the same error as before? ("... you cannot alter to or from M2M fields, or add or remo

Why is Admin login template at admin/login.html instead of registration/login.html?

2015-07-23 Thread Carsten Fuchs
Dear Django fellows, using Django 1.8.3, I see that the Admin contrib uses the Auth contrib's views (in contrib/admin/sites.py). The implementation overrides the auth views' defaults only if explicitly specified in the AdminSite object. For example, changing the user password is implemented i

Re: Migrate a many-to-many field to an explicit intermediate ("through") model?

2015-07-23 Thread Carsten Fuchs
Am 16.07.2015 um 16:05 schrieb Carsten Fuchs: Alas... are there any viable alternatives to this? I'd be very grateful for any hint! :-) Anyone please? Best regards, Carsten -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: Migrate a many-to-many field to an explicit intermediate ("through") model?

2015-07-23 Thread Carsten Fuchs
Hi Carl, Am 23.07.2015 um 18:28 schrieb Carl Meyer: Overall I think it might be simpler to go with your initial approach. I'd first rename the old field to some other temporary name (you don't have to update any other code to use this name, as you'll commit all of these migrations in one commi

Re: Why is Admin login template at admin/login.html instead of registration/login.html?

2015-07-23 Thread Carsten Fuchs
Hi Tim, many thanks for your reply! Am 23.07.2015 um 18:49 schrieb Tim Graham: The admin login only allows staff users to login so it makes sense to me that if you wanted to add regular user login to your site, it should have separate URLs. I think what confuses me is the fact that (in the A

Re: Why is Admin login template at admin/login.html instead of registration/login.html?

2015-07-24 Thread Carsten Fuchs
Hi Carl, Am 23.07.2015 um 20:07 schrieb Carl Meyer: Of course it's _possible_ to have just a single login page instead, if you want that, but it's not at all clear to me that that's better. I prefer to keep the admin relatively separate from the public site. And I think the same is true for pas

Re: Migrate a many-to-many field to an explicit intermediate ("through") model?

2015-07-24 Thread Carsten Fuchs
Hi all, just wanted to let you know that I was successful! I followed Gergely's final recipe, using RunPython for the data migrations and separate migration files for each of the steps. For step 3 (the deletion of the ManyToManyField) I temporarily had to remove the django.contrib.admin from

Transaction questions

2015-07-27 Thread Carsten Fuchs
Hi all, using Django 1.8.3, at this time I have code like this: try: mm = TestMonthModel.objects.select_for_update().get(jahr=Jahr, monat=Monat) except TestMonthModel.DoesNotExist: mm = TestMonthModel(jahr=Jahr, monat=Monat) # A *long* computation, eventually setti

Re: Upgrading Django (to 1.7)

2014-10-02 Thread Carsten Fuchs
Hi Andrew, Am 2014-10-02 um 05:36 schrieb Andrew Pinkham: Any feedback appreciated. I hope you find the material helpful. Also from me a hearty thanks for your article series! It's very helpful, and very much appreciated! Best regards, Carsten -- Cafu Engine * www.cafu.de an open-source 3D

Re: ANN: Django website redesign launched

2014-12-17 Thread Carsten Fuchs
Hi all, Am 17.12.2014 um 20:36 schrieb llanitedave: Count me with those who generally like the new layout. The main page looks a little sparser on a large screen, but the documentation pages make much better use of space. I think the fonts are just fine. My main suggestion would be to use sli

ModelAdmin with inlines: How to learn if/what has changed before the models are saved?

2014-12-18 Thread Carsten Fuchs
Hi fellow Django developers, using a model with several related models, for the Django Admin I have a ModelAdmin that uses several InlineModelAdmin objects, very much as in the example at . All works well, but

Re: ModelAdmin with inlines: How to learn if/what has changed before the models are saved?

2014-12-22 Thread Carsten Fuchs
Hi Collin, Am 20.12.2014 um 00:18 schrieb Collin Anderson: save_model() happens first, then save_related() which calls save_formset() on each formset. It might end up being easier to save the parent model _again_, instead of doing something before it's saved. Thank you very much for your repl

Re: ModelAdmin with inlines: How to learn if/what has changed before the models are saved?

2014-12-22 Thread Carsten Fuchs
Hi Alex, Am 20.12.2014 um 22:47 schrieb Alex Haylock: Take a look at the Django signal dispatcher: https://docs.djangoproject.com/en/dev/topics/signals/ Specifically, the 'update_fields' argument passed to the 'pre_save' signal should provide what you need: https://docs.djangoproject.com/en/de

Re: or-ing to QuerySets turns INNER into LEFT OUTER joins?

2014-02-14 Thread Carsten Fuchs
Hi, Am 14.02.2014 22:28, schrieb Sharath Gururaj: Did you find a fix for this problem? I'm running into the same issue. I am manually doing a union in python to avoid the left outer join. Unfortunately, I've not found anything else, and ended up using what I described in my earlier posts: com

How to atomically create and lock an object?

2016-05-11 Thread Carsten Fuchs
Dear Django group, please consider this code: from datetime import date from django.db import models class TestModel(models.Model): jahr = models.SmallIntegerField() monat = models.SmallIntegerField() some_value = models.SmallIntegerField() class M

Re: How to atomically create and lock an object?

2016-05-12 Thread Carsten Fuchs
Hi Simon, many thanks for your reply! Please see below for some follow-up questions. Am 11.05.2016 um 16:04 schrieb Simon Charette: Did you try using select_for_update() with get_or_create()[1] in an atomic()[2] context? @transation.atomic def demonstrate_the_problem(): d = date.today()

Re: How to atomically create and lock an object?

2016-05-12 Thread Carsten Fuchs
se because a transaction is already started by the demonstrate_the_problem() atomic wrapper. Else the connection is left in an unusable state by the integrity error. Cheers, Simon Le jeudi 12 mai 2016 10:48:30 UTC-4, Carsten Fuchs a écrit : Hi Simon, many thanks for your reply! Pleas

Re: Starting new project -- version 1.10

2016-08-23 Thread Carsten Fuchs
Am 23.08.2016 um 14:11 schrieb Michal Petrucha: Finally, you need one Python package that serves as the “app” that glues all the other packages together. This is the package (or app) that contains the settings module, the root URL configuration, the WSGI entry point, and often also static files,

Django 1.10.3 with Oracle database and --keepdb

2016-11-04 Thread Carsten Fuchs
Dear Django fellows, using Django 1.10.3 with Oracle database, is running ./manage.py test --keepdb supposed to work without having an explicit test password set? DATABASES = { 'default': { 'ENGINE': 'django.db.backends.oracle', # ... 'TEST': { # --kee

Re: Django 1.10.3 with Oracle database and --keepdb

2016-11-05 Thread Carsten Fuchs
Hi Simon, Am 05.11.2016 um 08:46 schrieb Simon Charette: [0] https://code.djangoproject.com/ticket/27435#ticket Thank you! Best regards, Carsten -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receivi

Re: Django 1.10.3 with Oracle database and --keepdb

2016-11-05 Thread Carsten Fuchs
Hi Mariusz, Am 2016-11-05 um 13:11 schrieb Mariusz Felisiak: Yes. Please, make sure that your main oracle user has *ALTER USER* permission. It is well possible that that is the culprit. I've set my database user's privileges as described at https://docs.djangoproject.com/en/1.10/ref/database

Re: Django 1.10.3 with Oracle database and --keepdb

2016-11-07 Thread Carsten Fuchs
Am 05.11.2016 um 15:55 schrieb Carsten Fuchs: Am 2016-11-05 um 13:11 schrieb Mariusz Felisiak: Yes. Please, make sure that your main oracle user has *ALTER USER* permission. I'll check (it may take until Monday or Tuesday though) and post an update here. Indeed, after having added the

Questions about MySQL notes in Django docs

2019-01-23 Thread Carsten Fuchs
Dear Django group, can you please help me with some questions about https://docs.djangoproject.com/en/2.1/ref/databases/#mysql-notes ? (I've been using Django with an Oracle database for years, but I'm new to MySQL.) a) Does "Django supports MySQL 5.6 and higher." cover MySQL 8? (I'm not sur

Re: Questions about MySQL notes in Django docs

2019-01-23 Thread Carsten Fuchs
, Django supports MySQL 8. If you google "django mysql 8" the second > result is https://code.djangoproject.com/ticket/29451. Based on the commits > there, it looks like Django 2.0.7 and above received the fixes. > > On Wednesday, January 23, 2019 at 5:10:18 AM UTC-5, Carsten Fuc

Re: Questions about MySQL notes in Django docs

2019-01-24 Thread Carsten Fuchs
Hi Michael, Am 23.01.19 um 13:56 schrieb Michal Petrucha: >> d) Why is isolation level "read committed" preferred over "repeatable read"? >> The text says "Data loss is possible with repeatable read.", but how can >> "repeatable read" have data loss that "read committed" has not? > > I can't answ

Re: Questions about MySQL notes in Django docs

2019-01-26 Thread Carsten Fuchs
Hi Jason, Am 24.01.19 um 14:47 schrieb Jason: > It doesn't look like the fixes were backported to 1.11, after looking in the > django 1.11 release notes. > As Tim said,  >> Based on the commits there, it looks like Django 2.0.7 and above >> received the fixes Yes, that's part of my problem.

Migration question: why causes this change a non-empty migration?

2019-02-01 Thread Carsten Fuchs
Dear Django group, using a model like this: ``` class Kostenstelle(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=60, blank=True) # ... omitted fields class Meta: db_table = 'kostenstelle' ``` I replaced the `id` line with ```

Re: Migration question: why causes this change a non-empty migration?

2019-02-01 Thread Carsten Fuchs
Am 01.02.19 um 17:39 schrieb Tim Graham: > I'm reluctant to continue investigation as you're using an old version of > Django and many bugs have been fixed since then. If you can reproduce a > problem with Django 2.2 alpha and a fresh database, feel free to create a > ticket if you can't find an

Re: Unable to access mysql db and apply changes using "python manage.py migrate"

2019-02-02 Thread Carsten Fuchs
Hi Emmanuel, the error message is clear, isn't it? (1045, "Access denied for user 'root'@'localhost' (using password: YES)") Check your password. Use the mysql client to check. Best regards, Carsten Am 02.02.19 um 10:07 schrieb Emmanuel klutse: > hello team, > Can someone help me with the prob

Re: Unable to access mysql db and apply changes using "python manage.py migrate"

2019-02-02 Thread Carsten Fuchs
Am 02.02.19 um 10:33 schrieb Emmanuel klutse: > [...] creat a db for me in mysql instead of sqlite and the error is talking > about authentication. > these are the changes made in my djangoproject/settings file: > DATABASES = { >     'default': { >     'ENGINE': 'django.db.backends.mysql', Yo

Re: Unable to access mysql db and apply changes using "python manage.py migrate"

2019-02-02 Thread Carsten Fuchs
Am 02.02.19 um 11:10 schrieb Emmanuel klutse: > yes im talking about using "python manage.py migrate" command to create > tables in the db(djangoproject) i have already created in mysql server `manage.py migrate` is trying to access your MySQL database, but the database denies the access to the

Re: PLEASE HELP! Django documentation, Writing Your First App, Part 4

2019-02-02 Thread Carsten Fuchs
Hi Nori, does the choice actually exist? Can you find it if you query the choices using the ORM in `./manage.py shell`? Best regards, Carsten Am 03.02.19 um 03:59 schrieb Atsunori Kaneshige: > Hi Django users, > > I started using Django recently. > I am following the official Django tutorial.

Re: PLEASE HELP! Django documentation, Writing Your First App, Part 4

2019-02-03 Thread Carsten Fuchs
Well, you're adding choices to q = Question.objects.get(pk=1). But is this also the question you call the view with? I suggest you add a few more print statements below your existing print(question) For example: print(question.pk) print(question.choice_set.all()) # Or, a bit mo

Using forms to handle request.GET data?

2019-04-02 Thread Carsten Fuchs
Dear Django group, I would like to show users a form that they can use to customize the view, for example a ChoiceField from which the year of the report can be chosen. It seems straightforward to use a forms.Form to handle the request.GET data: from django import forms class JahrAuswahl(form

Re: Using forms to handle request.GET data?

2019-04-04 Thread Carsten Fuchs
Hello, Am 03.04.19 um 21:28 schrieb Mohammad Etemaddar: > Set default value: > year = forms.ChoiceField(required=False, choices=[(j, j) for j in range(2018, > 2021)], default=2019) Thanks for your reply, but unfortunately, `default` is a keyword for model fields only, not for form fields: TypeE

Re: Using forms to handle request.GET data?

2019-04-04 Thread Carsten Fuchs
To elaborate on this further: Searching the web for this yields numerous hits, e.g. https://stackoverflow.com/questions/16026479/django-forms-default-values-for-bound-forms mentions some ways to address this, but I've not come across a fully satisfactory solution. Another approach might be thi

Re: Using forms to handle request.GET data?

2019-04-04 Thread Carsten Fuchs
Am 04.04.19 um 16:24 schrieb Matthew Pava: > And, since you really don't want constants littering your code, you probably > want something like this: > context['default_year'] = timezone.now().year Sure, thanks, but the year was only used to keep the example code minimal and the focus on how to

Re: Using forms to handle request.GET data?

2019-04-04 Thread Carsten Fuchs
Am 04.04.19 um 16:23 schrieb Matthew Pava: > If you need a default year in your template context, put it there. > > def get_context_data(self, request, *args, **kwargs): > context = super().get_context_data(request, *args, **kwargs) > context['default_year'] = 2019 > return context >

Mocking date and time in LiveServerTestCase?

2017-01-25 Thread Carsten Fuchs
Dear Django fellows, I'm using LiveServerTestCase with Selenium. The application code run by LiveServerTestCase's live server works well and a view's call to date.today() returns the current date. For the tests, however, it would be helpful if we could fix the time and date at which the test

Re: Mocking date and time in LiveServerTestCase?

2017-01-30 Thread Carsten Fuchs
Hi Adam, Am 25.01.2017 um 21:01 schrieb Adam Stein: When I need to set the date to a known day for tests, I use forbiddenfruit (https://github.com/clarete/forbiddenfruit). Thanks for mentioning this, I didn't know it before! However, I have not yet tried it, because I had hoped that there was

Re: template {% url } tag syntax

2017-02-26 Thread Carsten Fuchs
Hi Richard, Am 27.02.2017 um 04:01 schrieb Richard Belew: {%url 'djggApp/guest'guest.guestId 'update'%} but this generates a /NoReverseMatch/ error /Reverse for 'djggApp/guest' with arguments '(1, u'update')' and keyword arguments '{}' not found. 0 pattern(s) tried: []/ In the {% url %}, yo

Run model check with Django 1.11 as deployment check only?

2017-04-10 Thread Carsten Fuchs
Dear Django group, with Django 1.10, I used a model check like this: class Status(models.Model): id = models.AutoField(primary_key=True) MAX_ID = 38 text = models.CharField(max_length=20, blank=True) @classmethod def check(cls, **kwargs): errors = super(Status

Re: Run model check with Django 1.11 as deployment check only?

2017-04-10 Thread Carsten Fuchs
Hi Matthew, Am 10.04.2017 um 15:51 schrieb Matthew Pava: I would argue that your code should be able to run successfully with an empty database. I would change your assignment of maxID to this: maxID = cls.objects.aggregate(Max('id'))['id__max'] or 0 Normally, I would happily agree. However,

Problem with views PasswordChangeView vs. password_change

2017-07-12 Thread Carsten Fuchs
Dear Django group, using Django 1.11.3 with Python 2.7, please consider the following test: def test_passwort_aendern(self): u = User.objects.create_user("Test", "t...@example.com", "Passwort") self.client.force_login(u) response = self.client.post("/change_passwor

Re: Problem with views PasswordChangeView vs. password_change

2017-07-13 Thread Carsten Fuchs
Am 13.07.2017 um 16:56 schrieb Carsten Fuchs: the success_url='lori:pwd_done' seems to be a problem This seems to be the root also of the original problem (SuspiciousOperation…): If I insert a plain URL, e.g. success_url='/pwd_done/', then I can no longer reproduce

Re: Problem with views PasswordChangeView vs. password_change

2017-07-14 Thread Carsten Fuchs
Am 13.07.2017 um 22:44 schrieb Tim Graham: The success_url of PasswordChangeView (actually the behavior comes from the inherited FormView) only accepts a URL, not a URL name. You can update to your code like this: from django.urls import reverse_lazy ... success_url=reverse_lazy('lori:pwd_done')

Re: Django user model. 1 admin account, 1 customer account with the same email and different password

2020-04-13 Thread Carsten Fuchs
Hello, Am 13.04.20 um 02:59 schrieb Kenny Soh: > * An admin account must not share the same password as the customer account. Your entire problem would become much easier if you just dropped that requirement. Whatever you want to achieve with forcing a single user to keep two passwords, I'm s

Formset questions: data vs. initial values

2015-09-07 Thread Carsten Fuchs
Dear Django group, after having read all of the Django docs that I could find, I still have two questions about the proper use of formsets. Summary first: 1. What is a good way to make sure the data received in the POST request agrees with the "initial" data (number of items and items order

Re: Advanced Annotate

2015-09-16 Thread Carsten Fuchs
Hi Paolo, Am 15.09.2015 um 00:32 schrieb Paolo C.: How can obtain details from the last comment when listing ll posts? If I understood your question correctly -- I recently had the same question, see https://groups.google.com/d/msg/django-users/adRe2_BWMz0/G71BVUEI_7oJ for details. It seems

Re: Advanced Annotate

2015-09-17 Thread Carsten Fuchs
Hi Paolo, Am 16.09.2015 um 22:52 schrieb Paolo C.: [...], I need to annotate not only the price but also which is the book that has that max value. Isn't that exactly what I was wondering about, too? "1) Is there a way to annotate each Store object with the actual Book objects related to th

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

2015-09-29 Thread Carsten Fuchs
Hi John, Am 28.09.2015 um 15:54 schrieb John Lucas: So - is my approach safe? Or will there be complications down the line? I've recently had a similar / the same question. See this thread, which also contains the solution that worked very well for me: http://thread.gmane.org/gmane.comp.pyth

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

2015-10-03 Thread Carsten Fuchs
Am 2015-10-02 um 23:28 schrieb John Lucas: Thanks for the replies. Carsten - that link is broken for me unfortunately. Sorry, this seems to be a problem with gmane. The same thread at Google groups is here: https://groups.google.com/d/msg/django-users/K0X8P3s3DOw/cH5PDxYjLtYJ Best regards, Ca

Re: Formset questions: data vs. initial values

2015-10-06 Thread Carsten Fuchs
Anyone please? Best regards, Carsten Am 07.09.2015 um 21:18 schrieb Carsten Fuchs: Dear Django group, after having read all of the Django docs that I could find, I still have two questions about the proper use of formsets. Summary first: 1. What is a good way to make sure the data

Re: Formset questions: data vs. initial values

2015-10-08 Thread Carsten Fuchs
Hi Shawn, many thanks for your reply. Am 07.10.2015 um 15:54 schrieb Shawn Milochik: You /can/ use ModelForms for this. You don't need an active instance. Thanks, I'll definitively check this out! However, using a ModelForm wastes performance when the POST request is processed, doesn't it?

formset concurrency control

2015-10-08 Thread Carsten Fuchs
Dear Django fellows, as far as I understand this, there seem to be two kinds of concurrency control: - the one that occurs between request and save, as addressed by e.g. [1] and [2], - the one that occurs between GET request and POST request, especially with formsets. I'm currently trying

Re: formset concurrency control

2015-10-08 Thread Carsten Fuchs
Hi Daniel, Am 08.10.2015 um 18:48 schrieb Daniel Roseman: Can you explain further why you think the pk is not sufficient? Ordering by name, or adding and removing entities, does not change the pk of other entities; indeed that's the whole point of a pk. What exactly are you concerned about?

Re: formset concurrency control

2015-10-09 Thread Carsten Fuchs
Hi Tim, Am 08.10.2015 um 21:03 schrieb Tim Graham: I think the problem is also described in https://code.djangoproject.com/ticket/15574. Probably if we had a simple solution, that ticket wouldn't be open for 5 years. :-) :-) Yes, having read all of it, I too think that #15574 describes the

Re: If appears doesn't work in template, why?

2015-10-14 Thread Carsten Fuchs
Am 14.10.2015 um 13:36 schrieb Fellipe Henrique: But, always enter in "else"... even the record was saved with "A"... I tried with 'A' and "A", same "problem"... Any ideas, what's going on? Have you cross-checked? I.e., what is the output of {{ status }} ? Best regards, Carsten -- You recei

Re: Reverse access model through a “double” ForeignKey

2015-10-14 Thread Carsten Fuchs
Am 14.10.2015 um 11:11 schrieb Gergely Polonkai: This setup, though, doesn’t feel right, as it contains redundancy. Is there a way to access the list of Values directly from Build without having this redundancy? Well, you can filter your Value queryset by Build, see https://docs.djangoproject.

Re: Locking / serializing access to one element in database

2015-10-22 Thread Carsten Fuchs
Am 22.10.2015 um 01:16 schrieb Simon Charette: I would suggest you use select_for_update() in a transaction. This only covers the case where the object with the given ID already exists, doesn't it? That is, if a

Re: Locking / serializing access to one element in database

2015-10-28 Thread Carsten Fuchs
Hi Collin, hi all, Am 27.10.2015 um 19:56 schrieb Collin Anderson: Yes, an exception will be raised. Thinking further about this, all we need is a method that gives us an exception if we accidentally create a second object when in fact only one is wanted. Your suggestion with manually dealin

Re: formset concurrency control

2015-10-29 Thread Carsten Fuchs
Hi all, continuing my previous post, I've implemented most of the ideas mentioned in this thread now, and would like, for completeness and future reference, add some related findings and thoughts: As mentioned in my previous post, reconstructing the formset's initial data (the queryset) in t

Re: update_or_create() always creates (or recreates)

2015-11-05 Thread Carsten Fuchs
Hi Yunti, Am 05.11.2015 um 18:19 schrieb Yunti: I have tried to use the update_or_create() method assuming that it would either, create a new entry in the db if it found none or update an existing one if it found one and had differences to the defaults passed in - or wouldn't update if there

Re: Locking / serializing access to one element in database

2015-11-05 Thread Carsten Fuchs
Hi Collin, Am 05.11.2015 um 16:36 schrieb Collin Anderson: If you're just updating one field, this _might_ work for you: Why just one? | try: TestMonthModel.objects.create(jahr=Jahr,monat=Monat)# create() uses force_insert. exceptIntegrityError: pass # It already exists. No Proble

Re: Problem with appending slash at the end of the url

2015-12-07 Thread Carsten Fuchs
Hello, Am 07.12.2015 um 13:37 schrieb Dongwon Kang: I don't know even it's a problem, but anyway, I just updated django 1.8.7 to django 1.9 and found application isn't working. I found out django wasn't redirecting not-slashed url. it returns 500 error if slash hadn't been at the end of the u

Re: Django for Data Tables to group by when coloumn hidden

2015-12-10 Thread Carsten Fuchs
Hi Sid, if with Data Tables you are in fact referring to http://datatables.net/, then you should put your questions with the folks over there. I guess what you want is possible with DataTables (I haven't checked), but be prepared for some customization with JavaScript being required. If you

Re: How to learn Django stepwise Effectively

2016-01-21 Thread Carsten Fuchs
Hi Andrew, Am 20.01.2016 um 15:31 schrieb Andrew Pinkham: There are many resources for learning Django (NB: this email assumes you’re not looking to learn Python). Thank you very much for assembling this list, it's very much appreciated! I knew many of these resources, but certainly not all.

Prepopulate blog in b.entry_set.all()[i].blog ?

2018-10-11 Thread Carsten Fuchs
Dear Django group, with Django 1.11.15, using the example models Blog and Entry at for reference, I have code like this: b = Blog.objects.get(name="...") for e in b.entry_set.all(): print(e.blog) Obvio

Re: Prepopulate blog in b.entry_set.all()[i].blog ?

2018-10-20 Thread Carsten Fuchs
Can anyone help please? Am 2018-10-11 um 16:58 schrieb Carsten Fuchs: Dear Django group, with Django 1.11.15, using the example models Blog and Entry at <https://docs.djangoproject.com/en/2.1/topics/db/queries/#related-objects> for reference, I have code like this:

Template filter {{ value|date:"M" }} in Python

2018-11-06 Thread Carsten Fuchs
Hello, complementing template filters, sometimes it is necessary to format dates also in Python code, that is, achieve the equivalent to {{ value|date:"M" }} For this, I'm using from django.utils import dateformat dateformat.format(value, "M") (This works in Django views and in

Re: difference between class based view and function based view

2018-11-22 Thread Carsten Fuchs
Hi Andrew, many thanks for your clear and detailed explanation! Having used Django for several years, FVs are still my favorite approach over CBVs and GCBVs. In the past, I made several starts with CBVs, but never found or understood why CBVs and GCBVs seem to be in many people's center of at

Re: How to hide the password of postgresql in settings.py

2018-11-30 Thread Carsten Fuchs
Am 30.11.18 um 18:50 schrieb Sandip Nath: I am a newbie to Django. Using Postgresql for CRUD operations. Although its working but I need to write the password of my Postgresql server in the settings.py. How can I hide that without hampering the operation? In your settings.py, you could write

Re: best way to generate PDFs in django - handling concurrency

2018-12-27 Thread Carsten Fuchs
ps.google.com/d/msgid/django-users/9f06d9aa-7d89-4700-8cd0-9ae3343b3128%40googlegroups.com > > <https://groups.google.com/d/msgid/django-users/9f06d9aa-7d89-4700-8cd0-9ae3343b3128%40googlegroups.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups

Tests: How to messages.add_message() before self.client.get() ?

2020-11-09 Thread Carsten Fuchs
Dear group, in my tests I would like to test the processing of messages in the view. For example: def test_is_message_properly_handled(self): # The problem: We have no `request` here! messages.info(request, 'Hello') response = self.client.get("/handling-messages-view/

Re: Tests: How to messages.add_message() before self.client.get() ?

2020-11-13 Thread Carsten Fuchs
used by the messages framework.  If it is set to session, then you'll need > to obtain a session from the client and stick it onto your request object if > you want that to persist through your subsequent test requests. > > HTH /d > >> On 10 Nov 2020, at 18:41, Carste

Re: Good Django libraries to read to really understand class-based views?

2021-01-12 Thread Carsten Fuchs
Dear Robert, I recommend you consider https://spookylukey.github.io/django-views-the-right-way/ Best regards, Carsten Am 11.01.21 um 16:14 schrieb Robert F.: > Are there any Django libraries that make extensive use of class-based views > that I might study if I want to gain an in-depth unders

Re: Changing to a custom user model mid-project

2019-12-26 Thread Carsten Fuchs
Hello Mike, unfortunately I cannot answer your questions, but have you considered contacting Tobias directly? I too am currently at the point of switching two of my projects to a custom user model. But honestly, Tobias' procedure looks complicated and error prone to me. Aymeric's description d

Re: About extending the django inbuilt user

2020-01-14 Thread Carsten Fuchs
Besides what others have said, I suggest you have a look at https://docs.djangoproject.com/en/3.0/topics/auth/customizing/#extending-the-existing-user-model and all subsequent sections. If you have not started your project yet (have no migrations yet), look at https://github.com/jambonsw/django-im

Re: Is a Custom User Model worth the headache?

2020-02-14 Thread Carsten Fuchs
Am 14.02.20 um 09:03 schrieb Mike Dewhirst: > Definitely start a new project with a custom user and I would consider > aborting an existing project to restart with a custom user if it was started > with the standard user. Which may not be possible for large, existing projects. Switching to a cu

Re: Is a Custom User Model worth the headache?

2020-02-15 Thread Carsten Fuchs
Hi Mike, Am 2020-02-14 um 23:30 schrieb Mike Dewhirst: > In your documentation you mention "from accounts.models import User" > > I have been maybe taking things too literally. After migrating to my custom > user I have used "from django.contrib.auth import get_user_model" followed by > "User =

<    1   2