Help with little complex queryset

2010-09-15 Thread Marc Aymerich
hi, I need some help here :), I have these models: class name(models.Model): member = models.ForeignKey(member, related_name="owner") class User(models.Model): member = models.ForeignKey(member) class VirtualHost(models.Model): member = models.ForeignKey(member) ServerName = models.ForeignK

passing queryset filter as GET argument on Admin

2010-09-17 Thread Marc Aymerich
Hi, recently I discover that is possible to pass queryset filters as GET argument: http://stackoverflow.com/questions/1652305/is-there-a-way-to-filter-a-queryset-in-the-django-admin/1652377#1652377 Unfortunately I'm not be able to do that trick on a TabularInline class :(, any idea?? Many thanks

How to avoid nested references

2010-09-23 Thread Marc Aymerich
Hi I'm trying to define two clases, one of them is a relational class between services and users, so it has two foreign keys, one to services and another to the user. On the other hand every service must have at least a default tariff, so it has a "pointer" to it. However, I'm not sure how to decla

Re: How to avoid nested references

2010-09-23 Thread Marc Aymerich
On Thu, Sep 23, 2010 at 7:37 PM, Daniel Roseman wrote: > On Sep 23, 6:26 pm, Marc Aymerich wrote: > > Hi > > I'm trying to define two clases, one of them is a relational class > between > > services and users, so it has two foreign keys, one to services and >

problem with saving a form

2010-09-26 Thread Marc Aymerich
I'm trying to make a ModelForm in order to edit an existing object of the class 'member'. So I followed this documentation: http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-save-method # Create a form to edit an existing Article. >>> a = Article.objects.get(pk=1) >>> f = Article

Re: problem with saving a form

2010-09-26 Thread Marc Aymerich
On Sun, Sep 26, 2010 at 8:51 PM, Marc Aymerich wrote: > I'm trying to make a ModelForm in order to edit an existing object of the > class 'member'. So I followed this documentation: > > > http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-save-method

Re: problem with saving a form

