CachedStaticFilesStorage unavailable in debug mode

2012-07-18 Thread Marwan Al-Sabbagh
Hi,
  so as explained in the docs CachedStaticFilesStorage will not be applied
if DEBUG setting is set to False. I just wanted to understand why this is
the case. I have a development environment and want to use
CachedStaticFilesStorage. thanks.

cheers,
Marwan

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: CachedStaticFilesStorage unavailable in debug mode

2012-07-19 Thread Marwan Al-Sabbagh
Yeah I think CachedStaticFiledStorage totally rocks too. In my case I'm
using apache mod wsgi as my development environment, so the appropriate
expires headers on the static files are all set correctly. I just can't get
the hashing functionality when I run it in debug mode. But I've solved the
problem I just subclassed CachedStaticFiledStorage and had my version do
the hashing even if DEBUG mode is active. thanks for the help.


On 19 July 2012 10:50, Thomas Orozco  wrote:

> CachedStaticFiledStorage will work, only it will not append the hashes as
> it usually does and behave like a standard file storage.
>
> The use case for this storage is to set very long expires dates on the
> static files and rely and their url changing (due to the hash changing )
> whenever you change them, which causes a cache refresh for thé end user
> browser only and systemically when neefed. (which totally rocks)
>
> Now, this means that the webserver (nginx, apache)  must set the
> appropriate expires headers on the static files.
>
> These won't be set with the development server, and you probably won't
> bother doing it even if you develop with an actual webserver.
>
> So there's no use for hashes. But they still cause a performance drop. So
> django just falls back to a standard storage.
>
>
> I think that if you definitely need it for test just copy it and change it
> so it works with debug true.
> Le 18 juil. 2012 21:39, "Marwan Al-Sabbagh" 
> a écrit :
>
>> Hi,
>>   so as explained in the docs CachedStaticFilesStorage will not be
>> applied if DEBUG setting is set to False. I just wanted to understand why
>> this is the case. I have a development environment and want to use
>> CachedStaticFilesStorage. thanks.
>>
>> cheers,
>> Marwan
>>
>> --
>> 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
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>  --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django app to update site through email

2012-08-11 Thread Marwan Al-Sabbagh
It's a very cool idea. I wanted to do something similar to this where I
would email users notification for approvals and they could reply to the
email with their approval. I'm curious you said you have already
implemented this. How did you end up doing it.

On 10 August 2012 18:23, Paul Backhouse  wrote:

> Hi there,
>
> The Django site I'm working on at the moment sends out emails when
> content is created/updated, using django-notifications.
>
> A feature I would like to add is where users can reply to these mails,
> ie comment on a topic. This reply then appears updated on the site.
>
> I've already written something that does this, but it's very application
> specific.
>
> Ideally it would be done in a generic way (as its own app), with
> something in the admin interface to set up the email account, and then
> maybe a list of ordered filters to pass over the email and consequently
> generate various model instances.
>
> Has this already been done? Does my google-fu escape me? If it hasn't
> already been done, why not? And are there any modules out there that can
> be dropped in to speed development? Any tips on developing this app?
>
> Thanks,
>
> Paul
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django app to update site through email

2012-08-11 Thread Marwan Al-Sabbagh
thats interesting. I was gonna use python's imaplib to periodically check
an email's inbox using IMAP, and run an action whenever new emails are
discovered. We are running MS Exchange as our email server so I needed
something more generic that would work essentially with any Email server
that supports IMAP.

On 11 August 2012 16:15, m1chael  wrote:

