date_hierarchy with datetime field stored in another model

2011-02-24 Thread Marc Aymerich
Hi, I want to provide an admin date_hierarchy filter for a model that actually doesn't have a datetime field itself. The datetime value for each object is stored in another model. It's possible to define a date_hierarchy filter in this scenario? I've tried to use date_hierarchy with a property tha

eval if an object meets with a queryset.

2011-03-01 Thread Marc Aymerich
Hi!, I have a model class like this one: class Domain(models.Model): active = models.BooleanField() root = models.CharField(max_length=6) now given a Domain instance I need to know if it meets with an expresion like this one: active=True and (root='com' or root='net') one way to do that

Re: eval if an object meets with a queryset.

2011-03-01 Thread Marc Aymerich
On Tue, Mar 1, 2011 at 11:55 AM, Marc Aymerich wrote: > Hi!, > I have a model class like this one: > > class Domain(models.Model): >    active = models.BooleanField() >    root = models.CharField(max_length=6) > > now given a Domain instance I need to know if it meets

Re: eval if an object meets with a queryset.

2011-03-01 Thread Marc Aymerich
On Tue, Mar 1, 2011 at 12:02 PM, Daniel Hilton wrote: > On 1 March 2011 10:55, Marc Aymerich wrote: >> Hi!, >> I have a model class like this one: >> >> class Domain(models.Model): >>    active = models.BooleanField() >>    root = models.CharField(max_leng

Re: eval if an object meets with a queryset.

2011-03-01 Thread Marc Aymerich
On Tue, Mar 1, 2011 at 12:19 PM, Masklinn wrote: > On 2011-03-01, at 12:11 , Marc Aymerich wrote: >> On Tue, Mar 1, 2011 at 12:02 PM, Daniel Hilton >> wrote: >>> On 1 March 2011 10:55, Marc Aymerich wrote: >>>> Hi!, >>>> I have a model class li

Re: eval if an object meets with a queryset.

2011-03-01 Thread Marc Aymerich
On Tue, Mar 1, 2011 at 1:46 PM, Masklinn wrote: > On 2011-03-01, at 13:18 , Marc Aymerich wrote: >> >> Hi Masklinn, I never use jquey's :( > Not a problem. The .is method simply takes a CSS selector and returns a > boolean flag indicating whether the selected ob

Re: eval if an object meets with a queryset.

2011-03-01 Thread Marc Aymerich
On Tue, Mar 1, 2011 at 2:07 PM, Marc Aymerich wrote: > On Tue, Mar 1, 2011 at 1:46 PM, Masklinn wrote: >> On 2011-03-01, at 13:18 , Marc Aymerich wrote: >>> >>> Hi Masklinn, I never use jquey's :( >> Not a problem. The .is method simply takes a CSS s

How to know when an admin form is completly saved to DB?

2011-03-04 Thread Marc Aymerich
Hi, I have an admin class with some arbitrary number of inline forms. I want to make some stuff when all the inlines are successfully saved. How can I do that? admin executes something else after save_model ?? Thanks!! -- Marc -- You received this message because you are subscribed to the Goog

Re: How to know when an admin form is completly saved to DB?

2011-03-05 Thread Marc Aymerich
On Fri, Mar 4, 2011 at 3:09 PM, Marc Aymerich wrote: > Hi, > I have an admin class with some arbitrary number of inline forms. I > want to make some stuff when all the inlines are successfully saved. > How can I do that? admin executes something else after save_model ?? > A

Re: How to know when an admin form is completly saved to DB?

2011-03-05 Thread Marc Aymerich
On Sat, Mar 5, 2011 at 12:55 PM, Sithembewena Lloyd Dube wrote: > I tink you could also go as follows: > > my_object = form.save() > if my_object: >     do_something() Yep, but I'm using django admin so I can't do that without refactor admin add_view, change_view and change_list_view ModelAdmin

Django inlines with custom form ignores excluded fields?

2011-03-08 Thread Marc Aymerich
HI, I want to use a custom form for one of my admin inlines, but unfortunatly I'm not able to exclude some fields. Seems that GenericStackedInline ignores whatever I put on ModelForm.Meta.exclude. Is this a normal behaviour? or it's a bug? My test classes: class Mon(ModelForm): class Meta:

Insert an "editable" extra field on admin change list.

2011-03-10 Thread Marc Aymerich
Hi, I spend all day trying to figure out how to insert an "editable" extra field (not a model field) in admin change list. Is there an easy way to do that? Thanks! -- Marc -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, s

Re: admin cannot edit records with 'add' as primary key

2011-04-03 Thread Marc Aymerich
On Fri, Apr 1, 2011 at 8:39 PM, Marwan Al-Sabbagh < marwan.alsabb...@gmail.com> wrote: > Hi, > just wanted to confirm that this is a bug before posting it on > tracker. Any comments are welcome it will be my first bug report on > django :) > > Problem > > If you have a model with a pri