2010-09-26 Thread Marc Aymerich
On Sun, Sep 26, 2010 at 10:34 PM, Karen Tracey wrote: > On Sun, Sep 26, 2010 at 4:15 PM, Marc Aymerich wrote: > >> It seems that the condition request.method == 'POST' is never true :( >> whyy?? > > > What does the template that contains the form look

Re: problem with saving a form

2010-09-26 Thread Marc Aymerich
On Sun, Sep 26, 2010 at 10:15 PM, Marc Aymerich wrote: > > > On Sun, Sep 26, 2010 at 8:51 PM, Marc Aymerich wrote: > >> I'm trying to make a ModelForm in order to edit an existing object of the >> class 'member'. So I followed this documentation: >&g

Re: possible model relations?

2010-10-08 Thread Marc Aymerich
On Wed, Oct 6, 2010 at 9:20 PM, alecx wrote: > Hello, > I try to build a kind of call tracker app. The call intaker creates a > new item (main model) and makes some notes (subject, issue and which > printer nr, customer, technician,... all with modelfields) all in one > view. But I am struggling w

Re: Admin Many-to-Many on a regular Form?

2010-10-10 Thread Marc Aymerich
On Fri, Oct 8, 2010 at 7:58 PM, AK wrote: > I really like the 'filter-horizontal' style widget used by Django > Admin for things like specifying permissions for users/groups. I > would like to create a form that uses this same widget to allow > someone to select a group and then edit which users

distinct doesn't work on admin actions¿?

2010-10-12 Thread Marc Aymerich
Hi! I'm writing an action for the django admin site. My model looks like: class order(models.Model): entity = models.ForeignKey(entity) [...] I select an arbitrary number of orders and I need to know the different entities that they have. It works on shell: >>> queryset = order.objects.

reverse url of admin list

2010-10-12 Thread Marc Aymerich
I'm trying to find out what is the reverse url sentence for the "admin list" of a specific model of an app. Suppose that we have an app called 'invoice' and this has a model also called 'invoice'. I want to get this url: "/admin/invoice/invoice" via reverse function. Something like : >>> reverse('

Re: reverse url of admin list

2010-10-12 Thread Marc Aymerich
On Tue, Oct 12, 2010 at 7:46 PM, Sævar Öfjörð wrote: > It's called 'changelist' > > So you should call reverse('admin:invoice_invoice_changelist') > Wow Sævar, thank you very much! -- Marc -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: distinct doesn't work on admin actions¿?

2010-10-13 Thread Marc Aymerich
On Wed, Oct 13, 2010 at 3:57 AM, Karen Tracey wrote: > On Tue, Oct 12, 2010 at 6:31 AM, Marc Aymerich wrote: > >> I'm writing an action for the django admin site. My model looks like: >> >> class order(models.Model): >> entity = models.ForeignKey(entity

Re: Admin Many-to-Many on a regular Form?

2010-10-13 Thread Marc Aymerich
On Tue, Oct 12, 2010 at 10:12 PM, AK wrote: > I have not yet found a solution for this, the closest I've come > requires a bit of work based on James Bennett's response here: > http://markmail.org/message/irsln5d6m6wpxdiu > > An alternative that looks slicker than the Django built-in is the > dja

Help with Manager.

2010-10-14 Thread Marc Aymerich
Hi, I'm trying to make a Manager for my model "order". I want that it returns all orders that their 'active period'* is greater than a certain threshold. With "active period" I mean: (order.cancel_date - order.register_date ) My Order model looks like this: class order(models.Model): register

Re: Help with Manager.

2010-10-14 Thread Marc Aymerich
2010/10/14 Jonathan Barratt > On 14 ?.?. 2010, at 22:27, Marc Aymerich wrote: > > Hi, > I'm trying to make a Manager for my model "order". I want that it returns > all orders that their 'active period'* is greater than a certain threshold. > With

Re: Help with Manager.

2010-10-14 Thread Marc Aymerich
2010/10/14 Jonathan Barratt > On 14 ?.?. 2010, at 22:27, Marc Aymerich wrote: > > Hi, > I'm trying to make a Manager for my model "order". I want that it returns > all orders that their 'active period'* is greater than a certain threshold. > With

Re: Help with Manager.

2010-10-14 Thread Marc Aymerich
2010/10/14 Marc Aymerich > > > 2010/10/14 Jonathan Barratt > >> On 14 ?.?. 2010, at 22:27, Marc Aymerich wrote: >> >> Hi, >> I'm trying to make a Manager for my model "order". I want that it returns >> all orders that their 'active

Re: Help with Manager.

2010-10-14 Thread Marc Aymerich
On Thu, Oct 14, 2010 at 10:08 PM, Alec Shaner wrote: > See this: > > http://ifacethoughts.net/2009/07/14/calculated-fields-in-django/ > > So perhaps the 'extra' query filter is what you need. > > Yep, I got a success using extra filter :) Thanks Alec for sharing this! by the way, just right now

Re: Help with Manager.

2010-10-15 Thread Marc Aymerich
On Fri, Oct 15, 2010 at 3:39 AM, Alec Shaner wrote: > You can't add a datetime to another datetime - you want to add a > datetime.timedelta instance instead. Out of curiosity I just tested it > on one of my models and it does work, e.g., > > MyModel.objects.filter(update_date__gt=F('entry_date')+

F() and timedelta. Bug on django?

2010-10-15 Thread Marc Aymerich
This is a fork of this tread: http://groups.google.com/group/django-users/browse_thread/thread/5c6beb41fcf961a4 I'm getting troubles combining instances of F() and timedelta. I'm working with the very last trunk revision (14232), I create a very simple model for troubleshoting the problem, the mo

Re: F() and timedelta. Bug on django?

2010-10-15 Thread Marc Aymerich
On Fri, Oct 15, 2010 at 5:02 PM, Alec Shaner wrote: > It should be clarified that this occurs on the mysql backend, but not > the postgres backend. It has to do with how MySQL handles the DATETIME > object. You can't add a timedelta, because it expects a double. > > I created a test app using a m

Re: F() and timedelta. Bug on django?

2010-10-15 Thread Marc Aymerich
On Fri, Oct 15, 2010 at 5:02 PM, Alec Shaner wrote: > It should be clarified that this occurs on the mysql backend, but not > the postgres backend. It has to do with how MySQL handles the DATETIME > object. You can't add a timedelta, because it expects a double. > > I created a test app using a m

Re: F() and timedelta. Bug on django?

2010-10-15 Thread Marc Aymerich
On Fri, Oct 15, 2010 at 7:54 PM, Alec Shaner wrote: > On Fri, Oct 15, 2010 at 1:26 PM, Marc Aymerich > wrote: > > > > Instead of use datatime.timedelta I convert it to string with this > format: > > MMDDHHMMSS and now all works fine with mysql :) Unfortunat

Re: F() and timedelta. Bug on django?

