I would forget the signals, and override your model's save() function
instead. That should give you all of the functionality you are asking
for, and be much less of a headache.

On Dec 29, 11:11 pm, Marc Aymerich <glicer...@gmail.com> wrote:
> 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, databases... and then bill. As it is the first time i'm using
> django, i'd like to share with you how im thinking to implement it so I can
> be sure I'm doing fine, respecting django philosophy :).
>
> *I've defined the database model in models.py
>
> *I've created two instances of the AdminSite, (one for admins, another for
> customers)
>
> *The database can be updated by 3 differents ways:
>
> +Admin panel
>
> +Customer panel
>
> +Synchronization app (to allow sysadmins to do modifications directly on the
> system without loosing consistence between the database and the system)
>
> *For the admin and the customer panel I want to override the function
> save_model via /contrib/admin/options.py. I want to call there a function so
> a resource is created in the system, ex: create_domain(). ¿Is that the best
> place to call create_domain()?
>
> *The synchronization app is called by cron each 'X' time. via 
> wgethttp://panel.mydomain.org/app/<http://panel.mydomain.org/app/syncrhonitzation>
> syncrhon 
> <http://panel.mydomain.org/app/syncrhonitzation>itzation<http://panel.mydomain.org/app/syncrhonitzation>.
> It looks up for changes and saves them into the database.
>
> *Every time that someone creates a new resource (ex. add domain) I need to
> log it into "orders" table (to bill customers later). In order to preserve
> data consistency I think the best way to do this is using the signal
> django.db.models.signals.pre_save.
> At this point I have a few questions:
>
> -Is using this signal is the best way? If this signal fail (don't insert a
> row in orders table), is the default behaviour cancelling obj.save()
> function? or domain is saved anyway in the database? If that's the case,can
> the function that calls obj.save() know that the signal has failed?
>
> I appreciate any kind of comment!
>
> thank you a lot for reading until here!
>
> 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 from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to