Running middleware within ATOMIC_REQUESTS transaction

2015-03-10 Thread Marc Aymerich
Hi, I have a middleware that performs some operations at the end of each request. What I have found is that middlewares do not run inside the ATOMIC_REQUESTS transaction. But I want the ATOMIC_REQUESTS transaction to rollback if an exception is being raised on my middleware. Any idea on how to so

Re: Running middleware within ATOMIC_REQUESTS transaction

2015-03-10 Thread Marc Aymerich
On Tue, Mar 10, 2015 at 5:12 PM, Marc Aymerich wrote: > Hi, > I have a middleware that performs some operations at the end of each > request. > > What I have found is that middlewares do not run inside the > ATOMIC_REQUESTS transaction. But I want the ATOMIC_REQUESTS transactio

Re: Running middleware within ATOMIC_REQUESTS transaction

2015-03-10 Thread Marc Aymerich
On Tue, Mar 10, 2015 at 5:15 PM, Marc Aymerich wrote: > > > On Tue, Mar 10, 2015 at 5:12 PM, Marc Aymerich > wrote: > >> Hi, >> I have a middleware that performs some operations at the end of each >> request. >> >> What I have found is that middlew

Re: Running middleware within ATOMIC_REQUESTS transaction

2015-03-12 Thread Marc Aymerich
On Tue, Mar 10, 2015 at 5:38 PM, Marc Aymerich wrote: > > > On Tue, Mar 10, 2015 at 5:15 PM, Marc Aymerich > wrote: > >> >> >> On Tue, Mar 10, 2015 at 5:12 PM, Marc Aymerich >> wrote: >> >>> Hi, >>> I have a middleware that perfor

Re: [ANNOUNCE] Django 1.8 released

2015-04-03 Thread Marc Aymerich
On Wed, Apr 1, 2015 at 10:46 PM, Tim Graham wrote: > Django 1.8, the next long-term support release, is now available: > > https://www.djangoproject.com/weblog/2015/apr/01/release-18-final/ > > With the release of Django 1.8, Django 1.6 has reached end-of-life. As > such, Django 1.6.11 is the fin

Ensure an object is saved even when the atomic bock rollsback

2015-05-08 Thread Marc Aymerich
HI, I'm using atomic requests, but one of my views needs to save a model regardless of wheter the current transaction rolls back or not. I'm confused about how to proceed with the current autocommit behaviour. Do I need to use a different db connection? or perhaps there is some way of telling dja

Re: Ensure an object is saved even when the atomic bock rollsback

2015-05-08 Thread Marc Aymerich
On Fri, May 8, 2015 at 5:50 PM, Carl Meyer wrote: > Hi Marc, > > On 05/08/2015 07:15 AM, Marc Aymerich wrote: > > I'm using atomic requests, but one of my views needs to save a model > > regardless of wheter the current transaction rolls back or not. > > >

Re: Ensure an object is saved even when the atomic bock rollsback

2015-05-08 Thread Marc Aymerich
On Fri, May 8, 2015 at 6:43 PM, Marc Aymerich wrote: > > > On Fri, May 8, 2015 at 5:50 PM, Carl Meyer wrote: > >> Hi Marc, >> >> On 05/08/2015 07:15 AM, Marc Aymerich wrote: >> > I'm using atomic requests, but one of my views needs to save a

Re: What is the ideal web server to use with Django?

2015-05-14 Thread Marc Aymerich
On Thu, May 14, 2015 at 11:26 AM, Tom Evans wrote: > > On Thu, May 14, 2015 at 4:36 AM, reduxionist > wrote: > > The question you asked Tom was "Doesn't Apache create new process for each > > request [thus eating memory when serving large amounts of static files > > during traffic peaks]?", and

Re: What is the ideal web server to use with Django?

2015-05-15 Thread Marc Aymerich
On Fri, May 15, 2015 at 10:33 AM, Tom Evans wrote: > On Thu, May 14, 2015 at 4:18 PM, Marc Aymerich wrote: >> On Thu, May 14, 2015 at 11:26 AM, Tom Evans wrote: >>> On our app servers we typically use Apache with worker MPM and >>> mod_wsgi, although we have a few ngi

Annotations with nested Sums