> Hello,
>
> I did this recently with postfix.
>
> These are my notes:
>
> [add to /etc/aliases]
> support:"|/home/support/support.py"
>
> [add to /etc/postfix/virtual]
> t...@thesupport.com  support
>
> * then run newaliases
>
> And my script looks like this:
>
> #!/usr/bin/python
>
> import sys, time, email, email.Message, email.Errors, email.Utils,
> smtplib, os, socket, random
> from datetime import date
> from email.Iterators import typed_subpart_iterator
> from time import sleep
>
> def get_charset(message, default="ascii"):
> """Get the message charset"""
>
> if message.get_content_charset():
> return message.get_content_charset()
>
> if message.get_charset():
> return message.get_charset()
>
> return default
>
> # Taken from here, with thanks -
> http://ginstrom.com/scribbles/2007/11/19/parsing-multilingual-email-with-python/
> def get_body(message):
> """Get the body of the email message"""
>
> if message.is_multipart():
> #get the plain text version only
> text_parts = [part
>   for part in typed_subpart_iterator(message,
>  'text',
>  'plain')]
> body = []
> for part in text_parts:
> charset = get_charset(part, get_charset(message))
> body.append(unicode(part.get_payload(decode=True),
> charset,
> "replace"))
>
> return u"\n".join(body).strip()
>
> else: # if it is not multipart, the payload will be a string
>   # representing the message body
> body = unicode(message.get_payload(decode=True),
>get_charset(message),
>"replace")
> return body.strip()
>
> logfile = open('/home/support/support.txt','a')
> raw_msg = sys.stdin.read()
> emailmsg = email.message_from_string(raw_msg)
>
> # Extract database Fields from mail
> msgfrom = emailmsg['From']
> msgto =  emailmsg['To']
> msgsubj = emailmsg['Subject']
> msgbody = get_body(emailmsg)
>
> # Write a log file in /tmp with a record of the e-mails
> currtime = date.today().strftime("%B %d, %Y")
> logfile.write(currtime + "\n")
> logfile.write("From: " + msgfrom + "\n")
> logfile.write("To: " + msgto + "\n")
> logfile.write("Subject: " + msgsubj + "\n")
> logfile.write("Body: " + msgbody + "\n\n")
> logfile.close()
>
> 
>
> Hope this might help someone
>
> ~Mike
>
> On Sat, Aug 11, 2012 at 6:21 AM, Marwan Al-Sabbagh <
> marwan.alsabb...@gmail.com> wrote:
>
>> It's a very cool idea. I wanted to do something similar to this where I
>> would email users notification for approvals and they could reply to the
>> email with their approval. I'm curious you said you have already
>> implemented this. How did you end up doing it.
>>
>>
>> On 10 August 2012 18:23, Paul Backhouse  wrote:
>>
>>> Hi there,
>>>
>>> The Django site I'm working on at the moment sends out emails when
>>> content is created/updated, using django-notifications.
>>>
>>> A feature I would like to add is where users can reply to these mails,
>>> ie comment on a topic. This reply then appears updated on the site.
>>>
>>> I've already written something that does this, but it's very application
>>> specific.
>>>
>>> Ideally it would be done in a generic way (as its own app), with
>>> something in the admin interface to set up the email account, and then
>>> maybe a list of ordered filters to pass over the email and consequently
>>> generate various model instances.
>>>
>>> Has this already been done? Does my google-fu escape me? If it hasn't
>>> already been done, why not? And are there any modules out there that can
>>> be dropped in to speed development? A

Re: Django app to update site through email

2012-08-12 Thread Marwan Al-Sabbagh
Ah good old fetchmail. How did I forget you. Thanks Melvyn, It looks really
really mature an full featured. As far as security and identifying the user
I was planning to use Django's Cryptographic
signingand to
put a signed value contained the user details and record they are
approving or reject by email. That way I don't have to rely on the SMTP
headers. There is also the added benefit of being able to use the
TimestampSigner class so that messages could expire after a certain period
if the user didn't respond to them.

On 12 August 2012 11:31, Melvyn Sopacua  wrote:

> On 10-8-2012 17:23, Paul Backhouse wrote:
>
> > Has this already been done? Does my google-fu escape me? If it hasn't
> > already been done, why not? And are there any modules out there that can
> > be dropped in to speed development? Any tips on developing this app?
>
> An email gateway is what exposed contrib.auth's problems to me, because
> it has the email stored on the user account info, you can only match one
> email per user. In a world where people use several accounts or server
> addresses with 'subdomains', having only one registered address per
> account isn't practical. Also, match a user based on SMTP headers is not
> very secure.
>
> Another approach that you can observe in the wild is to have 'secret
> email addresses'. In the user account information an email address at
> the site's domain is made available that the user can send comments or
> content to. The drawback here is that it's very sensitive to identity
> theft as the assumption is made that only that user knows that address.
>
> So very quickly, you come into the dark realm of requiring some kind of
> authentication key associated with the email message and while for us
> techies this is trivial, explaining that to casual internet users has
> been a problem since the inception of S-MIME and PGP.
>
> I imagine most projects that have attempted this principle strand on
> this issue and the associated spam nightmare.
>
> --
> Melvyn Sopacua
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Excel dumps to Office 10

2011-06-07 Thread Marwan Al-Sabbagh
So what you are doing is producing HTML content, but send the user a file
with an xls extension. Before MS Excel used to open the xls file see that in
fact it doesn't have xls data in it but HTML and would try and take care of
it by converting the html to excel and presenting to the user. In more
recent versions like excel 2010 it correctly reports to the user that this
xls file does not have xls data in it but has html data. I suspect there
might have been security concerns with this.

you can use xlwt http://www.python-excel.org to build a proper xls file.
This is the more correct way of exporting to MS Excel. The approach you have
is kind of a hack that worked without complaint in older versions of MS
office.

Marwan

On Mon, Jun 6, 2011 at 6:40 PM, creecode  wrote:

> Hello Bobby,
>
> No answer just some thoughts.  Did the MIME type change for Excel between
> 2003 and 2010?
>
> If your file dump is in a text format and is delimited with tabs or commas,
> can you change your MIME type to a plain text one?  Although the apps may
> ask to convert when opening files that are in a text format, you'd need to
> test.
>
> Toodle-loo...
> creecode
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Y0ZUcERGMUpGbUVK.
>
> To post to this group, send email to django-users@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.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django and Rich Client

2011-06-16 Thread Marwan Al-Sabbagh
Out of curiosity is there a specific need for running a rich client instead
of just accessing the system app through a web browser.

On Fri, Jun 10, 2011 at 4:16 AM, Ovnicraft  wrote:

> soaplib 
>
> On Thu, Jun 9, 2011 at 1:10 PM, Knack  wrote:
>
>> Hi guys,
>>
>> I've got a prototype DB + Rich Client app and need to make a proper
>> production app out of it. The client is written in PyQt and needs to
>> fullfill quite some functional and performance requirements (I would
>> really like to keep it). The client connects directly to the DB.
>>
>> After some thoughts about security I came to the conclusion that using
>> django is the way to go. Now I seek some coarse advice / feedback
>> wether I'm heading in the right directions. I've got some miles to go
>> and looking forward to learning Django, but want to avoid newbie
>> pitfalls. So if something of the following sounds like bad ideas to
>> you, please let me know ;-).
>>
>> Current plans are:
>>
>> 1) Using an Oracle DB
>> 2) LDAP authentification
>> 3) Role based authorisation. Here I'm a bit unsure about the approach.
>> I would implement it by myself within the django world (don't know yet
>> where exactly).
>> 4) Transfering the data using a web service via https. Here are my
>> biggest uncertainties. What kind of web service to use? Rest, xml-rpc
>>
>
> I recommend you REsT, IMHO XML-RPC is not fast, SOAP is a good option but
> we get just few libraries under development soaplib[1]  is really promise.
>
>
> or soap? How to package the acual data? Embedded in the html or xml?
>>
>
> Just be light.
>
>
> Regards,
>
> As binary payload? I would need only basic stuff like log in, log out,
>> read and write whole database rows, which are basically the business
>> objects. Most of the logic is done on the rich client. I would
>> transfer large amounts (10s of business objects) of data at
>> startup time (very eager loading to the client). But also lazy loading
>> of course.
>> 5) One important concept is that I change only a small amount of the
>> data objects. Most of the changes lead to new versions. Therefore I
>> hope to be able to use caching extensivly. The data objects which are
>> immutable could be permanently cached in memory. How about
>> authorisation of these cached objects? Are there ways django takes
>> care of this?
>>
>> A long first post ;-). Any comments are appreciated!
>>
>> Cheers,
>>
>> Jan
>>
>> --
>> 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
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
>
> --
> Cristian Salamea
> @ovnicraft
>
>  --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django and Rich Client

2011-06-17 Thread Marwan Al-Sabbagh
thats pretty amazing that PyQt can handle such a big dataset at once.
Putting JavaScript aside just trying to load html tables with a large amount
of rows can become very unwieldy. Good luck with the app.

cheers,
Marwan

On Fri, Jun 17, 2011 at 5:55 PM, Knack  wrote:

> The requirements are:
>
> 1) Handling large (>10 lines, ~ 10 columns) amounts of structured
> data in treeviews. For certain use cases comparing two of those trees.
> 2) Creating different structured views on the data. Like using
> different categories of attributes as structure criteria. Those views
> are not persistent.
> 3) Performing filter and configuration operations on the data. Those
> can be quite expensive, for example variant configuration which comes
> down to evaluating boolean expressions for each item.
> 4) Maybe (if there's time and I find an easy to use lib, maybe
> Panda3D) adding a simple 3D viewer.
>
> The decision has been made without really evaluation JavaScript or
> Flash. I must admit that I don't know wether the state of the art JS
> libraries can handle that large trees. But I know that PyQt can handle
> that large data amazingly well. Further, I have some experience with
> these kind of systems: Most of them are quite "server-centric" (as
> common web apps are). Those systems have all performance issues when
> the user needs another view or configuration of the data. My approach
> is to eagerly load all the data to the client and do all calculations
> for the views there. I must add that it's an in-house app and all
> users have proper PCs.
>
> Lastly, Personal experience and know-how: PyQt is fun to work with
> (after some learning curve, of course). It has style-sheets for making
> the client sexy at the end. On the other hand, I'm totally impressed
> what can be done with JS, but I'm not familiar with it.
>
> Cheers,
>
> Jan
>
>
>
> On 17 Jun., 06:26, Marwan Al-Sabbagh 
> wrote:
> > Out of curiosity is there a specific need for running a rich client
> instead
> > of just accessing the system app through a web browser.
> >
> >
> >
> >
> >
> >
> >
> > On Fri, Jun 10, 2011 at 4:16 AM, Ovnicraft  wrote:
> > > soaplib <https://github.com/soaplib/>
> >
> > > On Thu, Jun 9, 2011 at 1:10 PM, Knack  wrote:
> >
> > >> Hi guys,
> >
> > >> I've got a prototype DB + Rich Client app and need to make a proper
> > >> production app out of it. The client is written in PyQt and needs to
> > >> fullfill quite some functional and performance requirements (I would
> > >> really like to keep it). The client connects directly to the DB.
> >
> > >> After some thoughts about security I came to the conclusion that using
> > >> django is the way to go. Now I seek some coarse advice / feedback
> > >> wether I'm heading in the right directions. I've got some miles to go
> > >> and looking forward to learning Django, but want to avoid newbie
> > >> pitfalls. So if something of the following sounds like bad ideas to
> > >> you, please let me know ;-).
> >
> > >> Current plans are:
> >
> > >> 1) Using an Oracle DB
> > >> 2) LDAP authentification
> > >> 3) Role based authorisation. Here I'm a bit unsure about the approach.
> > >> I would implement it by myself within the django world (don't know yet
> > >> where exactly).
> > >> 4) Transfering the data using a web service via https. Here are my
> > >> biggest uncertainties. What kind of web service to use? Rest, xml-rpc
> >
> > > I recommend you REsT, IMHO XML-RPC is not fast, SOAP is a good option
> but
> > > we get just few libraries under development soaplib[1]  is really
> promise.
> >
> > > or soap? How to package the acual data? Embedded in the html or xml?
> >
> > > Just be light.
> >
> > > Regards,
> >
> > > As binary payload? I would need only basic stuff like log in, log out,
> > >> read and write whole database rows, which are basically the business
> > >> objects. Most of the logic is done on the rich client. I would
> > >> transfer large amounts (10s of business objects) of data at
> > >> startup time (very eager loading to the client). But also lazy loading
> > >> of course.
> > >> 5) One important concept is that I change only a small amount of the
> > >> data objects. Most of the changes lead to new versions. Therefore I
> > >> hope to be able to use

Re: Server HTTP Client

2011-03-03 Thread Marwan Al-Sabbagh
mechanize is a very powerful library that can help you do this stuff. the
project page is at http://wwwsearch.sourceforge.net/mechanize . I've used it
in my work place and it works quite well.

cheers,
Marwan

On Thu, Mar 3, 2011 at 9:59 PM, Julian  wrote:

> Hi,
>
> Is there anything on in Python or Django that can be used as a server
> side HTTP Client. Something like  HTTP Unit and jsdom from NodeJS.
>
> I'm trying to log into some custom site and scrap the data from them.
> It would be a plus if the client also support javascript.
>
> Thanks.
>
>
> Julian
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



custom django-admin commands naming convention

2011-03-08 Thread Marwan Al-Sabbagh
Hi,
  I need to cron a few jobs for my django app to run daily. I went through
the docs on "Writing custom django-admin commands" and thats the direction
I'm planning to go to run these jobs. Our company has a number of teams
developing different apps and I didn't want the naming of the commands to be
a mess. Are there any recommendations for naming conventions of the
commands. Is it common for example to call the command appname_command to
make it clear which app is implementing which command. Any advice/experience
is welcome.

thanks,
Marwan

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: custom django-admin commands naming convention

2011-03-08 Thread Marwan Al-Sabbagh
cool thanks,

Marwan

On Wed, Mar 9, 2011 at 12:14 AM, creecode  wrote:

> Hello Marwan,
>
> I don't know if it's common but for my needs it's a must!  :-)  I have
> several apps with custom management commands and I've taken to naming
> the commands like...
>
> my_app_name_my_custom_management_command_name.py
>
> If find it easier to read the command name if I separate each word
> with an underscore.  The names are fairly long but I'm not typing them
> into the terminal all that much.  Mostly called from cron or pulled up
> through my bash history.
>
> Toodle-looo..
> creecode
>
> On Mar 8, 12:02 am, Marwan Al-Sabbagh 
> wrote:
>
> > Our company has a number of teams
> > developing different apps and I didn't want the naming of the commands to
> be
> > a mess. Are there any recommendations for naming conventions of the
> > commands. Is it common for example to call the command appname_command to
> > make it clear which app is implementing which command. Any
> advice/experience
> > is welcome.
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Logging raw sql

2011-03-10 Thread Marwan Al-Sabbagh
Hi,
  There are three different possible solutions you could investigate to do
this logging on the django/python level:

1) use django's new logging feature that as per the docs will log "every SQL
statement executed by a request". The beauty of this approach is that you
can use python's excellent logging module an just add your own filter and
handler to grab exactly what you want and log it the way you want. you can
read more about it at
http://docs.djangoproject.com/en/dev/topics/loggingKeep in mind though
this is a django 1.3 feature which looks to be released
within a week.
2) check out django-debug-toolbar (
http://robhudson.github.com/django-debug-toolbar/) which displays all SQL
queries executed in a request, you could read through their code and see how
they hook in and get that information
3) you could take the mysql database backend django.db.backends.mysql which
seems to be a collection of classes and try and make your own custom backend
that only extends certain classes that you need to be logged. It could be
like a thin wrapper around django.db.backends.mysql

hope one of these solutions works for you.

cheers,
Marwan

On Wed, Mar 9, 2011 at 8:57 PM, Dave Sluder  wrote:

> Thanks krzysiekpl, I actually have to use mysql. Having browsed
> through the django source, I don't think there is anyway to intercept
> the query unless it were done for example in mysqldb, since the
> library actually generates the raw sql. I've discovered the
> general_log to table feature of mysql 5.1 and am just executing a
> query against that to filter the results.
>
> On Mar 9, 4:35 am, krzysiekpl  wrote:
> > Hi, if you are using postgresql you can use logger_collector. Try
> > this:
> http://www.postgresql.org/docs/8.3/static/runtime-config-logging.html.
> >
> > On 9 Mar, 05:04, Dave Sluder  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > I need to log all insert/update/delete queries such that the database
> > > could be rebuilt from the log. I know I can do this at the database
> > > level, but I need to log selectively for certain models.
> > > The statements captured from db.connection.queries still contain
> > > parameters so they won't work.
> >
> > > Does anyone have any insight as to where I can intercept the raw query
> > > if at all?
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Auto refresh of page for one user on other user's update

2011-03-24 Thread Marwan Al-Sabbagh
I'm working on an application that has a similar requirement. If you can
wait for a few weeks, I'll probably have it ready and released sometime next
month. I'll be releasing it as an open source project specifically to work
with django. If it's something you're interested in shoot me an email and
I'll make sure to keep you posted once I release it.

cheers,
Marwan

On Thu, Mar 24, 2011 at 5:57 PM, Shawn Milochik  wrote:

> In addition there's hookbox.org.
>
> There was a great talk on it at PyCon.
> http://pycon.blip.tv/file/4883145/
>
> In addition, I'm in the process of playing with Hookbox, after which
> I'll write a blog post detailing how to use it with Django.
>
> In the meantime, this is the tutorial I've found most helpful for
> Hookbox. It's using Flask instead of Django, but if you've used Django
> you'll find Flask extremely simple to play with.
>
> http://charlesleifer.com/blog/writing-a-real-time-chat-app-using-hookbox-and-flask/
>
> Shawn
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



admin cannot edit records with 'add' as primary key

2011-04-01 Thread Marwan Al-Sabbagh
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 primary key field that has the value
'add' you won't be able to edit it in the admin screens. the admin
will take you to the add page instead of the change page for that
record. this is a problem with the design of the urls in the admin
module.

admin.py
=
from polls.models import poll
from django.contrib import admin

admin.site.register(poll)

model.py
=
from django.db import models

class poll(models.Model):
id = models.CharField(max_length=200, primary_key=True)
question = models.CharField(max_length=200)

Reproducing

 1. Create project and app, enable admin, add the above files and syncdb.
 2. Go to the admin interface and select Add poll
 3. specify 'add' as the id and 'test' as question
 4. Save
 5. Go back to the list
 6. Open the same object
 7. you will be taken to the add poll screen instead of the change
poll screen for the selected object


cheers,
Marwan

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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

2011-04-04 Thread Marwan Al-Sabbagh
Exactly, I think an assumption was made in the original design of the
URLs about the values of the primary keys, maybe that they would be
numeric. So this case brakes that assumption.

Marwan

On Mon, Apr 4, 2011 at 12:52 AM, Marc Aymerich  wrote:
>
>
> On Fri, Apr 1, 2011 at 8:39 PM, Marwan Al-Sabbagh
>  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 primary key field that has the value
>> 'add' you won't be able to edit it in the admin screens. the admin
>> will take you to the add page instead of the change page for that
>> record. this is a problem with the design of the urls in the admin
>> module.
>>
>> admin.py
>> =
>> from polls.models import poll
>> from django.contrib import admin
>>
>> admin.site.register(poll)
>>
>> model.py
>> =
>> from django.db import models
>>
>> class poll(models.Model):
>>    id = models.CharField(max_length=200, primary_key=True)
>>    question = models.CharField(max_length=200)
>>
>> Reproducing
>> 
>>  1. Create project and app, enable admin, add the above files and syncdb.
>>  2. Go to the admin interface and select Add poll
>>  3. specify 'add' as the id and 'test' as question
>>  4. Save
>>  5. Go back to the list
>>  6. Open the same object
>>  7. you will be taken to the add poll screen instead of the change
>> poll screen for the selected object
>
>
> The problem here is the change view URL of an object with 'add' as a primary
> key is the same as add view URL :)
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django app for data management and visualization