2010-10-15 Thread Marc Aymerich
On Fri, Oct 15, 2010 at 9:37 PM, Alec Shaner wrote: > doh! Just noticed that you already referenced ticket 10154 in your > original post. Well, I referenced the patch that I found searching with google, but actually I didn't saw the ticket that it belongs to ;) On the ticket there is another

Re: Admin "Bulk Edit"?

2010-10-18 Thread Marc Aymerich
On Sun, Oct 17, 2010 at 9:54 PM, Ted wrote: > I was imagining more select a subset then have a bulk action like > delete. But, for this use case, list editable is sufficient. > You can create custom actions. http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/

Re: Efficient updates on ManyToMany Relations

2010-10-18 Thread Marc Aymerich
On Mon, Oct 18, 2010 at 6:31 PM, brix wrote: > Hello. > > Assume I have publications and authors. Like here: > http://www.djangoproject.com/documentation/models/many_to_many/ > > Now I want to add authors to more than just one publication. Lets say > 1000 or more publications. > > Is there a more

Re: Efficient updates on ManyToMany Relations

2010-10-18 Thread Marc Aymerich
On Mon, Oct 18, 2010 at 8:49 PM, Marc Aymerich wrote: > > > On Mon, Oct 18, 2010 at 6:31 PM, brix wrote: > >> Hello. >> >> Assume I have publications and authors. Like here: >> http://www.djangoproject.com/documentation/models/many_to_many/ >> >>

How django admin knows about related objects on delete?

2010-10-19 Thread Marc Aymerich
Hi! When we delete an object through admin bulk deletion, django deletes all related objects too. Now imagine that we have these models: class ModelBase(models.Model): pass class ModelA(models.Model): base = models.ForeignKey(ModelBase) class ModelB(models.Model): base = models.ForeignK

Re: How django admin knows about related objects on delete?

2010-10-19 Thread Marc Aymerich
On Tue, Oct 19, 2010 at 4:03 PM, Shawn Milochik wrote: > Check out your model's _meta.get_all_related_objects(). > > Explore that through the interactive interpreter and you'll find > everything you need. > Shawn, _meta.get_all_related_objects() is great :) Thank you very much for sharing this !

Re: help with model definition

2010-10-27 Thread Marc Aymerich
On Tue, Oct 26, 2010 at 6:21 PM, pixelcowboy wrote: > I have a question regarding the best way to conceptualize a model. I > have a tasks model, which I want to hook to a few different other > models: The model Project, the model Company and a few other undefined > models. The problem is that I wa

Executing ssh scripts with django

