Extra data for form(set) display?

2012-03-02 Thread Carsten Fuchs
Hi all, using a formset with a large number of forms, I would like to add "extra data" to each of the forms that I can render in the template as read-only info near the fields of the related form. For example, let's assume we have a formset with one form for each day in the month, and each

Field.localize=True effective only if USE_L10N=True as well?

2012-03-05 Thread Carsten Fuchs
Hi all, using Django 1.3, in a form like class SomeForm(forms.Form): Stunden = forms.DecimalField(localize=True, ...) it seems that localize=True is only effective if in the settings.py USE_L10N = True as well. Is that correct? Many thanks and best regards, Carsten -- Cafu - the

Tree hierarchy with prefetch_related()?

2012-05-14 Thread Carsten Fuchs
Dear Django group, I've never worked with hierarchic database models before, and would be very grateful for your advice: In my application I need a hierarchy of objects, e.g. class Account(models.Model): parent = models.ForeignKey('self', null=True, blank=True) name =

Re: Tree hierarchy with prefetch_related()?

2012-05-15 Thread Carsten Fuchs
Dear Russell, thank you very much for your reply, with all the background info and details! It was very helpful! :-D Best regards, Carsten Am 15.05.2012 01:45, schrieb Russell Keith-Magee: On Tue, May 15, 2012 at 1:20 AM, Carsten Fuchs<carsten.fu...@cafu.de> wrote: Dear Django

How to implement clean() for a model with ManyToMany fields?

2012-10-29 Thread Carsten Fuchs
Hi all, using Django 1.3.1, I use a model like this: class KalenderEintrag(models.Model): id = models.AutoField(primary_key=True) von = models.DateField(verbose_name=u"\u200Bvon") bis = models.DateField(verbose_name=u"\u200Bbis") text =

Re: How to implement clean() for a model with ManyToMany fields?

2012-10-30 Thread Carsten Fuchs
Hi Martin, thank you very much for your very clear and prompt help! :-) Best regards, Carsten Am 29.10.2012 20:15, schrieb Martin J. Laubach: Basically, you can't. M2m fields are saved after the model is saved, so you either get objects that are not yet ready for that check (as you

How to implement pre-save operations for inlines in the admin interface?

2012-11-15 Thread Carsten Fuchs
Hi all, using Django 1.3 (soon 1.4), we use models like these: class Staff(models.Model): name = models.CharField(max_length=80) class Period(models.Model): staff = models.ForeignKey(Staff) begin = models.DateField() end = models.DateField(editable=False)# see below

Re: How to implement pre-save operations for inlines in the admin interface?