2011-04-06 Thread Marwan Al-Sabbagh
this sounds very interesting to me too. I'm working at a financial
institution and I'm facing a similar challenge of allowing the users
to generate ad hoc reports and export those reports to excel. I've
already implemented this requirement in PHP and I'm in the process of
migrating these reporting systems to django. I'm very interested to
see how you plan to do excel exports. I'll also be righting a library
within the next two months to do that, because I haven't found
anything that meets our requirements. If it's something you are
interested in please shoot me an email.
  as far as importing data from excel sheets into a database check out
www.python-excel.org and specifically their xlrd package that lets you
read excel files and traverse the cells. You could use this to extract
values and populate your database.

Marwan

On Tue, Apr 5, 2011 at 7:03 PM, Gianluca Riccardi
 wrote:
>
>
> On 5 Apr, 17:06, alessio c  wrote:
>> Ciao,
>
> ciao Alessio,
>
>>
>> yes I do. I need more basic stuff then that and I need tables. Think of this
>> as tentative to reduce Excel use (which is killing me).
>>
>> I can use matplotlib or openflash if I want to go really fancy. However, now
>> I need to set up the framework. After that, I have a platform from which I
>> can run all my scripts.
>>
>> Let's say I have a database with invoice data from different subsidiaries. I
>> want to be able to: 1) create different views (subsidiary level, macro
>> level, invoice level, first 10 invoice, first 10 customers, etc.); 2) upload
>> data from different formats (because people are lazy and it is impossible to
>> impose a single format); 3) allow some users to upload data (to avoid them
>> to send me excel files by email, this is a huge feature...); 4) allow some
>> other users (managers) to access and download online reports (tables and
>> graphs).
>>
>> Theoretically, when I get this right I am hoping to start a project on git.
>> The main idea is to create a shared reporting tool.
>
> sounds like your going to have some fun ;) good luck, especially if
> you can get rid of dealing with spreadsheets and automate it I'm sure
> users will be happier(you at first;)
>
> if You start a public git repo i'd like to read your progresses
>
> regards,
> Gianluca Riccardi
>
> --
> 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django app for data management and visualization

2011-04-07 Thread Marwan Al-Sabbagh
Hi Chris,
  thanks so much for all the information and the links, Its really
helpful. I really like xlwt it's easy, fast, and powerful. I'll most
likely start with allowing the user to export a table of results to an
excel sheet where they can do whatever additional calculations,
formatting, or analysis they want.
  I'm very interested in dealing with charts and graphs but I must say
at this stage its more of a bonus then something our users are
demanding. I'll keep you guys updated on my progress and would love to
get all your feedback on the direction I'm taking and if it's
something that any of you can use on your projects. looking forward to
it.

cheers,
Marwan