2010-10-31 Thread Marc Aymerich
Hi guys, I'm developing an ISP control panel for my organization. I just finished the web interface based on django admin and now it's time to introduce calls to the "system scripts" in order to make the changes effective on the ISP servers (add users, manage virtualhosts, domains, and all this stu

Re: Executing ssh scripts with django

2010-11-01 Thread Marc Aymerich
ual host, just run the "add_virtualhost" > operation again, but this time with updated data. > > You could also look into using a configuration management system, like > Chef. You could then have your system create Chef recipes. > > Regards > Knut > > On Sun, O

Why my model doesn't get saved?

2010-11-03 Thread Marc Aymerich
Hi, I have 2 abstract classes with an overrided save function, class BaseA and class BaseB. BaseA trigger the models.Model save function, the other doesn't. class BaseA(models.Model): class Meta: abstract = True def save(self, *args, **kwargs): super(BaseA, self).save(*arg

Re: Why my model doesn't get saved?

2010-11-04 Thread Marc Aymerich
On Wed, Nov 3, 2010 at 11:50 PM, Michael wrote: > nevermind my previous email, I see now you are talking about the test1 > class, which isn't abstract. > > In that case I assume the problem is Python's multiple inheritance, > where the first parent it finds with a save() method gets called, and no

Re: Why my model doesn't get saved?

2010-11-04 Thread Marc Aymerich
2010/11/4 Łukasz Rekucki > > On 3 November 2010 22:17, Marc Aymerich wrote: > > Hi, > > I have 2 abstract classes with an overrided save function, class BaseA and > > class BaseB. BaseA trigger the models.Model save function, the other > > doesn't. > >

Re: Why INSERT instead of UPDATE?

2010-11-07 Thread Marc Aymerich
On Sun, Nov 7, 2010 at 4:21 PM, Torbjorn wrote: > Hi, I want to update a record but somehow it becomes an INSERT > instead. This is my code: > > def editcourse(request, course_id): >    course= Course.objects.get(id=course_id) >    if request.method == 'POST': >        form = PartialCourseForm(req

Re: Excessive tmp table creation for mysql

2010-11-09 Thread Marc Aymerich
On Tue, Nov 9, 2010 at 7:49 PM, Nick wrote: > Yesterday I received a warning from our DB monitoring system stating > that my django DB had an excessive amount of temp tables created. Here > is the error: > > * Nagios 2.10 * > > Notification Type: PROBLEM > > Service: mysql_tmp_disk_tables

Re: bash: django-admin.py: command not found

2010-11-15 Thread Marc Aymerich
On Mon, Nov 15, 2010 at 2:44 PM, ErritG wrote: > Hi Everybody, > > Been struggling with the first part of the Tutorial. Even though the > 'bash: django-admin.py: command not found' has been solved by others I > can't seem to get around this error. Perhaps it's because I'm using > version 2.7 while

Re: Generic relations

2010-11-17 Thread Marc Aymerich
On Wed, Nov 17, 2010 at 11:36 PM, Jonas Geiregat wrote: > Hello, > >  Can I use django's generic relations to create a model (GenericPost) that > can point to other model (APost) or model (ReviewPost) ? >  And then use this GenericPost model to get a list of all latest APost's and > ReviewPost's

Re: Generic relations

2010-11-17 Thread Marc Aymerich
On Wed, Nov 17, 2010 at 11:46 PM, Marc Aymerich wrote: > On Wed, Nov 17, 2010 at 11:36 PM, Jonas Geiregat wrote: >> Hello, >> >>  Can I use django's generic relations to create a model (GenericPost) that >> can point to other model (APost) or model (Rev

Re: Generic relations

2010-11-18 Thread Marc Aymerich
On Thu, Nov 18, 2010 at 12:00 AM, Jonas Geiregat wrote: > > Op 17-nov-2010, om 23:46 heeft Marc Aymerich het volgende geschreven: > >>>>> GenericPost.objects.get(pk=1).content_object.content > > > That's the strange thing. It just doesn't work: > >

Re: Multiple inheritance model

2010-11-20 Thread Marc Aymerich
On Sat, Nov 20, 2010 at 4:37 AM, Joseph (Driftwood Cove Designs) < powderfl...@gmail.com> wrote: > I'm trying to integrate two existing apps, both of which provide a > django Model - call them ModelA and ModelB - my app's model needs to > inherit from both of these. > I know django models support

Re: Multiple inheritance model

2010-11-21 Thread Marc Aymerich
On Sun, Nov 21, 2010 at 5:31 AM, Joseph (Driftwood Cove Designs) < powderfl...@gmail.com> wrote: > Below is the basic layout - I posted a simplified version of the two > model classes here: http://pastebin.com/Xc3KLrQx > > ModelA.save(): > if (some condition): > super().save_base() > Hi th

Re: Multiple inheritance model

2010-11-22 Thread Marc Aymerich
oblem here is the ModelA doesn't call the super save() function on any situation. Then models.Model save() function is not called. Check out this thread: http://groups.google.com/group/django-users/browse_thread/thread/6abd08b6f39d40c9/af74d31d19317616?show_docid=af74d31d19317616&fwc=1 &g

Re: One-to-One relation with abstract classes

2010-11-25 Thread Marc Aymerich
On Thu, Nov 25, 2010 at 11:42 AM, Clemens Wältken wrote: > Hey everyone! > Iam new to this mailinglist and django + python in general. > Yesterday I came up with a pretty complex question concerning abstract > classes and relations. > I have modeled the following classes: > > Question > *

Re: Problem with ForeignKey to an abstract class

2010-12-01 Thread Marc Aymerich
On Wed, Dec 1, 2010 at 12:48 PM, Ferran wrote: > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA256 > > Hello everyone, > > I want to have foreign keys to parent model on a manytomany > intermediate table (through) to have unique entries for that domain. > > The problem is i want this parent mod

constraint unique with models.Model

2009-12-27 Thread Marc Aymerich
hi guys! I'm writing my first project with django and I have doubts in how to declare a constraint unique for two fields of the same table using models.Model. In MySQL would be something like: CREATE TABLE `virtual_aliases` ( id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, domainid INT(11) NOT NU

Re: constraint unique with models.Model

2009-12-27 Thread Marc Aymerich
On Mon, Dec 28, 2009 at 5:15 AM, Karen Tracey wrote: > On Sun, Dec 27, 2009 at 11:08 PM, Marc Aymerich wrote: > >> hi guys! >> >> I'm writing my first project with django and I have doubts in how to >> declare a constraint unique for two fields of the same tabl

Mysql triggers with django

2009-12-28 Thread Marc Aymerich
Hello, Is possible to implement mysql triggers with django?? there are some documentation about it? Thanks!! Marc -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe

Re: Mysql triggers with django

2009-12-28 Thread Marc Aymerich
6/MySQLdb/connections.py", line 300, in show_warnings self.query("SHOW WARNINGS") _mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you can't run this command now") On Tue, Dec 29, 2009 at 2:49 AM, Marc Aymerich wrote: > Hello, > Is possible

Re: Mysql triggers with django

2009-12-28 Thread Marc Aymerich
On Tue, Dec 29, 2009 at 5:47 AM, Marc Aymerich wrote: > well, I found this one. > > http://www.eflorenzano.com/blog/post/database-triggers-arent-evil-and-they-actually-kin/ > > I've tried to implement something like that in mysql with my model bu

Creating a ISP control panel with Django.

2009-12-29 Thread Marc Aymerich
Hi everyone, I just started developing my first web application, I chose Django for this job and I'm so excited with it. It's a control panel with billing system for the ISP which I'm working for. This control panel allows customers and our admins to add domains, email accounts, ftp accounts, data

overriding models.delete()

2010-01-01 Thread Marc Aymerich
I'm overriding save() and delete() methods of the class models. The override of the save() method works properly but unfortunately I'm in troubles trying to override models.delete method. For example, I try to do that in one of my dummy models: class test(models.model) name = models.CharField(

Re: overriding models.delete()

2010-01-01 Thread Marc Aymerich
On Sat, Jan 2, 2010 at 6:28 AM, Marc Aymerich wrote: > I'm overriding save() and delete() methods of the class models. The > override of the save() method works properly but unfortunately I'm in > troubles trying to override models.delete method. For example, I try to do

Re: Cannot reach development server in a rackspace cloud server

2010-01-04 Thread Marc Aymerich
On Mon, Jan 4, 2010 at 12:04 PM, simonecare...@gmail.com < simonecare...@gmail.com> wrote: > > python2.5 manage.py runserver 0.0.0.0:8000, but i can't point my web > > browser to that address. > > Of course I mean MY.IP.ADDRESS:8000. :) > > > > On Jan 4, 12:01 pm, "simonecare...@gmail.com" > wrot

Help with a query :$

2010-01-04 Thread Marc Aymerich
Hi! I have a model like this: class company(models.model): name = models.CharField(mx_length=20) class employee(models.model): comany = models.ForeignKey(company) class user(models.model): person = models.OneToOneField(person) One company can have multiple employees but one employee only can ha

Re: TypeError: 'CharField' object is not callable

2010-01-04 Thread Marc Aymerich
On Tue, Jan 5, 2010 at 5:24 AM, hakova wrote: > Hi all, > > I am a 'very' inexperienced django user with no programming > background, so please be gentle with me :). > > I just typed the following models.py file under my project_name/ > app_name: > > # -*- coding: utf-8 -*- > from django.db impo

Re: Help with a query :$

2010-01-04 Thread Marc Aymerich
On Tue, Jan 5, 2010 at 8:09 AM, greatlemer wrote: > On Jan 5, 4:00 am, Marc Aymerich wrote: > > Hi! > > I have a model like this: > > > > class company(models.model): > > name = models.CharField(mx_length=20) > > class employee(models.model): > > c

Re: newbie: mysql backend "Error was: cannot import name conversions" with subversion build of django

2010-01-05 Thread Marc Aymerich
On Tue, Jan 5, 2010 at 8:38 AM, harijay wrote: > Hi I just started using the subversion build of django and mysql- > python with python 2.6.3 > Both django (svn 12103) and _mysql (MySQLdb rev 635) work fine and can > be imported from the command line python without any error messages. > I created

newbie, how to load js in admin panel

2010-01-08 Thread Marc Aymerich
Hi all! I'm trying to load this js in one of the admin panel views. but seems that I'm unable to configure django properly in order to be able media files access through my browser. I have the js in '/var/www/ucp/media/js' I the settings.py I define

Re: newbie, how to load js in admin panel

2010-01-09 Thread Marc Aymerich
On Sat, Jan 9, 2010 at 6:37 AM, Marc Aymerich wrote: > Hi all! > > I'm trying to load this <http://www.djangosnippets.org/snippets/1492/> js > in one of the admin panel views. but seems that I'm unable to configure > django properly in order to be able media

Re: online transactions with python

2012-01-31 Thread Marc Aymerich
On Tue, Jan 31, 2012 at 5:43 AM, jj_Diego wrote: > Well... > > I'm form Perú and nowadays I'm working with my friends on a proyect > based on python... > > but our first difficulty its the online transactions using  credit > cards (visa, mastercard, diners club) in aweb store > > If anybody knows

Re: Filter admin inlines

2012-02-05 Thread Marc Aymerich
On Sun, Feb 5, 2012 at 1:43 PM, NENAD CIKIC wrote: > Hello, > I have three models > X > Lang > Y > where the purpose of Y is to provide X fields in other languages. > So I have Y as > Y > x foreignkey on X > lang ForeignKey on Lang > additionalfields... > > I have created the ModelAdmin for Lang.

Re: dynamic permissions

2012-02-05 Thread Marc Aymerich
On Sun, Feb 5, 2012 at 3:59 PM, Vittorino Parenti wrote: > i've a model with document'categories and a model with documents. i > want set permissions per categories: add invoices, download invoices > and so on (invoice is an example of category). > Thanks, > Vittorino > Did you mean on Django adm

Re: Need details re: deletion of a referenced model instance

2012-02-14 Thread Marc Aymerich
On Tue, Feb 14, 2012 at 8:02 PM, Jeff Blaine wrote: > Hi all, > > I'm having trouble detecting changes that happen to a M2M field behind the > scenes: as a result of one of the *referenced objects being deleted* > > I'm using Django 1.3.1 with PostgreSQL 8 > > Let's say we have the following simpl

Re: Need details re: deletion of a referenced model instance

2012-02-15 Thread Marc Aymerich
On Wed, Feb 15, 2012 at 12:37 AM, Marc Aymerich wrote: > On Tue, Feb 14, 2012 at 8:02 PM, Jeff Blaine wrote: >> Hi all, >> >> I'm having trouble detecting changes that happen to a M2M field behind the >> scenes: as a result of one of the *referenced objects being

Re: Creating a hospital erp (hospital management) in Django

2012-02-18 Thread Marc Aymerich
On Sat, Feb 18, 2012 at 2:52 PM, Saadat wrote: > Alec, I've tried including this css file everywhere, but it doesn't show up > anywhere. What exactly do i do with it to include this script on any page, > say index. i tried doing it through html as well as django. I don't know what > I'm doing w

Dynamic mixin pattern, what do you think?

2012-02-23 Thread Marc Aymerich
Hi, I'm developing a web hosting control panel and I've decided to split it into several reusable applications: (a) One subset of this reusable applications are those which implement the typical services of an ISP, such as: dns, web, mailing lists, databases, vps, and so on... (b) Then there are

Re: Keeping filters when adding in the admin interface

2012-02-29 Thread Marc Aymerich
On Wed, Feb 29, 2012 at 8:22 PM, Mauro Sánchez wrote: > Hello, if I have the following Model: > > class A: >    name > > class B: >    name >    a = models.ForeignKey(A) > > class C: >    name >    b = models.ForeignKey(B) > > And let's suppose that in the Admin Site I have a Filter in the C list

Re: Keeping filters when adding in the admin interface

2012-02-29 Thread Marc Aymerich
On Wed, Feb 29, 2012 at 10:55 PM, Marc Aymerich wrote: > On Wed, Feb 29, 2012 at 8:22 PM, Mauro Sánchez wrote: >> Hello, if I have the following Model: >> >> class A: >>    name >> >> class B: >>    name >>    a = models.ForeignKey(A) >

null field issue

2012-03-01 Thread Marc Aymerich
I have a model with a filed like name = models.CharField(max_length=255, blank=True, null=True) With Django admin I've created some instances of that model without filling name field. Now I'm querying that model with name__isnull=True and the filter doesn't return any single object!! acctually

Re: null field issue

2012-03-01 Thread Marc Aymerich
On Fri, Mar 2, 2012 at 12:15 AM, wrote: > Hi Marc, > >  if I remember correctly (can't check now), the documentation clearly states > that you should avoid using null=True on CharField unless you have a good > reason. Your example is a textbook reason why is it recommended - having two > disti

Re: Keeping filters when adding in the admin interface

2012-03-02 Thread Marc Aymerich
On Fri, Mar 2, 2012 at 2:18 PM, Mauro Sánchez wrote: > El día 29 de febrero de 2012 19:04, Marc Aymerich > escribió: >> On Wed, Feb 29, 2012 at 10:55 PM, Marc Aymerich wrote: >>> On Wed, Feb 29, 2012 at 8:22 PM, Mauro Sánchez wrote: >>>> Hello, if I have the f

Why on_delete attribute is not available on GenericForeignKey?

2012-03-07 Thread Marc Aymerich
The django docs says: Unlike ForeignKey, GenericForeignKey does not accept an on_delete argument to customize this behavior; if desired, you can avoid the cascade-deletion simply by not using GenericRelation, and alternate behavior can be provided via the pre_delete signal. Does anyone knows why?

Re: Why on_delete attribute is not available on GenericForeignKey?

2012-03-07 Thread Marc Aymerich
On Wed, Mar 7, 2012 at 9:13 PM, akaariai wrote: > I believe the reason is efficiency. If there were an on_delete > argument for GFKs every object deletion of any class would need to do > a query to check if there happens to be any GFK related objects. In > addition, Django can't guarantee foreign

Know all signals available within a project

2012-03-10 Thread Marc Aymerich
Hi!, Any idea about how can I get a list of all available signals? -- Marc -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to djang

Re: A little InlineModelAdmin help please?

2012-03-15 Thread Marc Aymerich
On Thu, Mar 15, 2012 at 9:32 PM, Jeff Blaine wrote: > Easier for me to just draw you a picture: > >            ++ >            |   noodle               | >            ++ >                 |             | >                 |             | >          

Re: filtered admin change-list

2012-03-23 Thread Marc Aymerich
On Sun, Mar 18, 2012 at 12:07 AM, omerd wrote: > Hi, > > I want to be able to show parts of the change list, by the user that > view it. > The case is that every super-user can create instances of a certain > model. I wan't that in the change-list page of that model in the admin > site, every user

reverse urls on admin

2012-03-23 Thread Marc Aymerich
Hi, I've overrided the get_urls() of one of my ModelAdmin in order to provide some extra views. what I did is: def get_urls(self): """Returns the additional urls used by the Contact admin.""" select_urls = patterns("", url("^contract_pack/(?P\d+)/", inc

strange problem deleting objects

2012-03-28 Thread Marc Aymerich
Hi!, I've overrided the save() method of one of my ModelForms and I'm performing a delete of some related objects depending on some form fields values. The thing is I'm getting differents behaviours dependening on how the deletion is performed, consider: 1) self.instance.delete() 2) MyModel.object

Re: strange problem deleting objects

2012-03-29 Thread Marc Aymerich
On Thu, Mar 29, 2012 at 11:15 AM, Daniel Roseman wrote: > On Thursday, 29 March 2012 00:06:29 UTC+1, Marc Aymerich wrote: >> >> Hi!, >> I've overrided the save() method of one of my ModelForms and I'm >> performing a delete of some related objects dependi

Re: strange problem deleting objects

2012-03-29 Thread Marc Aymerich
On Thu, Mar 29, 2012 at 11:47 AM, Marc Aymerich wrote: > On Thu, Mar 29, 2012 at 11:15 AM, Daniel Roseman > wrote: >> On Thursday, 29 March 2012 00:06:29 UTC+1, Marc Aymerich wrote: >>> >>> Hi!, >>> I've overrided the save() method of one of my ModelF

Best approach to execute tasks inside django admin views

2012-03-29 Thread Marc Aymerich
Hi guys, I have an application that execute some tasks after an object is modifyed through django admin interface. In order to do that I'm subscribed to django.contrib.admin.models.EntryLog post_save signal and for each signal I execute a celery task. As you migh know django admin views are runnin

Re: Best approach to execute tasks inside django admin views

2012-03-29 Thread Marc Aymerich
On Thu, Mar 29, 2012 at 6:28 PM, Marc Aymerich wrote: > Hi guys, > I have an application that execute some tasks after an object is > modifyed through django admin interface. In order to do that I'm > subscribed to django.contrib.admin.models.EntryLog post_save signal > a

Re: Best approach to execute tasks inside django admin views

2012-03-29 Thread Marc Aymerich
On Thu, Mar 29, 2012 at 7:40 PM, Marc Aymerich wrote: > On Thu, Mar 29, 2012 at 6:28 PM, Marc Aymerich wrote: >> Hi guys, >> I have an application that execute some tasks after an object is >> modifyed through django admin interface. In order to do that

Re: strange problem deleting objects

2012-03-29 Thread Marc Aymerich
On Thu, Mar 29, 2012 at 11:47 AM, Marc Aymerich wrote: > On Thu, Mar 29, 2012 at 11:15 AM, Daniel Roseman > wrote: >> On Thursday, 29 March 2012 00:06:29 UTC+1, Marc Aymerich wrote: >>> >>> Hi!, >>> I've overrided the save() method of one of my ModelF

OT: just posting at djangojobs when suddenly...

2012-03-30 Thread Marc Aymerich
... something familiar comes up :) http://s18.postimage.org/j9dc6ufa1/Screenshot_5.png -- Marc -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group,

Re: Report generation-reportlab

2012-03-31 Thread Marc Aymerich
On Sat, Mar 31, 2012 at 12:38 PM, Ganesh Kumar wrote: > Hi guys, > > I am new to django reportlab. I want to generate pdf. file to select > mysql (table) content. How to proceed with reportlab, I can do with > some other tool. > please guide me. your valuable suggestion. > I'll use pisa, it allow

Re: Preprocess data before showing it on Admin

2012-04-01 Thread Marc Aymerich
On Sun, Apr 1, 2012 at 9:25 PM, Pedro Vasconcelos wrote: > Hello! > > Anyone knows how preprocess data before showing it on Admin (change page)? > >  __      __      ___ > /      \    /              \    /       \ > |  DB  | -> | PREPROCESSOR | -> | ADMIN | > \__/    \_

Re: Preprocess data before showing it on Admin

2012-04-01 Thread Marc Aymerich
On Sun, Apr 1, 2012 at 9:42 PM, Pedro Vasconcelos wrote: > Hello Marc! > > Thanks for replying. Unfortunately I cant realised how to get the current > value, change it and populate the form using a ModelForm. I've tried it > actually. > sure, you can do it on form __init__ method something like

[OT] Job offer for django developer

2012-04-05 Thread Marc Aymerich
We are an Spanish based organization looking for a Django developer for an European project related to commuinity networks (guifi.net, FunkFeuer and AWMN). The project is called CONFINE (http://confine-project.eu) and its goal is to create a testbed platform allowing researches to deploy their netw

kind of template introspection question.

2012-04-30 Thread Marc Aymerich
Dear all, Each model of my application has an associated template. This template should be rendered each time that their context changes. So this is an example to clarify this cryptic explanation: class ModelA(models.Model): class ModelB(models.Model): a = models.ForeignKey(ModelA) c

Re: kind of template introspection question.

2012-04-30 Thread Marc Aymerich
On Mon, Apr 30, 2012 at 4:22 PM, Marc Aymerich wrote: > Dear all, > > Each model of my application has an associated template. This template > should be rendered each time that their context changes. So this is an > example to clarify this cryptic explanation: > > clas

Re: Tools for extending the admin?

2012-05-01 Thread Marc Aymerich
On Tue, May 1, 2012 at 5:43 PM, Roy Smith wrote: > I'm working on a site which makes extensive use of admin, and we're starting > to look at extending/customizing it.  I am aware of django-admin-tools > and django-grappelli.  Are there other projects I should be looking at for > admin extension/cu

Re: Process Related Object when Saving

2012-05-17 Thread Marc Aymerich
On Wed, May 16, 2012 at 7:15 AM, ghachey wrote: > Hi again; > > Looking at the source code I realised that form.save_m2m() must be > called. > > def save_related(self, request, form, formsets, change): > >        form.save_m2m() >        for formset in formsets: >            self.save_formset(requ

Re: Use Django to implement my GUI!

2012-05-19 Thread Marc Aymerich
On Sat, May 19, 2012 at 8:01 PM, Eugène Ngontang wrote: > Hi Jani. > I don't know why you say > > " 3) Are you now trying to figure out how to plug in Django in "Adming > module/PC with GUI block"?" > > My admin module and the gui do not share anything. They are not on the same > pc. > Gui is for

settings and constants on a reusable app

2012-06-28 Thread Marc Aymerich
Hi, I'm developing a reusable application and I'm having troubles with constant values on settings. Imagine that the reusable application comes with the following settings.py # MY_APP/settings.py from django.conf import settings MY_CONSTANT = 'C1' MY_OTHER_CONSTANT = 'C2' MY_SETTING = getattr(se

Re: settings and constants on a reusable app

2012-06-29 Thread Marc Aymerich
On Fri, Jun 29, 2012 at 11:08 AM, Thomas Rega wrote: > Am 28.06.12 17:30, schrieb Marc Aymerich: > >> Hi, >> I'm developing a reusable application and I'm having troubles with >> constant values on settings. >> >> Imagine that the reusable ap

  1   2   3   >