2012-11-15 Thread Carsten Fuchs
Hi Arnold, Am 15.11.2012 17:52, schrieb Arnold Krille: On Thursday 15 November 2012 17:12:09 Carsten Fuchs wrote: [...] (Note that it is not enough to consider the Period that changed -- rather, it is the 'end' in *another* period (the one "before" it) that must be modified and

Re: How to implement pre-save operations for inlines in the admin interface?

2012-11-16 Thread Carsten Fuchs
Hi Arnold, Am 15.11.2012 21:29, schrieb Arnold Krille: Even if you do not need it outside the admin-interface (in this project), from the logic this belongs to the model, not into some view. Thank you very much for your replies, and in this regard (that the logic would much better be kept in

Re: How to implement pre-save operations for inlines in the admin interface?

2012-11-16 Thread Carsten Fuchs
Am 16.11.2012 18:17, schrieb Martin J. Laubach: Don't overthink it. If believe you are likely to run into cascading recursive updates, then those cascades will happen no matter where you put the update. You will need to deal with it some way or another (locking, careful ordering, better

ModelAdmin.save_formset() questions

2012-11-19 Thread Carsten Fuchs
Hi all, after digging a bit deeper, it seems that ModelAdmin.save_formset() is the right solution for my original problem

Re: How to implement pre-save operations for inlines in the admin interface?

2012-11-20 Thread Carsten Fuchs
Just for info, to complete this: I read in the admin interface source code (contrib/admin/options.py) and found a solution myself. It's not as clear and straightforward as one would wish, but simple and robust: We now simply override the `ModelAdmin.save_formset()` function like this:

Re: ModelAdmin.save_formset() questions

2012-11-20 Thread Carsten Fuchs
Unfortunately, no replies here, but to tie the loose ends up: I found a solution that I posted in the thread of my original problem: https://groups.google.com/d/topic/django-users/ZwgW7-t6CBA/discussion Best regards, Carsten -- Cafu - the open-source Game and Graphics Engine for

select_for_update().get(...), what happens on DoesNotExist?

2012-12-12 Thread Carsten Fuchs
Dear Django group, we try to understand and solve a concurrency problem, and would kindly like to ask for your help. We use Django 1.4, and a model like this: class MonatsSalden(models.Model): id= models.AutoField(primary_key=True) key =

Re: select_for_update().get(...), what happens on DoesNotExist?

2012-12-13 Thread Carsten Fuchs
Hi Chris, thank you very much for your reply! Am 12.12.2012 22:42, schrieb Chris Cogdon: The question is going to be very database specific. "select for update" works by putting in row-level locks in the database. If the row does not exist, then it won't get a lock on it, and I know of no

Re: select_for_update().get(...), what happens on DoesNotExist?

2012-12-15 Thread Carsten Fuchs
Hi Chris, Am 2012-12-13 19:39, schrieb Chris Cogdon: This will depend on the problem, but let me site a simple example for how this is often solved. [...] I hope that gives you sufficient options. Yes, it does; I guess I'll just have to experiment with locking the "input" rows a bit. :-)

Python path in new 1.4 project structure?

2013-03-22 Thread Carsten Fuchs
I understood it above. Best regards, Carsten -- Dipl.-Inf. Carsten Fuchs Carsten Fuchs Software Industriegebiet 3, c/o Rofu, 55768 Hoppstädten-Weiersbach, Germany Internet: http://www.cafu.de | E-Mail: i...@cafu.de Cafu - the open-source game and graphics engine for multiplayer 3D actio

Re: Python path in new 1.4 project structure?

2013-03-25 Thread Carsten Fuchs
thanks for your help: I managed to get everything updated to all the best practices mentioned both in the Django tutorials and in the "Two Scoops of Django" book (all of which are excellently written). Best regards, Carsten -- Dipl.-Inf. Carsten Fuchs Carsten Fuchs Software Industr

Re: Django 1.5.1: ORA-01843: not a valid month

2013-04-10 Thread Carsten Fuchs
Am 10.04.2013 16:50, schrieb Carsten Fuchs: I consider downgrading to Django 1.4.5 on the affected system, as I'm unfortunately unsure how to best proceed with debugging and/or fixing this. I just found out that when we - downgrade cx_Oracle to 5.0.3, the problem does not occur

Re: Django 1.5.1: ORA-01843: not a valid month

2013-04-12 Thread Carsten Fuchs
Am 2013-04-10 17:21, schrieb Carsten Fuchs: So as was mentioned in the Stackoverflow post, this is likely a problem in cx_Oracle rather than Django... Well, I probably shouldn't have said this, because this problem did not occur with Django 1.4.x, and more importantly, I wonder what should

Problem with creating a one-to-one instance

2013-04-16 Thread Carsten Fuchs
Hi all, I'm probably overlooking something very simple, but still cannot explain what the code below does wrong: With these models: class Vorblendplan(models.Model): # ... pass class Mitarbeiter(models.Model): # ... vbp =

Django 1.5.1 and formsets with more than 1000 initials

2013-04-24 Thread Carsten Fuchs
Hi all, using Django 1.5.1, having read , I still have trouble creating a formset with more than 1000 initial forms: Following the example at that page, what I'd like to do is, with MyInitials

Re: Django 1.5.1 and formsets with more than 1000 initials

2013-04-25 Thread Carsten Fuchs
Hi Xavier, thank you very much for your reply! :) Am 25.04.2013 07:31, schrieb Xavier Ordoquy: I'm not sure whether the FormSet could extends itself this number if the initial_data is larger than 1000. If I understand the documentation correctly, the purpose of the `max_num` parameter is

Re: Problem with creating a one-to-one instance

2013-04-25 Thread Carsten Fuchs
Hi all, Am 16.04.2013 17:50, schrieb Carsten Fuchs: I'm probably overlooking something very simple, but still cannot explain what the code below does wrong: [...] >>> ma = Mitarbeiter.objects.get(key="F426") >>> ma.vbp # ok,

Re: Problem with creating a one-to-one instance

2013-04-25 Thread Carsten Fuchs
Hi Tom, Am 2013-04-25 18:53, schrieb Tom Evans: Yes, this is correct, when you assign an object to a foreign key, it must already be saved so that it has an id in order to persist in the database. It's very good to hear this, thank you very much for your reply! In 1.4, the check is not

Django 1.5.1: Sending HTML mails with Unicode string contents fails

2013-05-02 Thread Carsten Fuchs
Hi all, a while after upgrading from Django 1.4 to Django 1.5.1 (using Python 2.6.5), I realized that I no longer got any of the automatic e-mails that are normally sent when an error occurs. Then problem occurs only when HTML emails are sent, sending plain-text emails works without

Form constructor: Learn model instance for ModelChoiceField?

2013-05-03 Thread Carsten Fuchs
Hi all, is it possible to obtain the model instance for a ModelChoiceField in the constructor of the Form? Here is a short example that illustrates the problem: ~~ class Department(models.Model): pass class Staff(models.Model): departments =

Re: Form constructor: Learn model instance for ModelChoiceField?

2013-05-03 Thread Carsten Fuchs
Hi Mike, Am 2013-05-03 15:40, schrieb MikeKJ: have you checked out forms.ModelForm? from django.forms import ModelForm Thanks for your reply, but this seems not to be related to the problem? At least I cannot see how this could help. Best regards, Carsten -- You received this message

Update the parent model when a related (inline) model changed?

2011-08-25 Thread Carsten Fuchs
Dear Django list, what is the best way to automatically update a parent model when one of it's related models (i.e. the "inline" models in the admin interface) changed? Overall, we use a main model ("Employee") and several related models, one of which is a cache with monthly sums. The main

Re: Update the parent model when a related (inline) model changed?

2011-08-25 Thread Carsten Fuchs
Dear Shawn, Am 25.08.2011 16:22, schrieb Shawn Milochik: Use django-celery and call the update in the save() or with a post_save signal. That will work under all circumstances, admin or not, and occur asynchronously. Many thanks for your quick reply, but is there a way to achieve this with

Re: Update the parent model when a related (inline) model changed?

2011-08-30 Thread Carsten Fuchs
Hi all, many thanks to everyone who replied! For the records/archives, here is the solution that we eventually implemented: Am 25.08.2011 16:19, schrieb Carsten Fuchs: what is the best way to automatically update a parent model when one of it's related models (i.e. the "inline&qu

many-to-many queryset question

2011-12-06 Thread Carsten Fuchs
Hi all, looking at the example models Author and Entry at https://docs.djangoproject.com/en/1.3/topics/db/queries/, I would like to run a query like this: SetOfAuthors = Authors.objects.filter(...) qs = Entry.objects.filter(authors__in=SetOfAuthors) such that (pseudo-code):

How to get spanning relationships queryset right?

2012-01-03 Thread Carsten Fuchs
Hi all, reading , with the queryset Blog.objects.filter(entry__authors=123) I can find all blogs that have at least one entry that has the author with id 123 in its author set. However, in

Re: How to get spanning relationships queryset right?

2012-01-05 Thread Carsten Fuchs
Dear Javier, Am 03.01.2012 20:05, schrieb Javier Guerra Giraldez: On Tue, Jan 3, 2012 at 2:02 PM, Javier Guerra Giraldez <jav...@guerrag.com> wrote: On Tue, Jan 3, 2012 at 11:54 AM, Carsten Fuchs<carsten.fu...@cafu.de> wrote: How can I find only those blogs where *all* entr

Re: many-to-many queryset question

2012-01-07 Thread Carsten Fuchs
Hi Peter, Am 2012-01-07 03:40, schrieb Peter of the Norse: One possibility is to try two excludes. bad_authors = Authors.objects.exclude(pk__in=SetOfAuthors) qs = Entry.objects.exclude(authors__in=bad_authors) This will return all entries that don't have authors in SetOfAuthors. It might

Django ORM question about lookups that span relationships

2011-04-21 Thread Carsten Fuchs
Hi all, I'm currently reading . What I seem to understand is how I can find all blogs that have entries that - where published *sometime* before or at April 1st, - and have the word

Re: Django ORM question about lookups that span relationships

2011-04-26 Thread Carsten Fuchs
First of all, many thanks to everyone who replied in this thread, your posts were very interesting and helpful! On 24.04.2011 07:35, Alexander Schepanovski wrote: You can, with a subrequest: Blog.objects.filter(pk__in=Entry.objects.filter(pub_date__lte=date(2011, 4, 1),

Intermediate table with custom to_field?

2011-05-18 Thread Carsten Fuchs
Hi all, in a many-to-many relationship, I would like to use a custom to_field, like in this intermediate model definition: class MitarbeiterBereiche(models.Model): mitarbeiter = models.ForeignKey(Mitarbeiter, to_field='key') bereich = models.ForeignKey(Bereich) class Meta:

Re: Intermediate table with custom to_field?

2011-05-23 Thread Carsten Fuchs
Hi all, On 18.05.2011 18:10, Carsten Fuchs wrote: [...] The intention with this table is to exactly mimic the default intermediate table that Django would create when the keyword "through" is not used in the ManyToManyField statement (manually adding the UNIQUE(...) database

Accessing request.user in formset validation

2011-05-31 Thread Carsten Fuchs
Hi all, in some of my forms and formsets I need access to request.user in form validation. With an individual form, I pass request.user as a parameter to the constructor, using code like this: class ErfasseZeitraumForm(forms.Form): von= forms.DateField(widget=AdminDateWidget())

Re: Accessing request.user in formset validation

2011-05-31 Thread Carsten Fuchs
Hi Tom, wow, perfect!! A thousand thanks for your help and example code! :-D Best regards, Carsten -- Cafu - the open-source Game and Graphics Engine for multiplayer, cross-platform, real-time 3D Action Learn more at http://www.cafu.de -- You received this message because you

Re: Activating HTML error emails while keeping logger defaults

2011-06-30 Thread Carsten Fuchs
Dear Russel, Am 14.04.2011 14:13, schrieb Russell Keith-Magee: Duplicate the default Django logging settings, and update them as required. The defaults are contained in django/conf/global_settings.py Unfortunately, there isn't an elegant way to "use the default but just modify this one bit".

Custom formset validation: having a "save?" checkbox for each form

2010-11-08 Thread Carsten Fuchs
Hi all, my name is Carsten Fuchs, and this is my first post here. I'm normally a C++ developer for Windows and Linux desktop and server applications, and have begun my first (big) database-web project in mid summer. Let me start with saying that Django is utterly awesome: I've been able

Re: Custom formset validation: having a "save?" checkbox for each form

2010-11-09 Thread Carsten Fuchs
do it yourself: http://stackoverflow.com/questions/801912/how-to-put-timedelta-in-django-model Regards Knut On Mon, Nov 8, 2010 at 6:48 PM, Carsten Fuchs<carstenfu...@t-online.de> wrote: Hi all, my name is Carsten Fuchs, and this is my first post here. I'm normally a C++ developer for Windows an

list_filter doesn't appear for model with ForeignKey to auth.models.User

2010-11-23 Thread Carsten Fuchs
Hi all, developing my app with Django 1.2.1 and having completed large parts of the main functionality already, I've now started with familiarizing myself with user authentication. I understand that django.contrib.auth.models.User is best extended as described at

Re: list_filter doesn't appear for model with ForeignKey to auth.models.User

2010-11-24 Thread Carsten Fuchs
On 11/23/2010 08:37 PM, Carsten Fuchs wrote: none of the two list filters appears in the side bar (other filters that are similar but whose "target" model is not User work fine). Thus, my question is, is there something about model "User" that prevents it from being used wi

Re: www.djangoproject.com

2010-07-01 Thread Carsten Fuchs
Hi all, Am 01.07.2010 19:40, schrieb FC: I can't access www.djangoproject.com from Buenos Aires, Argentina. Firefox says: "The connection has timed out" Is anyone else having problems? I experience the same when I use Firefox under Ubuntu 10.04 (Lucid Lynx). Using Firefox under Windows or

Re: www.djangoproject.com

2010-07-12 Thread Carsten Fuchs
On 08.07.2010 17:12, Nick Raptis wrote: In firefox, check your preffered language settings, in the content tab. If there is a non-standard value there (perhaps "/etc/locale/prefs.conf" or something) instead of a locale like en-US, some django pages won't ever display. Many thanks also from

Django ORM query modelling question

2011-03-01 Thread Carsten Fuchs
Dear Django list, after a very good start with Django and it's excellent documentation, I've come now across a problem that neither my SQL nor my Django knowledge is sufficient to solve, so I'd like to ask for your kind help. The (simplified) Django model is class Erfasst(models.Model):

Re: Django ORM query modelling question

2011-03-02 Thread Carsten Fuchs
Hi Jirka, Am 01.03.2011 21:44, schrieb Jirka Vejrazka: this does not seem to me like something you would be able to do using SQL (or Django ORM) only. I would guess that you'll have to write a bit of Python code that will walk through the entries and detect those that are different from

Turning off USE_L10N more than doubled my site performance!

2011-03-23 Thread Carsten Fuchs
Dear Django folks, just an information that I would like to share (and be happy to hear some feedback): The users of my mod_wsgi hosted app reported bad performance in a large view that consists of a table of hundreds of rows and dozens of columns. I first used the Django Debug Toolbar to

Re: Turning off USE_L10N more than doubled my site performance!

2011-03-24 Thread Carsten Fuchs
Dear Russell, thank you very much for your reply! Am 24.03.2011 01:04, schrieb Russell Keith-Magee: Can you share your profiling data? Sure, gladly: with USE_L10N = True, ordered by internal time: http://pastebin.com/fkyF5nLw with USE_L10N = True, ordered by cumulated time, with callees:

Re: Turning off USE_L10N more than doubled my site performance!

2011-03-25 Thread Carsten Fuchs
Dear Karen, Am 25.03.2011 01:18, schrieb Karen Tracey: First, do you really mean USE_I18N everywhere where you have USE_L10N? The top cumtime item: ncalls tottime percall cumtime percall filename:lineno(function) 183330.7060.0004.3680.000

select_related() changes type of DecimalField?

2011-04-04 Thread Carsten Fuchs
Dear Django list, using Django 1.3 with Python 2.6.5 on Ubuntu 10.04 and mod_wsgi, with Oracle database, I've just experienced a case where the use of select_related() changes the result type of a DecimalField in a related object from decimal.Decimal to float (which in turn breaks my

Re: select_related() changes type of DecimalField?

2011-04-05 Thread Carsten Fuchs
Dear Ian, Am 04.04.2011 22:27, schrieb Ian: Yes, this appears to be a bug. If you would, please create a ticket for it in the Django Trac so that we don't forget about it. Gladly: http://code.djangoproject.com/ticket/15766 Best regards, Carsten -- Cafu - the open-source Game and

Activating HTML error emails while keeping logger defaults

2011-04-12 Thread Carsten Fuchs
Hi all, from the documentation at I get that I need something like LOGGING = { 'version': 1, 'handlers': { 'mail_admins': { 'level': 'ERROR', 'class': 'django.utils.log.AdminEmailHandler',

Re: Activating HTML error emails while keeping logger defaults

2011-04-14 Thread Carsten Fuchs
Am 14.04.2011 09:54, schrieb Jayakumar D K: pse.send more inf, on error finds html & finding of sent m,sg wether reachd to addrese or not how cn find Uh, sorry, I cannot parse this. Anyone? Many thanks and best regards, Carsten -- Cafu - the open-source Game and Graphics

More trouble with select_related()

2011-04-14 Thread Carsten Fuchs
Hi all, using Django 1.3 with Python 2.6.5 on Ubuntu 10.04 and mod_wsgi, with Oracle database, in addition to http://code.djangoproject.com/ticket/15766, I seem to have come over another problem with select_related(): The same queryset produces different results (number of returned

Re: Activating HTML error emails while keeping logger defaults

2011-04-14 Thread Carsten Fuchs
Am 14.04.2011 14:13, schrieb Russell Keith-Magee: Duplicate the default Django logging settings, and update them as required. The defaults are contained in django/conf/global_settings.py Thank you very much! :-) Best regards, Carsten -- Cafu - the open-source Game and Graphics Engine

Re: More trouble with select_related()

2011-04-14 Thread Carsten Fuchs
Dear Martin, Am 14.04.2011 15:26, schrieb Martin J. Laubach: Sounds like a join with a table that doesn't have all the rows. Let me guess: the tables have been filled by some other program and you are just reading them from Django -- and you are missing a blank=True, null=True on a ForeignKey

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

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,

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

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:

Migrating to initial migration: "ORA-00955: name is already used by an existing object"

2015-02-02 Thread Carsten Fuchs
Dear Django developers, in a Django project that was created pre-1.7, did not use South before, and was recently upgraded to Django 1.7 and is otherwise fine, I'm now trying to convert it to use migrations, following the docs at

Re: Migrating to initial migration: "ORA-00955: name is already used by an existing object"

2015-02-02 Thread Carsten Fuchs
Hi Markus, thanks for your reply! Am 02.02.2015 um 22:59 schrieb Markus Holtermann: Did you see the chapter at the end of the page you linked to: Upgrading from South: https://docs.djangoproject.com/en/1.7/topics/migrations/#upgrading-from-south Well, yes, but I'm *not* upgrading from

Re: Migrating to initial migration: "ORA-00955: name is already used by an existing object"

2015-02-03 Thread Carsten Fuchs
Hi all, Am 02.02.2015 um 22:50 schrieb Carsten Fuchs: It seems that creating the initial migrations with `makemigrations` works well, but the first run of `migrate` aborts with error "django.db.utils.DatabaseError: ORA-00955: name is already used by an existing object". Please se

Can migrated apps depend on unmigrated apps?

2015-02-04 Thread Carsten Fuchs
Dear Django developers, can apps that use migrations depend on unmigrated apps? The documentation at explains how dependencies work, and explicitly mentions that unmigrated apps cannot depend on migrated apps. In turn

Re: Can migrated apps depend on unmigrated apps?

2015-02-17 Thread Carsten Fuchs
Hi all, Am 04.02.2015 um 18:26 schrieb Carsten Fuchs: can apps that use migrations depend on unmigrated apps? Anyone please? It seems like this works in practice, but this still looks like a contradiction to me, and I would still be interested in some feedback for a firmer foundation

Re: Can migrated apps depend on unmigrated apps?

2015-02-17 Thread Carsten Fuchs
Hi Michael, Am 17.02.2015 um 22:44 schrieb Michael Pöhn: This is all covered in Djangos documentation... https://docs.djangoproject.com/en/1.7/topics/migrations/#dependencies Well, no... please see below. Let me paste the relevant parts for you: »Be aware, however, that unmigrated apps

Re: Can migrated apps depend on unmigrated apps?

2015-02-20 Thread Carsten Fuchs
Hi Collin, thank you very much for your reply! Am 19.02.2015 um 19:35 schrieb Collin Anderson: If you haven't yet, you could try generating migrations for the unmigrated app, and reference them using MIGRATION_MODULES. I've tried this, and my real problem is that I have problems with this

Re: Migrating to initial migration: "ORA-00955: name is already used by an existing object"

2015-02-20 Thread Carsten Fuchs
Hi all, another update: My developer system's local Oracle database content was created from importing a dump of a production database. On Monday night I'll have a chance to safely try to create and apply the initial migrations on the production database, rather than my dev system. Maybe

Re: [solved] Migrating to initial migration: "ORA-00955: name is already used by an existing object"

2015-02-24 Thread Carsten Fuchs
Hi all, it seems like I found the culprit, along with a simple solution: https://code.djangoproject.com/ticket/24407 :-) 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 receiving

Model field with default value and choices is always reported as changed, even if unchanged

2015-02-25 Thread Carsten Fuchs
Hi all, please consider this model definition: def PrevMonth(): h = date.today() return 12 if h.month == 1 else h.month-1 MONTHS_CHOICES = ( (1, "Januar"), (2, "Februar"), (3, "März"), (4, "April"), (5, "Mai"), (6, "Juni"), (7, "Juli"), (8, "August"), (9, "September"),

Re: Migrations force me to have, forever, any name/reference I use in field validators=, choices=, whatever, valid forever (even if the requirements change).

2015-02-26 Thread Carsten Fuchs
Hi all, Am 26.02.2015 um 13:54 schrieb Tim Graham: Yes, it's expected behavior. Please see the documentation on the topic: https://docs.djangoproject.com/en/stable/topics/migrations/#historical-models I have not yet tried this, but won't squashing migrations as a side effect also get us rid

Re: Model field with default value and choices is always reported as changed, even if unchanged

2015-02-26 Thread Carsten Fuchs
Hi, Am 25.02.2015 um 19:11 schrieb Carsten Fuchs: the parent model's History view claims that field "monat" of TestModel has been changed, I got at least a little bit further: This is easily reproducible in a minimal project/app test case with SQLite exactly as described in Djan

Re: Model field with default value and choices is always reported as changed, even if unchanged

2015-02-27 Thread Carsten Fuchs
Am 26.02.2015 um 19:06 schrieb Carsten Fuchs: The expected output is `False`,[...] Just for future reference, this is continued here: https://code.djangoproject.com/ticket/24428 Best regards, Carsten -- You received this message because you are subscribed to the Google Groups "Django

TemplateSyntaxError with {% cycle "Hello, how are you?" "Fine!" %}

2015-03-05 Thread Carsten Fuchs
Dear Django fellows, using Django 1.7.5, I have a problem with commas in string literals in the cycle tag, e.g. with {% cycle "Hello, how are you?" "Fine!" %}. Please consider (newlines added for clarity): $ ./manage.py shell >>> from django.template import * >>> t = Template('''{%

Re: TemplateSyntaxError with {% cycle "Hello, how are you?" "Fine!" %}

2015-03-05 Thread Carsten Fuchs
Hi Vijay, hi Alasdair, many thanks for your quick replies! I've thus just filed a bug: https://code.djangoproject.com/ticket/24451 Am 05.03.2015 um 17:53 schrieb Alasdair Nicol: I think the reason is that the cycle tag supports an older syntax for backwards compatibility reasons. Yes, that

annotate() questions

2015-04-08 Thread Carsten Fuchs
Dear Django fellows, at https://docs.djangoproject.com/en/1.8/topics/db/aggregation/#joins-and-aggregates the first example is: >>> from django.db.models import Max, Min >>> Store.objects.annotate(min_price=Min('books__price'), max_price=Max('books__price')) which will annotate each Store

Re: annotate() questions

2015-04-16 Thread Carsten Fuchs
Hello, Am 08.04.2015 um 20:07 schrieb Carsten Fuchs: 1) Is there a way to annotate each Store object with the actual Book objects related to the minimum and maximum prices? 2) Can this annotation be filtered? For example, if for each Store we wanted to learn the min and max prices

Re: annotate() questions

2015-04-17 Thread Carsten Fuchs
Hi Ramiro, Am 2015-04-16 um 19:30 schrieb Ramiro Morales: https://docs.djangoproject.com/en/1.8/topics/db/aggregation/#aggregations-and-other-queryset-clauses "...When used with an annotate() clause, a filter has the effect of constraining the objects for which an annotation is calculated. For

Cannot delete with overridden ModelAdmin.save_formset()

2015-04-20 Thread Carsten Fuchs
Dear Django fellows, I use a ModelAdmin.save_formset() method exactly like in the Django Admin documentation: https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_formset This is the exact code: def save_formset(self, request, form, formset,

Re: Cannot delete with overridden ModelAdmin.save_formset()

2015-04-20 Thread Carsten Fuchs
Hi all, Am 20.04.2015 um 15:29 schrieb Carsten Fuchs: I use a ModelAdmin.save_formset() method exactly like in the Django Admin documentation: https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_formset [...] The problem is, if I check the "d

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

2013-07-15 Thread Carsten Fuchs
tement, when I replace "LEFT OUTER JOIN" with "INNER JOIN" and manually run it, the result seems to be the same, but the query completes one hundred to several hundred times faster. So, from the above observations, I was wondering if the use of "LEFT OUTER JOIN" is

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

2013-07-24 Thread Carsten Fuchs
Hi all, Am 15.07.2013 17:41, schrieb Carsten Fuchs: we have two queries/QuerySets Q_a and Q_b, each of which use INNER joins in the generated SQL when evaluated individually. When I use a Q object to "OR" these two QuerySets, the INNER joins turn into LEFT OUTER joins -- which in

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

2013-07-25 Thread Carsten Fuchs
n edited query where INNER join is used instead, yield the same result tuple set A B C D E F G Or is my understanding of SQL basics that wrong? Best regards, Carsten -- Dipl.-Inf. Carsten Fuchs Carsten Fuchs Software Industriegebiet 3, c/o Rofu, 55768 Hoppstädten-Weiersbach, Ge

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

2013-07-26 Thread Carsten Fuchs
ly query...) Tom, many thanks for your help! Best regards, Carsten -- Dipl.-Inf. Carsten Fuchs Carsten Fuchs Software Industriegebiet 3, c/o Rofu, 55768 Hoppstädten-Weiersbach, Germany Internet: http://www.cafu.de | E-Mail: i...@cafu.de Cafu - the open-source game and graphics engine for mul

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

2013-07-29 Thread Carsten Fuchs
to take? Best regards, Carsten -- Dipl.-Inf. Carsten Fuchs Carsten Fuchs Software Industriegebiet 3, c/o Rofu, 55768 Hoppstädten-Weiersbach, Germany Internet: http://www.cafu.de | E-Mail: i...@cafu.de Cafu - the open-source game and graphics engine for multiplayer 3D action -- You received

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:

Re: annotate() questions

2015-04-24 Thread Carsten Fuchs
Am 17.04.2015 um 21:14 schrieb Carsten Fuchs: Now if only I knew how to obtain the actual book objects related to the min/max prices... Just for future reference, the best answer that I've found so far is: http://blog.roseman.org.uk/2010/08/14/getting-related-item-aggregate/ Best regards

Re: Fields outside Aggregation functions

2015-05-04 Thread Carsten Fuchs
Hi Alex, Am 04.05.2015 um 12:48 schrieb Alex-droid AD: So the question... How can I get records storemin/max price */_book ???_/* I recently had the same question, please see this thread: https://groups.google.com/forum/#!topic/django-users/adRe2_BWMz0 If you ever find a more direct

Re: Which is the best tutorial to learn django, djangobook.com or djangoproject.com?

2015-05-24 Thread Carsten Fuchs
Hi all, Am 2015-05-23 um 19:47 schrieb Daniel Roseman: On Saturday, 23 May 2015 18:17:15 UTC+1, Preeti wrote: Which is the best tutorial to learn django, djangobook.com or djangoproject.com ? Why do you even need to ask that question,

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

2015-07-16 Thread Carsten Fuchs
Dear Django fellows, using Django 1.8.3, in a fully migrated app I have a model with a many-to-many relationship like this: from django.db import models from django.contrib.auth.models import User class Bereich(models.Model): benutzer = models.ManyToManyField(User) Now I

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

2015-07-16 Thread Carsten Fuchs
Hi Gergely, many thanks for your quick reply! Am 2015-07-16 um 18:15 schrieb Gergely Polonkai: 1) create the "through" model, add it to the migration file 2) migrate all m2m instances (e.g. iterate over all Bereich objects then iterate through its users, creating a UserBereichAssignment object

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 remove th

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

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. To u

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

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

  1   2   >