On Thu, Apr 7, 2011 at 9:50 AM, Chris Matthews  wrote:
> Hi Marwan,
>
> I am considering an "Excel Export" button wherever I have a table (or 
> jQuery-UI grid).
>
> If you just want data sheets, before writing something, consider this:
> xlwt 0.7.2 Library to create spreadsheet files compatible with MS Excel 
> 97/2000/XP/2003 XLS files, on any platform, with Python 2.3 to 2.6
> http://pypi.python.org/pypi/xlwt
>
> Example (using xwlt) to do export_selected_objects 
> http://davidmburke.com/tag/django/
>
> Xwlt does not do graphs.
>
> There is probably a lot on graphs but I just saw this:
> http://www.gnuplot.info/ and then also a Python interface 
> http://gnuplot-py.sourceforge.net/
>
> Or
> http://sourceforge.net/projects/django-dataplot/
>
>
> For a interesting take on spreadsheets:
> Use Django and jQuery to create a spreadsheet application 
> http://www.ibm.com/developerworks/web/library/wa-django/?ca=drs-
>
> http://www.spreadsheetgear.com/ seemed cool but you net .Net and it will cost 
> you (not sure if it will save you some money).
>
> Regards
> Chris
>
> -Original Message-
> From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
> Behalf Of Marwan Al-Sabbagh
> Sent: 06 April 2011 16:59
> To: django-users@googlegroups.com
> Subject: Re: Django app for data management and visualization
>
> this sounds very interesting to me too. I'm working at a financial
> institution and I'm facing a similar challenge of allowing the users
> to generate ad hoc reports and export those reports to excel. I've
> already implemented this requirement in PHP and I'm in the process of
> migrating these reporting systems to django. I'm very interested to
> see how you plan to do excel exports. I'll also be righting a library
> within the next two months to do that, because I haven't found
> anything that meets our requirements. If it's something you are
> interested in please shoot me an email.
>  as far as importing data from excel sheets into a database check out
> www.python-excel.org and specifically their xlrd package that lets you
> read excel files and traverse the cells. You could use this to extract
> values and populate your database.
>
> Marwan
>
> On Tue, Apr 5, 2011 at 7:03 PM, Gianluca Riccardi
>  wrote:
>>
>>
>> On 5 Apr, 17:06, alessio c  wrote:
>>> Ciao,
>>
>> ciao Alessio,
>>
>>>
>>> yes I do. I need more basic stuff then that and I need tables. Think of this
>>> as tentative to reduce Excel use (which is killing me).
>>>
>>> I can use matplotlib or openflash if I want to go really fancy. However, now
>>> I need to set up the framework. After that, I have a platform from which I
>>> can run all my scripts.
>>>
>>> Let's say I have a database with invoice data from different subsidiaries. I
>>> want to be able to: 1) create different views (subsidiary level, macro
>>> level, invoice level, first 10 invoice, first 10 customers, etc.); 2) upload
>>> data from different formats (because people are lazy and it is impossible to
>>> impose a single format); 3) allow some users to upload data (to avoid them
>>> to send me excel files by email, this is a huge feature...); 4) allow some
>>> other users (managers) to access and download online reports (tables and
>>> graphs).
>>>
>>> Theoretically, when I get this right I am hoping to start a project on git.
>>> The main idea is to create a shared reporting tool.
>>
>> sounds like your going to have some fun ;) good luck, especially if
>> you can get rid of dealing with spreadsheets and automate it I'm sure
>> users will be happier(you at first;)
>>
>> if You start a public git repo i'd like to read your progresses
>>
>> regards,
>> Gianluca Riccardi
>>
>> --
>> You received this message because you are subscribed 

Re: Django app for data management and visualization

2011-04-08 Thread Marwan Al-Sabbagh
Hi Chris,
  there stuff looks pretty nice. I'll add that link to my research.

Marwan