2015-07-10 Thread Marc Aymerich
Hi, I need to do some annotations that require a nested sumation, I have Bills that have Lines that in turn have Sublines: Bill -> Line -> SubLine In order to calculate the total bill price I need to add all sublines of every line, and then all lines of a bill. queryset.annotate( total=Sum(F('

django.core.exceptions.AppRegistryNotReady

2014-07-08 Thread Marc Aymerich
Hi, Wanted to try 1.7 and I'm hit by an exception that don't know how to solve :) running current 1.7.x branch, here full runserver output: orchestra@orchestra:~/panel$ python manage.py runserver 0.0.0.0: /usr/local/lib/python2.7/dist-packages/djcelery/managers.py:77: RemovedInDjango18Warning

Re: django.core.exceptions.AppRegistryNotReady

2014-07-08 Thread Marc Aymerich
On Tue, Jul 8, 2014 at 12:54 PM, Frank Bieniek < frank.bien...@produktlaunch.de> wrote: > Hi Marc, > > this should fix it: > > File "/home/orchestra/django-orchestra/orchestra/apps/accounts/models.py", >> line 9, in Account >> user = models.OneToOneField(get_user_model(), >> related_name='acc

AppConfig where to execute initialization queries?

2014-10-06 Thread Marc Aymerich
Hi, I have been bitten by unexpected behaviors when running tests because on AppConfig.ready() I was initializing some stuff that depends on DB stored data. Reading the django docs I've found a warning that specifically suggests not to do this [1]. But then I wonder where this kind of initializatio

Re: Python: Assign variable in if statement?

2014-11-30 Thread Marc Aymerich
On Sun, Nov 30, 2014 at 12:30 PM, ThomasTheDjangoFan wrote: > Hi guys, > > coming from php I am wondering if there is a way to do something like this > in Python/Django: > > if variable = get_a_value_from_function(): > new_stuff = variable > > Of course I can use > > variable = get_a_value_from_

Re: Django ORM & DB backend coupling

2013-12-24 Thread Marc Aymerich
On Tue, Dec 24, 2013 at 4:15 PM, Rakan Alhneiti wrote: > Hello all, > > I was discussing the topic with a couple of my friends that Django's ORM is > / is not tightly coupled with databases in general. My point of view was > that django is not tightly coupled because you can write custom DB backen

Re: Django ORM & DB backend coupling

2013-12-24 Thread Marc Aymerich
On Tue, Dec 24, 2013 at 4:15 PM, Rakan Alhneiti wrote: > Hello all, > > I was discussing the topic with a couple of my friends that Django's ORM is > / is not tightly coupled with databases in general. My point of view was > that django is not tightly coupled because you can write custom DB backen

AssertionError: u'ns.example.com.' == 'ns.example.com.' ?

2014-02-12 Thread Marc Aymerich
I'm running my Django app tests and I'm getting a random and very annoying assertion error == FAIL: test_rest_dns_delete (orchestra.apps.dns.zones.tests.functional_tests.tests.RESTBind9MasterBackendTest) --

Re: AssertionError: u'ns.example.com.' == 'ns.example.com.' ?

2014-02-12 Thread Marc Aymerich
On Wed, Feb 12, 2014 at 8:01 PM, Larry Martell wrote: > On Wed, Feb 12, 2014 at 1:56 PM, Marc Aymerich wrote: >> I'm running my Django app tests and I'm getting a random and very >> annoying assertion error >> >> =

Annotate concat() of two fields

2014-03-29 Thread Marc Aymerich
Hi, I want to annotate the concatenation of two string fields, something like Domain.objects.annotate(annotation=F('field1')+F('field2')) however it is not possible to use F expressions on annotate(). I'm trying to accomplish the same thing using extra() however I don't know how to do it right,

Re: Inlines in admin

2014-04-07 Thread Marc Aymerich
On Mon, Apr 7, 2014 at 3:04 PM, Emanuel wrote: > Hi all! > > I'm have the following models: > > Class A(models.Model): > pass > > > Class Z(models.Model): > pass > > > Class B(models.Model): > a = models.ForeignKey(a) > z = models.ForeignKey(Z) > >def __unicode__(self)

Re: Does imports of related models affect cascade deletion?

2015-07-30 Thread Marc Aymerich
On Thu, Jul 30, 2015 at 3:38 PM, Markus Amalthea Magnuson wrote: > Hey, > > I stumbled upon a piece of code and a comment that says this: > > Deleting a model object that has related objects will only cascade delete > those objects if their models have been imported. > > Is this true? I have not f

<    1   2   3