Re: Track "before" and "after" state of an object when editing in the Admin?

2010-04-27 Thread Tony Czeh
I had a very similar problem where I needed to track all changes to
models throughout the entire application.  I've posted my solution at
http://pastebin.com/2Wc4Nwcd for you to take a look at.

Basically, as was previously suggested, I've hooked into the various
pre_*, post_* and m2m_changed signals that are available.  My code
will log all changes to models unless the model is included in a
DONT_LOG_MODELS tuple in the app settings.  Changes to m2m
relationships are stored against the model containing the m2m.

Hope this helps.

Cheers,
Tony

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



Re: Use Subversion to Download the Latest Django Version

2009-11-17 Thread Tony Czeh
TortoiseSVN is a graphical SVN client.  If you right-click you should 
see an option for Tortoise that, when expanded, contains a check out 
option.  From there, just follow the wizard.

Mikey3D wrote:
> I just got new computer Win7 64-bit and I downloaded:
> 
> 64 Bit TortoiseSVN-1.6.6.17493-x64-svn-1.6.6.msi
> 
> After finished download >Restart >Start >Run >cmd
> 
> --
> C:\Users\Mike>svn co http://code.djangoproject.com/svn/django/trunk/
> 'svn' is not recognized as an internal or external command, operable
> program or batch file.
> 
> C:\Users\Mike>
> --
> 
> What should I do?
> 
> Thanks, Mikey3D
> 
> --
> 
> 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=.
> 
> 

--

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=.




Re: Multiple level aggregate

2009-11-16 Thread Tony Czeh
On 11/16/09 1:12 PM, despy wrote:
> Hi,
>
> I'm trying to get my head around a complex aggregate query and I could
> do with some help. Say I have the following models
>
> StockMarket
> |
> Stock
> |
> StockPrice
>
> If StockPrice has price and date fields, and one price entry for every
> day for every stock how would I write a query to get the average price
> for a given stockmarket for the last six months?
>
> Thanks
>
> Greig
>
> --
>
> 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=.
>
>

Something along these lines should work in SQL:

SELECT s.stock_symbol
  , AVG(sp.price) AS average_price
FROM Stock s
  LEFT JOIN StockPrice sp
 ON s.id = sp.stock_id
WHERE sp.date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
   AND CURRENT_DATE
GROUP BY s.stock_symbol

--

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=.




Can a model generate custom SQL when loading/saving a field?

2009-11-12 Thread Tony Czeh
I'm running into a bit of a problem with Django's models.  I have a
VARCHAR field that needs to be stored with the content AES_ENCRYPT
then HEXed (done on the MySQL server).

What I'd like to have happen is for the Django model to generate
"AES_DECRYPT(UNHEX(field), salt)" when the field is loded by the model
and "HEX(AES_ENCRYPT(field, salt))" when the field is saved by the
model.

Is there a way to make this happen, so far I'm not turning up
anything.

Cheers,
Tony Czeh

--

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=.