On Fri, Apr 8, 2011 at 9:22 AM, Chris Matthews  wrote:
> Hi Marwan,
>
> Another option that I'll investigate is Google Chart Tools / Image Charts 
> (aka Chart API) see http://code.google.com/apis/chart/
> Regards
> Chris
>
> -Original Message-
> From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
> Behalf Of Marwan Al-Sabbagh
> Sent: 07 April 2011 09:59
> To: django-users@googlegroups.com
> Subject: Re: Django app for data management and visualization
>
> Hi Chris,
>  thanks so much for all the information and the links, Its really
> helpful. I really like xlwt it's easy, fast, and powerful. I'll most
> likely start with allowing the user to export a table of results to an
> excel sheet where they can do whatever additional calculations,
> formatting, or analysis they want.
>  I'm very interested in dealing with charts and graphs but I must say
> at this stage its more of a bonus then something our users are
> demanding. I'll keep you guys updated on my progress and would love to
> get all your feedback on the direction I'm taking and if it's
> something that any of you can use on your projects. looking forward to
> it.
>
> cheers,
> Marwan
>
> On Thu, Apr 7, 2011 at 9:50 AM, Chris Matthews  wrote:
>> Hi Marwan,
>>
>> I am considering an "Excel Export" button wherever I have a table (or 
>> jQuery-UI grid).
>>
>> If you just want data sheets, before writing something, consider this:
>> xlwt 0.7.2 Library to create spreadsheet files compatible with MS Excel 
>> 97/2000/XP/2003 XLS files, on any platform, with Python 2.3 to 2.6
>> http://pypi.python.org/pypi/xlwt
>>
>> Example (using xwlt) to do export_selected_objects 
>> http://davidmburke.com/tag/django/
>>
>> Xwlt does not do graphs.
>>
>> There is probably a lot on graphs but I just saw this:
>> http://www.gnuplot.info/ and then also a Python interface 
>> http://gnuplot-py.sourceforge.net/
>>
>> Or
>> http://sourceforge.net/projects/django-dataplot/
>>
>>
>> For a interesting take on spreadsheets:
>> Use Django and jQuery to create a spreadsheet application 
>> http://www.ibm.com/developerworks/web/library/wa-django/?ca=drs-
>>
>> http://www.spreadsheetgear.com/ seemed cool but you net .Net and it will 
>> cost you (not sure if it will save you some money).
>>
>> Regards
>> Chris
>>
>> -Original Message-
>> From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] 
>> On Behalf Of Marwan Al-Sabbagh
>> Sent: 06 April 2011 16:59
>> To: django-users@googlegroups.com
>> Subject: Re: Django app for data management and visualization
>>
>> this sounds very interesting to me too. I'm working at a financial
>> institution and I'm facing a similar challenge of allowing the users
>> to generate ad hoc reports and export those reports to excel. I've
>> already implemented this requirement in PHP and I'm in the process of
>> migrating these reporting systems to django. I'm very interested to
>> see how you plan to do excel exports. I'll also be righting a library
>> within the next two months to do that, because I haven't found
>> anything that meets our requirements. If it's something you are
>> interested in please shoot me an email.
>>  as far as importing data from excel sheets into a database check out
>> www.python-excel.org and specifically their xlrd package that lets you
>> read excel files and traverse the cells. You could use this to extract
>> values and populate your database.
>>
>> Marwan
>>
>> On Tue, Apr 5, 2011 at 7:03 PM, Gianluca Riccardi
>>  wrote:
>>>
>>>
>>> On 5 Apr, 17:06, alessio c  wrote:
>>>> Ciao,
>>>
>>> ciao Alessio,
>>>
>>>>
>>>> yes I do. I need more basic stuff then that and I need tables. Think of 
>>>> this
>>>> as tentative to reduce Excel use (which is killing me).
>>>>
>>>> I can use matplotlib or openflash if I want to go really fancy. However, 
>>>> now
>>>> I need to set up the framework. After that, I have a platform from which I
>>>> can run all my scripts.
>>>>
>>>> Let's say I have a database with invoice data from different subsidiaries. 
>>>> I
>>>> want to be able to: 1) create different views (subsidiary level, macro
&

Re: Django app for data management and visualization

2011-04-10 Thread Marwan Al-Sabbagh
thanks for sharing the link. Thats a really amazing piece of software, I'm
definitely gonna use that on some of my projects.

Marwan

On Sun, Apr 10, 2011 at 5:59 PM, Brian Bouterse  wrote:

> I'm a fan of using flot  for
> visualization.  I've used the Google Charts and it works well too.
>
> Brian
>
>
> On Sun, Apr 10, 2011 at 2:07 AM, ucnt...@gmail.com wrote:
>
>>
>>
>> On Apr 8, 12:22 am, Chris Matthews  wrote:
>> > Hi Marwan,
>> >
>> > Another option that I'll investigate is Google Chart Tools / Image
>> Charts (aka Chart API) seehttp://code.google.com/apis/chart/
>> > Regards
>> > Chris
>> >
>>
>> Be sure to go for the "Visualization API" over the basic image based
>> charts if you have significant amount of data.  I've been using this
>> of late and pretty well enjoying it. I'm currently considering
>> exporting to Google's spreadsheet from which you can IIRC export to
>> various formats. Perhaps you could upload the data for export to
>> Google Docs, then export over an API. Not sure if they expose
>> exporting to xls over an API yet.
>>
>> --
>> 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
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
>
> --
> Brian Bouterse
> ITng Services
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to remove breadcrumbs in Django admin

2014-03-16 Thread Marwan Al-Sabbagh
For reference I've asked this question on stackoverflow:
http://stackoverflow.com/q/22345527/1699750

How can I use nav-global for navigation and hide the breadcrumbs in the
django admin app. I've found ways to do this but they seem hackish and
problematic. I'm looking for a clean reliable solution.

**Naive Approach that doesn't work:**

customize admin/base_site.html

{% extends "admin/base.html" %}
{% load i18n %}

{% block title %}{{ title }} | {% trans 'Django site admin' %}{%
endblock %}

{% block branding %}
{% trans 'Django administration' %}
{% endblock %}

{% block nav-global %}Some links will go here...{% endblock %}
{% block breadcrumbs %}{% endblock %}

this doesn't work because the templates in django admin like
change_list.html that extend base_site.html will define content for
breadcrumbs which will override whatever I have set in base_site.html.

**solution 1: CSS**

Add the following css to admin using the extrastyle block. This works, but
the breadcrumbs still get generated and appear in the HTML source. This
feels hacky.

.breadcrumbs {
display: none;
}

**Solution 2: override base.html**

Override base.html and remove the breadcrumbs block. Children will try to
define it but it never exists so it never gets rendered. This also seems
like a hack. It's also not a good idea to override base.html as each Django
release can make many changes to base.html and the admin app could break
between releases.

I just wanted to make sure there isn't some simpler way that I'm missing.
Thanks in advance.

Cheers,
Marwan AlSabbagh

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPdSytJsGpcREnrfqK_B0hx_cW8byJaTc6wtL7OfgiGpvrVxog%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.