Re: Hello!

2012-07-15 Thread Timothy Makobu
+1

On Sun, Jul 15, 2012 at 1:05 AM, Thomas Lockhart wrote:

> On 7/14/12 12:04 PM, Shubz wrote:
>
>> Hi! I'm new to Python and Django. I feel like I'm jumping in deep end,
>> but I have previous PHP and Java knowledge so what the hey.
>>
>> I was wondering if anybody could be kind enough to point me in the right
>> direction to a broken down tut on installation for Mac?
>>
>>  I use MacPorts to get python, postgres, and virtualenv. Everything else
> is covered nicely in the Django tutorial.
>
> hth
>
>   - Tom
>
>
> --
> 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+unsubscribe@**
> 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: Hello Django Warriors!

2012-07-15 Thread Timothy Makobu
Django Warr  LOL!

Have a look at Pinax http://pinaxproject.com/


On Sun, Jul 15, 2012 at 5:18 AM, Kurtis Mullins wrote:

> On Sat, Jul 14, 2012 at 4:44 PM, Kakar 
>
> I'm very new to this Phyton and i just downloaded django package. What i
>> wanted to ask was,..can i make a social site where the users itself can
>> customize their themes or the layout???
>> M a vey newbie in programming so please explain me in detail. Thank you.
>>
>> Hey,
>
> Welcome to Python and Django! Of course you can. I'd suggest starting with
> the Django Tutorial to understand the framework and of course learning a
> bit about the Python programming language before jumping into a task that
> large.
>
> For an example site that provides this functionality (still a work in
> progress), check out fireflie.com. You have to register to see the
> functionality but feel free to ignore the subscription after 8 days --
> unless you're a musician and want to actually use the site.
>
> (Disclaimer: I am the lead developer of fireflie.com, my intention is not
> to advertise here but to show you one example of a site providing this
> functionality with Python/Django as a back-end. If you do give it a try and
> don't actually intend on using fireflie.com for its intended purpose,
> please send in a Account Removal request after you've finished checking it
> out.)
>
> --
> 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: Problem with named urls

2012-07-15 Thread Per-Olof Åstrand


On Sunday, July 15, 2012 3:03:44 AM UTC+2, Russell Keith-Magee wrote:
>
>
> Hi Per-Olof, 
>
> It looks like you have found a place in Django's documentation that 
> hasn't been updated to reflect a recent change to Django's URL tag. 
> [] 
>

> I've opened ticket #18625 [1] to track this problem with Django's 
> documentation; thanks for the report! 
>
> [1] https://code.djangoproject.com/ticket/18625 
>
> Yours, 
> Russ Magee %-) 
>

Thanks! I can see that the ticket has already been fixed and committed. 
Fantastic!

Per-Olof 

-- 
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/-/AHOhN_wZJXcJ.
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: Is upgrading to a newer Django version generally hassle-free?

2012-07-15 Thread kenneth gonsalves
On Sat, 2012-07-14 at 13:38 -0700, Daniel Roseman wrote:
> Django makes a fairly strong commitment to backwards compatibility
> across versions, which is documented here:
> https://docs.djangoproject.com/en/1.4/misc/api-stability/
> They guarantee that any documented api will only be deprecated with
> two versions warning: for example, the old function-based generic
> views were marked as pending deprecated in 1.3, fully deprecated in
> 1.4, and will be removed completely in the future 1.5 release. So
> upgrading is usually pretty safe. 

also django is one of the few projects where one can happily run
production sites on trunk, upgrading every tuesday.
-- 
regards
Kenneth Gonsalves

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



Hierarchy Model

2012-07-15 Thread Setiaman Lee
Hi,

I want to implement hierarchy data model which is quite common in
Relational Data Model.

Let's say I have Employee model which has the relation to the boss which
link to the employee model itself.
It will look like this:

class Employee(models.Model):
empname = models.CharField(max_length=60)
boss = models.ForeignKey(Employee)
salary = models.integer()


Sample Data:

IDempname  bosssalary
--
1  albertnull  1
2  bert  1  5000
3  Chuck  1  5000
4  Donna  3  3000
5  Jack3  2000

Albert is the root with Bert and Chuck under him and Chuck has Donna and
Jack under him.

I got an error when I tried to sync to the database where Django telling me
that the employee is not exist in the Foreign key part.
Is there any way to manipulate this situation?

Cheers,
Setiaman

-- 
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: Query Distance from User

2012-07-15 Thread Nicolas Emiliani
On Sun, Jul 15, 2012 at 1:58 AM, JJ Zolper  wrote:

> So heres my goal:
>
> The user logins in and goes to a discover page. They enter a distance from
> their location as the requested results scope. Lets say 25 miles from where
> I live for example. Additionally they could pick like a genre or music but
> not as important.
>
> So they hit seach and see in a 25 mile spanse in all directions in a
> circle form the closest artists to their location. From there they can see
> the top result and click that and step through the top results from 1 to 2
> to 3 To top 10 and so on as much as their heart desires.
>
> So i was thinking maybe GeoIP might be good because it will use the users
> location and last known GeoIP of the artist for example.
>
>
I'm currently developing a project based on google maps, and it sounds that
you might want to take a look at their API,
You could use markers (latitude and longitude) for your artists, ask the
user to place themselves on the map and then
calculate if they are on the wanted area or not.

https://developers.google.com/maps/

I was curious if anyone had any ideas or better ideas then I had.
>
> Thanks so much,
>
> JJ Zolper
>
> --
> 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/-/_ERIIZrolmUJ.
> 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.
>



-- 
Nicolas Emiliani

Lo unico instantaneo en la vida es el cafe, y es bien feo.

-- 
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: Installing psycopg2 for PostGreSQL as django backend using virtualenv

2012-07-15 Thread Doug S


On Saturday, July 14, 2012 9:56:54 PM UTC-4, Doug S wrote:
>
> Hello django people,
> I'm just installing my PostgreSQL backend for my django projects that I 
> install in isolated virtualenv's
> I've followed what seem like easy installation instructions here:
> http://initd.org/psycopg/install/
> I have installed python-dev,   libpq-dev and 
> also postgresql-server-dev-9.1
> I workon my virtualenv and use its pip installation to install psycopg2:
> (env) $ sudo pip install psycopg2
> It appears to install successfully:
> Successfully installed psycopg2
> but when I use yolk to list my virtualenv packages or look in my 
> site-packages for my virtualenv or try to import psycopg2 I find that it is 
> not installed in the virtualenv like I thought it would be.
> I found I do have a psycopg2 installed in my system wide python 
> installation and I'm not sure if my attempt to install it locally actually 
> installed it globally or if the global installation was there to begin with 
> from some set up installation I did using someone else's code ( that I 
> don't pretend to understand )
>
> Two questions:
> 1) why didn't it install like I expected?
> 2) do I want psycopg2 insalled in my local virtualenv's python 
> installation for django? or should it be in my global python installation? 
>
>

-- 
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/-/u-JMJisgEwkJ.
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: Deployment: Apache2, wsgi (Debian squeeze)

2012-07-15 Thread Matt Smith

On 10/07/12 08:08, Rohan wrote:

Hi Matt,
If you do not have static serving enabled in your django application 
mapping to /static/ in urls.py, then the content is being served by 
Apache.


In settings.py I commented out the lines which assign MEDIA_ROOT, 
MEDIA_URL, and ADMIN_MEDIA_PREFIX because I couldn't see what they were 
good for, and I have no entry for /static/ in urls.py so I guess the 
content is being served by Apache, correct?


What is your MaxRequestsPerChild in your apache conf?


0 for all of prefork, worker and event mpm's

I apologise if this is OT for this list but I'm curious if you think the 
machine running apache is underpowered:


mds@waianakarua:~$ grep MHz /proc/cpuinfo
cpu MHz: 400.829
mds@waianakarua:~$ grep MemTotal /proc/meminfo
MemTotal: 185644 kB

Thx again,

--
Matt Smith
http://mattsmith.org.nz

--
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: Query Distance from User

2012-07-15 Thread Markus Gattol
You can use geolocation 
https://developers.google.com/maps/articles/geolocation and if that's not 
accurate enough let the user provide his address and with it query Google's 
https://developers.google.com/maps/documentation/javascript/geocoding API

The tricky bit here is if you want to get the lat/lng back onto your server 
so you can store it in your database. I ended up using 
https://github.com/abourget/gevent-socketio and store stuff in MongoDB 
using mongoengine.

-- 
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/-/k9QDjpoVxMgJ.
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: Query Distance from User

2012-07-15 Thread Markus Gattol
I can also recommend https://github.com/HPNeo/gmaps as a wrapper, speeds up 
and simplifies dealing with Google's API a lot.

On Sunday, 15 July 2012 17:30:16 UTC+2, Markus Gattol wrote:
>
> You can use geolocation 
> https://developers.google.com/maps/articles/geolocation and if that's not 
> accurate enough let the user provide his address and with it query Google's 
> https://developers.google.com/maps/documentation/javascript/geocoding API
>
> The tricky bit here is if you want to get the lat/lng back onto your 
> server so you can store it in your database. I ended up using 
> https://github.com/abourget/gevent-socketio and store stuff in MongoDB 
> using mongoengine.
>

-- 
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/-/GlhayzaEkwUJ.
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: Hierarchy Model

2012-07-15 Thread Andre Terra
-- Sent from my phone, please excuse any typos. --
On Jul 15, 2012 11:02 AM, "Setiaman Lee"  wrote:

> Hi,
>
> I want to implement hierarchy data model which is quite common in
> Relational Data Model.
>
> Let's say I have Employee model which has the relation to the boss which
> link to the employee model itself.
> It will look like this:
>
> class Employee(models.Model):
> empname = models.CharField(max_length=60)
> boss = models.ForeignKey(Employee)
> salary = models.integer()
>
>
> Sample Data:
>
> IDempname  bosssalary
> --
> 1  albertnull  1
> 2  bert  1  5000
> 3  Chuck  1  5000
> 4  Donna  3  3000
> 5  Jack3  2000
>
> Albert is the root with Bert and Chuck under him and Chuck has Donna and
> Jack under him.
>
> I got an error when I tried to sync to the database where Django telling
> me that the employee is not exist in the Foreign key part.
> Is there any way to manipulate this situation?
>
> Cheers,
> Setiaman
>
> --
> 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: Query Distance from User

2012-07-15 Thread JJ Zolper
Now that you mention it I like this idea a lot better! Okay I've changed my 
mind. My goal is to have the user input their location and then from there 
I run that againist my database of artists and depending on the request 
show the artists that are in those respective areas.

That's okay that you can't go into detail! I appreciate the input a lot 
nonetheless!

On Sunday, July 15, 2012 1:30:07 AM UTC-4, Kurtis wrote:
>
> Why not just have them enter their location? I'd comment more but I work 
> for a commercial site that looks like it might be treading in the same area 
> so I don't wanna get myself in trouble here :)
>
> On Sun, Jul 15, 2012 at 12:58 AM, JJ Zolper  wrote:
>
>> So heres my goal:
>>
>> The user logins in and goes to a discover page. They enter a distance 
>> from their location as the requested results scope. Lets say 25 miles from 
>> where I live for example. Additionally they could pick like a genre or 
>> music but not as important.
>>
>> So they hit seach and see in a 25 mile spanse in all directions in a 
>> circle form the closest artists to their location. From there they can see 
>> the top result and click that and step through the top results from 1 to 2 
>> to 3 To top 10 and so on as much as their heart desires.
>>
>> So i was thinking maybe GeoIP might be good because it will use the users 
>> location and last known GeoIP of the artist for example.
>>
>> I was curious if anyone had any ideas or better ideas then I had.
>>
>> Thanks so much,
>>
>> JJ Zolper
>>
>> -- 
>> 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/-/_ERIIZrolmUJ.
>> 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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/IKPWlSGKJqMJ.
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: Hierarchy Model

2012-07-15 Thread Andre Terra
I recommend using django-mptt. I can't link to it cause I'm writing on my
phone, but it's easy to find it on Google.

Also, your foreign key should target self rather than Employee, IIRC.

Cheers,
AT

-- Sent from my phone, please excuse any typos. --
On Jul 15, 2012 11:02 AM, "Setiaman Lee"  wrote:

> Hi,
>
> I want to implement hierarchy data model which is quite common in
> Relational Data Model.
>
> Let's say I have Employee model which has the relation to the boss which
> link to the employee model itself.
> It will look like this:
>
> class Employee(models.Model):
> empname = models.CharField(max_length=60)
> boss = models.ForeignKey(Employee)
> salary = models.integer()
>
>
> Sample Data:
>
> IDempname  bosssalary
> --
> 1  albertnull  1
> 2  bert  1  5000
> 3  Chuck  1  5000
> 4  Donna  3  3000
> 5  Jack3  2000
>
> Albert is the root with Bert and Chuck under him and Chuck has Donna and
> Jack under him.
>
> I got an error when I tried to sync to the database where Django telling
> me that the employee is not exist in the Foreign key part.
> Is there any way to manipulate this situation?
>
> Cheers,
> Setiaman
>
> --
> 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: Query Distance from User

2012-07-15 Thread JJ Zolper
I've heard from many resources that Google Maps API is one of the main 
preferred options. Thanks for sharing what you use!

What you have just explained seems to be a good option! Is the option to 
use latitude and longitude a very common one? I'm not 
as familiar as to which options of calculation have known to be the most 
stable, usable, fast, or efficient. Or there is any common
knowledge about the such thing.

Here's what I'm thinking. First the user enters their town for example so 
Vienna, VA. Then they choose how far from their location so 25 miles. But 
then they also have an advanced search option where they can refine their 
request even more. They are able to play around with a Google Map on the 
side and zoom into their physical house location on the map and put a 
marker/point there of some sort. This could be lat/long I don't know yet. 
This way if that data checks out they get and even more accurate 
representation of the artists in their area. Any thoughts or opinions on 
how you think I
should go about this?

Thanks so much! 

JJ 

On Sunday, July 15, 2012 10:22:53 AM UTC-4, Nicolas Emiliani wrote:
>
>
>
> On Sun, Jul 15, 2012 at 1:58 AM, JJ Zolper  wrote:
>
>> So heres my goal:
>>
>> The user logins in and goes to a discover page. They enter a distance 
>> from their location as the requested results scope. Lets say 25 miles from 
>> where I live for example. Additionally they could pick like a genre or 
>> music but not as important.
>>
>> So they hit seach and see in a 25 mile spanse in all directions in a 
>> circle form the closest artists to their location. From there they can see 
>> the top result and click that and step through the top results from 1 to 2 
>> to 3 To top 10 and so on as much as their heart desires.
>>
>> So i was thinking maybe GeoIP might be good because it will use the users 
>> location and last known GeoIP of the artist for example.
>>
>>
> I'm currently developing a project based on google maps, and it sounds 
> that you might want to take a look at their API,
> You could use markers (latitude and longitude) for your artists, ask the 
> user to place themselves on the map and then
> calculate if they are on the wanted area or not.
>  
> https://developers.google.com/maps/
>
> I was curious if anyone had any ideas or better ideas then I had.
>>
>> Thanks so much,
>>
>> JJ Zolper
>>
>> -- 
>> 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/-/_ERIIZrolmUJ.
>> 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.
>>
>
>
>
> -- 
> Nicolas Emiliani
>
> Lo unico instantaneo en la vida es el cafe, y es bien feo.
>

-- 
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/-/nuuh9ynmJPQJ.
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: Query Distance from User

2012-07-15 Thread JJ Zolper
I appreciate the input!

I've given the whole GeoIP and geolocation idea some thought and for me I 
think I've decided for my desktop version to steer clear of those
sort of options for the time being. Why? Well I want their to be extreme 
flexibility but also very accurate information. What do I mean? Well:

First the user enters their town for example so Vienna, VA. Then they 
choose how far from their location so 25 miles. But then they also have an 
advanced search option where they can refine their request even more. They 
are able to play around with a Google Map on the side and zoom into their 
physical house location on the map and put a marker/point there of some 
sort. This could be lat/long I don't know yet. This way if that data checks 
out they get an even more accurate representation of the artists in their 
area. Any thoughts or opinions on how you think I should go about this?

Currently I don't know if I will end up using Lat/Long as I'm too far to 
the beginning of development but it's a current option unless I hear of new 
things.

As you pointed out its tricky. Well, I can't confirm that quite yet. But I 
do appreciate you giving me what you used to make the Lat/Long work. I 
see that MongoDB is NoSQL? Do you use NoSQL for everything you are doing? 
I'm currently on PostgreSQL and I'm not sure how that would tie
into my project yet. What specs do you have? What system are you running?

Thanks,

JJ

On Sunday, July 15, 2012 11:30:16 AM UTC-4, Markus Gattol wrote:
>
> You can use geolocation 
> https://developers.google.com/maps/articles/geolocation and if that's not 
> accurate enough let the user provide his address and with it query Google's 
> https://developers.google.com/maps/documentation/javascript/geocoding API
>
> The tricky bit here is if you want to get the lat/lng back onto your 
> server so you can store it in your database. I ended up using 
> https://github.com/abourget/gevent-socketio and store stuff in MongoDB 
> using mongoengine.
>

-- 
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/-/xmnp4mmWs2QJ.
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: Query Distance from User

2012-07-15 Thread JJ Zolper
Thanks for the tip! I will keep record of this!

On Sunday, July 15, 2012 11:31:40 AM UTC-4, Markus Gattol wrote:
>
> I can also recommend https://github.com/HPNeo/gmaps as a wrapper, speeds 
> up and simplifies dealing with Google's API a lot.
>
> On Sunday, 15 July 2012 17:30:16 UTC+2, Markus Gattol wrote:
>>
>> You can use geolocation 
>> https://developers.google.com/maps/articles/geolocation and if that's 
>> not accurate enough let the user provide his address and with it query 
>> Google's 
>> https://developers.google.com/maps/documentation/javascript/geocoding API
>>
>> The tricky bit here is if you want to get the lat/lng back onto your 
>> server so you can store it in your database. I ended up using 
>> https://github.com/abourget/gevent-socketio and store stuff in MongoDB 
>> using mongoengine.
>>
>

-- 
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/-/gXqfkT1VHJ8J.
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: Query Distance from User

2012-07-15 Thread lacrymol...@gmail.com

It highly depends on what you want to do, the extension of the area you want to 
cover, and things like that. There's different projection systems for each area 
in the world, and making distance calculations on those projections is much 
faster than on global (lat lon) coordinates, but they're not accurate outside 
of the area they're designed for. Conversion between systems are easy enough.

-Mensaje original-
De: JJ Zolper
Enviados:  15/07/2012 13:37:10
Asunto:  Re: Query Distance from User

I've heard from many resources that Google Maps API is one of the main 
preferred options. Thanks for sharing what you use!

What you have just explained seems to be a good option! Is the option to 
use latitude and longitude a very common one? I'm not 
as familiar as to which options of calculation have known to be the most 
stable, usable, fast, or efficient. Or there is any common
knowledge about the such thing.

Here's what I'm thinking. First the user enters their town for example so 
Vienna, VA. Then they choose how far from their location so 25 miles. But 
then they also have an advanced search option where they can refine their 
request even more. They are able to play around with a Google Map on the 
side and zoom into their physical house location on the map and put a 
marker/point there of some sort. This could be lat/long I don't know yet. 
This way if that data checks out they get and even more accurate 
representation of the artists in their area. Any thoughts or opinions on 
how you think I
should go about this?

Thanks so much! 

JJ 

On Sunday, July 15, 2012 10:22:53 AM UTC-4, Nicolas Emiliani wrote:
>
>
>
> On Sun, Jul 15, 2012 at 1:58 AM, JJ Zolper  wrote:
>
>> So heres my goal:
>>
>> The user logins in and goes to a discover page. They enter a distance 
>> from their location as the requested results scope. Lets say 25 miles from 
>> where I live for example. Additionally they could pick like a genre or 
>> music but not as important.
>>
>> So they hit seach and see in a 25 mile spanse in all directions in a 
>> circle form the closest artists to their location. From there they can see 
>> the top result and click that and step through the top results from 1 to 2 
>> to 3 To top 10 and so on as much as their heart desires.
>>
>> So i was thinking maybe GeoIP might be good because it will use the users 
>> location and last known GeoIP of the artist for example.
>>
>>
> I'm currently developing a project based on google maps, and it sounds 
> that you might want to take a look at their API,
> You could use markers (latitude and longitude) for your artists, ask the 
> user to place themselves on the map and then
> calculate if they are on the wanted area or not.
>  
> https://developers.google.com/maps/
>
> I was curious if anyone had any ideas or better ideas then I had.
>>
>> Thanks so much,
>>
>> JJ Zolper
>>
>> -- 
>> 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/-/_ERIIZrolmUJ.
>> 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.
>>
>
>
>
> -- 
> Nicolas Emiliani
>
> Lo unico instantaneo en la vida es el cafe, y es bien feo.
>

-- 
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/-/nuuh9ynmJPQJ.
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: Hierarchy Model

2012-07-15 Thread lacrymol...@gmail.com

Put 'Employee' or if that fails, 'appname.Employee' with the quotes, as a 
string literal, this works for self-reference and reference loops. 

-Mensaje original-
De: Andre Terra
Enviados:  15/07/2012 13:30:05
Asunto:  Re: Hierarchy Model

I recommend using django-mptt. I can't link to it cause I'm writing on my
phone, but it's easy to find it on Google.

Also, your foreign key should target self rather than Employee, IIRC.

Cheers,
AT

-- Sent from my phone, please excuse any typos. --
On Jul 15, 2012 11:02 AM, "Setiaman Lee"  wrote:

> Hi,
>
> I want to implement hierarchy data model which is quite common in
> Relational Data Model.
>
> Let's say I have Employee model which has the relation to the boss which
> link to the employee model itself.
> It will look like this:
>
> class Employee(models.Model):
> empname = models.CharField(max_length=60)
> boss = models.ForeignKey(Employee)
> salary = models.integer()
>
>
> Sample Data:
>
> IDempname  bosssalary
> --
> 1  albertnull  1
> 2  bert  1  5000
> 3  Chuck  1  5000
> 4  Donna  3  3000
> 5  Jack3  2000
>
> Albert is the root with Bert and Chuck under him and Chuck has Donna and
> Jack under him.
>
> I got an error when I tried to sync to the database where Django telling
> me that the employee is not exist in the Foreign key part.
> Is there any way to manipulate this situation?
>
> Cheers,
> Setiaman
>
> --
> 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: Query Distance from User

2012-07-15 Thread Nicolas Emiliani


What you have just explained seems to be a good option! Is the option to 
> use latitude and longitude a very common one? I'm not 
> as familiar as to which options of calculation have known to be the most 
> stable, usable, fast, or efficient. Or there is any common
> knowledge about the such thing.
>

Well with (lat, long) you can point to any place on earth, it's like having 
an (x,y) point on a cartesian plane. 
And yes, it is the standard method.
 

>
> Here's what I'm thinking. First the user enters their town for example so 
> Vienna, VA. Then they choose how far from their location so 25 miles. But 
> then they also have an advanced search option where they can refine their 
> request even more. They are able to play around with a Google Map on the 
> side and zoom into their physical house location on the map and put a 
> marker/point there of some sort. This could be lat/long I don't know yet. 
> This way if that data checks out they get and even more accurate 
> representation of the artists in their area. Any thoughts or opinions on 
> how you think I
> should go about this?
>
>
With the (lat,long) that belongs to the user position yo can then ask for a 
radius in blocks, meters o whatever.
So, now you can get the surface of a circle and with some basic math you go 
through your db checking if any artist
are inside the limit of that circle.
 

> Thanks so much! 
>
> JJ 
>
> On Sunday, July 15, 2012 10:22:53 AM UTC-4, Nicolas Emiliani wrote:
>>
>>
>>
>> On Sun, Jul 15, 2012 at 1:58 AM, JJ Zolper  wrote:
>>
>>> So heres my goal:
>>>
>>> The user logins in and goes to a discover page. They enter a distance 
>>> from their location as the requested results scope. Lets say 25 miles from 
>>> where I live for example. Additionally they could pick like a genre or 
>>> music but not as important.
>>>
>>> So they hit seach and see in a 25 mile spanse in all directions in a 
>>> circle form the closest artists to their location. From there they can see 
>>> the top result and click that and step through the top results from 1 to 2 
>>> to 3 To top 10 and so on as much as their heart desires.
>>>
>>> So i was thinking maybe GeoIP might be good because it will use the 
>>> users location and last known GeoIP of the artist for example.
>>>
>>>
>> I'm currently developing a project based on google maps, and it sounds 
>> that you might want to take a look at their API,
>> You could use markers (latitude and longitude) for your artists, ask the 
>> user to place themselves on the map and then
>> calculate if they are on the wanted area or not.
>>  
>> https://developers.google.com/maps/
>>
>> I was curious if anyone had any ideas or better ideas then I had.
>>>
>>> Thanks so much,
>>>
>>> JJ Zolper
>>>
>>> -- 
>>> 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/-/_ERIIZrolmUJ.
>>> 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.
>>>
>>
>>
>>
>> -- 
>> Nicolas Emiliani
>>
>> Lo unico instantaneo en la vida es el cafe, y es bien feo.
>>
>

-- 
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/-/tGFuC9PBd4kJ.
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: Hierarchy Model

2012-07-15 Thread yarko


On Sunday, July 15, 2012 9:02:39 AM UTC-5, Setiaman wrote:
>
> Hi,
>
> I want to implement hierarchy data model which is quite common in 
> Relational Data Model.
>
> Let's say I have Employee model which has the relation to the boss which 
> link to the employee model itself.
> It will look like this:
>
> class Employee(models.Model):
> empname = models.CharField(max_length=60)
> boss = models.ForeignKey(Employee)
>

Employee is in the middle of being defined when you make this reference, so
... try something like:

boss = models.ForeignKey('Employee')   # delayed evaluation

or:

   boss = models.ForeignKey('self')  # I think this reads nicer

See https://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey

> salary = models.integer()
>
>
> Sample Data:
>
> IDempname  bosssalary
> --
> 1  albertnull  1
> 2  bert  1  5000
> 3  Chuck  1  5000
> 4  Donna  3  3000
> 5  Jack3  2000
>  
> Albert is the root with Bert and Chuck under him and Chuck has Donna and 
> Jack under him.
>
> I got an error when I tried to sync to the database where Django telling 
> me that the employee is not exist in the Foreign key part.
> Is there any way to manipulate this situation?
>
> Cheers,
> Setiaman
>


Regards,
Yarko 

-- 
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/-/d5YolTy8ZO8J.
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: Use Django to implement my GUI!

2012-07-15 Thread Eugène Ngontang
Hi all!

Hope you still remember this post which helps dive into django. I have gone
really ahead with my developments, and now i'm willing to make some
optimization and have some few issues. I don't know if I should open a new
thread for each one. You will tell me, but I prefered to do it here because
the initial thread was this one.

- First I can't use the HttpResponseRedirect() method in my application, it
does not work like it should. In fact in my models module, I have a
JobHistory class and a member function in that class which returns a link
for the listdisplay of that model in the admin module.
But when the id i'm looking for in the database does not exist, i would
like to redirect the user to a custum error page. And to that I used
HttpResponseRedirect() wich is unable to return the right address to the
browser. I tried such things, read the documentation several times but
nothing. I thought it was the reverse function which does not locate the
page but no, because even with google address the browser receive a
response address with some headers concatanated, and the browser cannot
access the page, cause it has an invalid address:
the code line in the models module:
def get_executing_user_url(self):
user_list = SystemUser.objects.filter(systemuser_name =
self.job_executing_user, host = self.job.host)
if not user_list:
return HttpResponse('http://www.google.com/')
#return HttpResponseRedirect('10.136.37.19:8080%s/'
% reverse('fancycron.views.job_exec_user_error',
args=(self.jobhistory_id,)))
else:
return '../systemuser/%s/' %
(user_list[0].systemuser_id)

You can see I've even tried to hardput the server address, but it did not
work, and I even tested with google and it didn't work too. Tell me if I
missed something in the use of HttpResponseRedirect. The error is not a
django error, but the returned address is just not accessible each any time
i try.

- The second issue is that I have implement my middleware (django) and
remote backend communication using django signals. It works, but as you can
expected, it's synchronous, and I would like now to do it asynchronously.
Is Celery the best option? If yes, could you please indicate me the
simplest and efficient way to set that up? Anyway, ho can I send messages
to my remote backend, without block in my browser rendering?

Some good and working tutorials are welcome.

Thank you a lot guys.
Eugène NG

2012/5/20 Eugène Ngontang 

> Yes you're right Marc!
>
> It's just that I wanted to mention the fact my application is not only a
> web site accessible via a web browser only, but a client-server application
> with web-based GUI.
>
> But now things are clear, we're all now ok with the problematic and with
> your help and great responses, i noticed it's better to do all my system
> communication based on HTTP.
>
> I thank you for all your attention, all new ideas are still well come, and
> i'll let you follow up the evelution of the development.
>
> Thanks guys.
>
>
>
>
> 2012/5/20 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 displaying and admin for the page content management like
>> any web
>> > aplication works.
>> >
>> > I please us unot to build a myster arround this thread. The problem was
>> > simple:
>>
>>
>> HI Eugène,
>> the problem was simple, but all we have misunderstood you because
>> usually the term GUI is used to refer "desktop application" rather
>> than a web page, which seems to be the case.
>>
>> br
>> --
>> 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.
>>
>>
>
>
> --
> ngont...@epitech.net
> sympav...@gmail.com
> 
> *Aux hommes il faut un chef, et au** chef il faut des hommes!*
>
>


-- 
ngont...@epitech.net
sympav...@gmail.com

*Aux hommes il faut un chef, et au** chef il faut des hommes!
L'habit ne fait pas le moine, mais lorsqu'on te voit on te juge!
*

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

Re: Catch or raise exception designissue

2012-07-15 Thread Andre Schemschat
Hey,
thanks for your replies. so the general idea is to dont catch the 500's, if 
there really is an situation which shouldnt happen. Thats was my first 
thought too, so i think i will stick with that and just code defensivly 
with exception-raising, when critical situations appear :)

On Saturday, July 14, 2012 11:23:29 PM UTC+2, Melvyn Sopacua wrote:
>
> [reformatted] 
>
> On 11-7-2012 20:41, Jani Tiainen wrote: 
> >> In my view i have, naturally, some code to process the request and 
> return 
> >> a response. This code needs a get-parameter to operate within 
> boundaries 
> >> and this parameter is always provided within the application (Its an 
> >> ajax-callback). 
> > I only do 500-errors when something really critical happens (basically 
> > programming error) in application and request can't proceed. 
>
> Which is why letting this explode on itself is a good thing. Your ajax 
> call should ensure the parameter is there. So when you get 500 errors 
> one of three things is happening: 
> - A browser does not handle the Ajax call correctly and you want the 500 
> error context mailed to you to start debugging 
> - A crawler that tries to interpret javascript is not doing a very good 
> job and you want to update your robots.txt or block the crawler if it 
> doesn't seem to be respecting it. 
> - You refactored the javascript code or upgraded a js library and there 
> now is a codepath that doesn't provide the parameter. Again, you want to 
> see the information and probably catch it before it goes into production. 
>
> Masking or reducing errors that should not normally happen is not a good 
> thing. This is exactly what exceptions are for. 
> -- 
> Melvyn Sopacua 
>
>
>

-- 
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/-/29FKbX-fR6cJ.
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: Catch or raise exception designissue

2012-07-15 Thread Jani Tiainen
I think "letting to explode" is all about coloring the bike shed. It all
depends on a API contract - if parameter is required (thus meaning missing
it is a critical error) it should explode.

In case of incorrect request I prefer to raise 400 (Bad Request) with some
explanation what went wrong. Since 500 is usually meant for "catch all"
unexpected errors that happened in web server and server can't be more
precise what happened. I've done that according to RFC 2616 (HTTP 1.1
Specification) where is said that 4xx codes are meant for "client side
error" (Section 10.4), and 5xx which means "server error" (Section 10.5)

But I think all of that is matter of taste...

On Sun, Jul 15, 2012 at 12:23 AM, Melvyn Sopacua wrote:

> [reformatted]
>
> On 11-7-2012 20:41, Jani Tiainen wrote:
> > On Wed, Jul 11, 2012 at 4:47 PM, Andre Schemschat  wrote:
> >> In my view i have, naturally, some code to process the request and
> return
> >> a response. This code needs a get-parameter to operate within boundaries
> >> and this parameter is always provided within the application (Its an
> >> ajax-callback).
> > I only do 500-errors when something really critical happens (basically
> > programming error) in application and request can't proceed.
>
> Which is why letting this explode on itself is a good thing. Your ajax
> call should ensure the parameter is there. So when you get 500 errors
> one of three things is happening:
> - A browser does not handle the Ajax call correctly and you want the 500
> error context mailed to you to start debugging
> - A crawler that tries to interpret javascript is not doing a very good
> job and you want to update your robots.txt or block the crawler if it
> doesn't seem to be respecting it.
> - You refactored the javascript code or upgraded a js library and there
> now is a codepath that doesn't provide the parameter. Again, you want to
> see the information and probably catch it before it goes into production.
>
> Masking or reducing errors that should not normally happen is not a good
> thing. This is exactly what exceptions are for.
> --
> 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.
>
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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: Query Distance from User

2012-07-15 Thread JJ Zolper
Well as far as what I want to do I explained that above.

User requests in all directions a circle spanse of 25 miles i.e. and theres a 
return of artists in that area.

As far as the area I want to cover I would like to start with the northern 
virginia area and expand from there. A goal set for the entire United States if 
that gives you an idea.

Well if possible I would like 1 system to cover the entire United States I dont 
want to have to handle like okay so in minnesota what system am i going to make 
for them or in los angeles what system for them. Im going to a massive spanse 
of land here i want flexibility so the user can be like im in VA but traveling 
to FL for the weekend I want to see some bands playing there and see if they 
have shows etc etc etc.

Thanks,

JJ

-- 
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/-/Jo1IMZuXjJ8J.
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: Query Distance from User

2012-07-15 Thread JJ Zolper
Awesome sounds like lat long is the way to go to be able to cover the entire US.

And yeah im pretty good at math thanks for the tip Ill work on that soon!

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



unable to override widget

2012-07-15 Thread Nicolas Emiliani
Hi!

I'm trying to override the AdminFileWidget with no success. The idea is to
get a thumbnail
next to the uploaded files in a tabular view of the admin site. I did the
following :

class AdminImageWidget(AdminFileWidget):
def render(self, name, value, attrs=None):


-- 
Nicolas Emiliani

Lo unico instantaneo en la vida es el cafe, y es bien feo.

-- 
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: unable to override widget

2012-07-15 Thread Nicolas Emiliani
Crap, hit the send key, there it goes. Sorry.


Hi!
>
> I'm trying to override the AdminFileWidget with no success. The idea is to
> get a thumbnail
> next to the uploaded files in a tabular view of the admin site. I did the
> following :
>
> class AdminImageWidget(AdminFileWidget):
> def render(self, name, value, attrs=None):
>
>
Override the widget class for the image field

class ImageGalleryForm(forms.ModelForm):
'''
Image Admin form
'''
class Meta:
model = HomeImage
fields =('image','description','name','height','width',)
widgets = {
'image' : AdminImageWidget,
}


Here I set the Form

class ImageGaleryInline(admin.TabularInline):
form = ImageGalleryForm
model = HomeImage
extra = 3

fieldsets = [
(None, {
'fields' : [
('image','description','name','height','width'),
]
}
),
]


But the widget still shows itself as the AdminFileWidget, Am I missing
something ?

Thanks



>
> --
> Nicolas Emiliani
>
> Lo unico instantaneo en la vida es el cafe, y es bien feo.
>



-- 
Nicolas Emiliani

Lo unico instantaneo en la vida es el cafe, y es bien feo.

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



satchmo and django-admin-tools

2012-07-15 Thread אברהם סרור
Hi,

I'm trying to use django admin tools with satchmo, I installed satchmo in 
my dev machine and made a store with clonesatchmo.py
after that the store seemed to be running fine, so I installed 
django-admin-tools using the instructions on their website

but I didn't manage to make it work, I spent about a week googling, I think 
I must be doing some obvious mistake

anyone had success using both together? where can I see an example 
settings.py?

Also I have in mind grappelli, can the three work together?

any help is appreciated
thanks

-- 
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/-/PyVTP5tNkqMJ.
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: access the state of a Model object prior to it's modification ?

2012-07-15 Thread Jani Tiainen
Hi,

How about telling us what are you trying to achieve by comparing to
previous state of the object?

On Sun, Jul 15, 2012 at 1:49 AM, Nicolas Emiliani  wrote:

> Hi,
>
> Is there a way to access the state of a Model object prior to it's
> modification through a form ?
> Kind of a nasty question :S, let me explain.
>
> The thing is that if i use the save_model hook and the user modifies the
> model through the form,
> the obj parameter that I receive has already all the modifications loaded,
> so if  I have, let's say,
> a boolean attribute called "published"  and the user clicked published
> then :
>
> obj.published == True
>
> Is there a way to know which was the state of the model, in this case the
> state of obj.published,
> before the user clicked on the save button on the admin form ? or should I
> use a second model
> attribute and hide it on the form to keep the previous state ? is there a
> "Django" way to do this ?
>
> It's my first post, be gentle :P
>
> Thanks !
>
> --
> Nicolas Emiliani
>
> Lo unico instantaneo en la vida es el cafe, y es bien feo.
>
> --
> 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.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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: Query Distance from User

2012-07-15 Thread JJ Zolper
I'm also thinking since Northern VA is so big in terms of people if I get a 
good thing going here I can port that to other major cities but if I find a 
less server heavy method I can use that for smaller areas possibly. Not 
sure, I'll see.

JJ

On Sunday, July 15, 2012 1:22:10 PM UTC-4, Nicolas Emiliani wrote:
>
>
>
> What you have just explained seems to be a good option! Is the option to 
>> use latitude and longitude a very common one? I'm not 
>> as familiar as to which options of calculation have known to be the most 
>> stable, usable, fast, or efficient. Or there is any common
>> knowledge about the such thing.
>>
>
> Well with (lat, long) you can point to any place on earth, it's like 
> having an (x,y) point on a cartesian plane. 
> And yes, it is the standard method.
>  
>
>>
>> Here's what I'm thinking. First the user enters their town for example so 
>> Vienna, VA. Then they choose how far from their location so 25 miles. But 
>> then they also have an advanced search option where they can refine their 
>> request even more. They are able to play around with a Google Map on the 
>> side and zoom into their physical house location on the map and put a 
>> marker/point there of some sort. This could be lat/long I don't know yet. 
>> This way if that data checks out they get and even more accurate 
>> representation of the artists in their area. Any thoughts or opinions on 
>> how you think I
>> should go about this?
>>
>>
> With the (lat,long) that belongs to the user position yo can then ask for 
> a radius in blocks, meters o whatever.
> So, now you can get the surface of a circle and with some basic math you 
> go through your db checking if any artist
> are inside the limit of that circle.
>  
>
>> Thanks so much! 
>>
>> JJ 
>>
>> On Sunday, July 15, 2012 10:22:53 AM UTC-4, Nicolas Emiliani wrote:
>>>
>>>
>>>
>>> On Sun, Jul 15, 2012 at 1:58 AM, JJ Zolper  wrote:
>>>
 So heres my goal:

 The user logins in and goes to a discover page. They enter a distance 
 from their location as the requested results scope. Lets say 25 miles from 
 where I live for example. Additionally they could pick like a genre or 
 music but not as important.

 So they hit seach and see in a 25 mile spanse in all directions in a 
 circle form the closest artists to their location. From there they can see 
 the top result and click that and step through the top results from 1 to 2 
 to 3 To top 10 and so on as much as their heart desires.

 So i was thinking maybe GeoIP might be good because it will use the 
 users location and last known GeoIP of the artist for example.


>>> I'm currently developing a project based on google maps, and it sounds 
>>> that you might want to take a look at their API,
>>> You could use markers (latitude and longitude) for your artists, ask the 
>>> user to place themselves on the map and then
>>> calculate if they are on the wanted area or not.
>>>  
>>> https://developers.google.com/maps/
>>>
>>> I was curious if anyone had any ideas or better ideas then I had.

 Thanks so much,

 JJ Zolper

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

>>>
>>>
>>>
>>> -- 
>>> Nicolas Emiliani
>>>
>>> Lo unico instantaneo en la vida es el cafe, y es bien feo.
>>>
>>

-- 
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/-/xqKHuCVictIJ.
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: Query Distance from User

2012-07-15 Thread JJ Zolper
By UTM do you mean Universal Transverse Mercator?

Well hmm I'm not quite sure what issue i would run into with someone living 
on the edge of the zone.

Typically this request is a one time thing. The request goes in and the 
person either is within (on the line inside) the boundary
or they are just out side. There are no moving parts here no flow of data 
across the screen just a direct request and a 
return of who fits that data. This search doesn't have to be built proof I 
mean I just want to get a basis of how to do this
so I can see what happens.

Also the portion about meters confuses me. Whats the benefit of the portion 
at the end?

On Sunday, July 15, 2012 4:23:34 PM UTC-4, Dennis Lee Bieber wrote:
>
> On Sun, 15 Jul 2012 09:47:12 -0700 (PDT), JJ Zolper 
>  declaimed the following in 
> gmane.comp.python.django.user: 
>
>
> > First the user enters their town for example so Vienna, VA. Then they 
> > choose how far from their location so 25 miles. But then they also have 
> an 
> > advanced search option where they can refine their request even more. 
> They 
> > are able to play around with a Google Map on the side and zoom into 
> their 
> > physical house location on the map and put a marker/point there of some 
> > sort. This could be lat/long I don't know yet. This way if that data 
> checks 
> > out they get an even more accurate representation of the artists in 
> their 
> > area. Any thoughts or opinions on how you think I should go about this? 
> > 
> I'm tempted to suggest using UTM internally, but you'd probably 
> end 
> up with somebody living on the edge of a zone, and having to special 
> case the search radius as it crosses the zone boundary. 
>
> Reason to consider UTM? Coordinates are in meters, and computing 
> if 
> a point is within a 4m (40km => ~25 miles) just becomes a case of 
> applying Pythagoras [sqrt((x1-x2)^2 + (y1-y2)^2) <= radius]. 
>
> http://www.uwgb.edu/dutchs/usefuldata/utmformulas.htm 
> -- 
> Wulfraed Dennis Lee Bieber AF6VN 
> wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/ 
>
>

-- 
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/-/uynE7lYpqrwJ.
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: Query Distance from User

2012-07-15 Thread Jani Tiainen
Or if your database backend supports spatial fields, you can let the
database to do the hard work and use Geodjango (built-in GIS extension)
which supports spatial operations like query by distance within.

I think most standard databases can do that (mysql, postgresql, sqlite,
oracle) but I would recommend postgres + postgis if possible.

Then everything is just matter of taste, you can pick pretty much any
coordinate system and you get the results you want. No math involved.

On Mon, Jul 16, 2012 at 2:12 AM, JJ Zolper  wrote:

> I'm also thinking since Northern VA is so big in terms of people if I get
> a good thing going here I can port that to other major cities but if I find
> a less server heavy method I can use that for smaller areas possibly. Not
> sure, I'll see.
>
> JJ
>
>
> On Sunday, July 15, 2012 1:22:10 PM UTC-4, Nicolas Emiliani wrote:
>>
>>
>>
>> What you have just explained seems to be a good option! Is the option to
>>> use latitude and longitude a very common one? I'm not
>>> as familiar as to which options of calculation have known to be the most
>>> stable, usable, fast, or efficient. Or there is any common
>>> knowledge about the such thing.
>>>
>>
>> Well with (lat, long) you can point to any place on earth, it's like
>> having an (x,y) point on a cartesian plane.
>> And yes, it is the standard method.
>>
>>
>>>
>>> Here's what I'm thinking. First the user enters their town for example
>>> so Vienna, VA. Then they choose how far from their location so 25 miles.
>>> But then they also have an advanced search option where they can refine
>>> their request even more. They are able to play around with a Google Map on
>>> the side and zoom into their physical house location on the map and put a
>>> marker/point there of some sort. This could be lat/long I don't know yet.
>>> This way if that data checks out they get and even more accurate
>>> representation of the artists in their area. Any thoughts or opinions on
>>> how you think I
>>> should go about this?
>>>
>>>
>> With the (lat,long) that belongs to the user position yo can then ask for
>> a radius in blocks, meters o whatever.
>> So, now you can get the surface of a circle and with some basic math you
>> go through your db checking if any artist
>> are inside the limit of that circle.
>>
>>
>>> Thanks so much!
>>>
>>> JJ
>>>
>>> On Sunday, July 15, 2012 10:22:53 AM UTC-4, Nicolas Emiliani wrote:



 On Sun, Jul 15, 2012 at 1:58 AM, JJ Zolper wrote:

> So heres my goal:
>
> The user logins in and goes to a discover page. They enter a distance
> from their location as the requested results scope. Lets say 25 miles from
> where I live for example. Additionally they could pick like a genre or
> music but not as important.
>
> So they hit seach and see in a 25 mile spanse in all directions in a
> circle form the closest artists to their location. From there they can see
> the top result and click that and step through the top results from 1 to 2
> to 3 To top 10 and so on as much as their heart desires.
>
> So i was thinking maybe GeoIP might be good because it will use the
> users location and last known GeoIP of the artist for example.
>
>
 I'm currently developing a project based on google maps, and it sounds
 that you might want to take a look at their API,
 You could use markers (latitude and longitude) for your artists, ask
 the user to place themselves on the map and then
 calculate if they are on the wanted area or not.

 https://developers.google.com/**maps/

 I was curious if anyone had any ideas or better ideas then I had.
>
> Thanks so much,
>
> JJ Zolper
>
> --
> 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/-/_**ERIIZrolmUJ
> .
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@**googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>



 --
 Nicolas Emiliani

 Lo unico instantaneo en la vida es el cafe, y es bien feo.

>>>  --
> 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/-/xqKHuCVictIJ.
>
> 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.goo

Re: Query Distance from User

2012-07-15 Thread JJ Zolper
Yeah I'm trying to get GeoDjango set up as we speak. GeoDjango sounds 
awesome.

I have postgresql and Im trying to install postgis but im getting this:

jjz@jjz-Laptop:~$ wget 
http://postgis.refractions.net/download/postgis-1.5.2.tar.gz
--2012-07-15 19:40:12-- 
 http://postgis.refractions.net/download/postgis-1.5.2.tar.gz
Resolving postgis.refractions.net (postgis.refractions.net)... 199.103.56.11
Connecting to postgis.refractions.net 
(postgis.refractions.net)|199.103.56.11|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3749293 (3.6M) [application/x-gzip]
Saving to: `postgis-1.5.2.tar.gz'

100%[==>] 3,749,293345K/s   in 7.1s 
   

2012-07-15 19:40:20 (516 KB/s) - `postgis-1.5.2.tar.gz' saved 
[3749293/3749293]

jjz@jjz-Laptop:~$ tar xzf postgis-1.5.2.tar.gz
jjz@jjz-Laptop:~$ cd postgis-1.52
bash: cd: postgis-1.52: No such file or directory
jjz@jjz-Laptop:~$ cd postgis-1.5.2
jjz@jjz-Laptop:~/postgis-1.5.2$ ./configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... 
yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking how to run the C preprocessor... gcc -E
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking whether we are using the GNU C++ compiler... (cached) no
checking whether g++ accepts -g... (cached) no
checking if gcc supports -Wall... yes
checking if gcc supports -Wmissing-prototypes... yes
checking if gcc supports -ffloat-store... yes
checking for flex... no
checking for lex... no
checking for bison... no
checking for byacc... no
checking ieeefp.h usability... no
checking ieeefp.h presence... no
checking for ieeefp.h... no
checking for convert... no
configure: WARNING: ImageMagick does not seem to be installed. 
Documentation cannot be built
checking for xsltproc... no
configure: WARNING: xsltproc is not installed so documentation cannot be 
built
checking for dblatex... no
conf

Re: Query Distance from User

2012-07-15 Thread Thomas Lockhart

On 7/15/12 4:41 PM, JJ Zolper wrote:
Yeah I'm trying to get GeoDjango set up as we speak. GeoDjango sounds 
awesome.

I have postgresql and Im trying to install postgis but im getting this:
FIx your errors in the configure step before bothering to try building. 
In this case you need libxml2 installed; should be available in your 
distro (as is Postgres). If you are using the distro Postgres then you 
will probably want to install postgis as root.


hth

   - Tom



jjz@jjz-Laptop:~$ wget 
http://postgis.refractions.net/download/postgis-1.5.2.tar.gz
--2012-07-15 19:40:12-- 
 http://postgis.refractions.net/download/postgis-1.5.2.tar.gz
Resolving postgis.refractions.net (postgis.refractions.net)... 
199.103.56.11
Connecting to postgis.refractions.net 
(postgis.refractions.net)|199.103.56.11|:80... connected.

HTTP request sent, awaiting response... 200 OK
Length: 3749293 (3.6M) [application/x-gzip]
Saving to: `postgis-1.5.2.tar.gz'

100%[==>] 3,749,293345K/s   in 
7.1s


2012-07-15 19:40:20 (516 KB/s) - `postgis-1.5.2.tar.gz' saved 
[3749293/3749293]


jjz@jjz-Laptop:~$ tar xzf postgis-1.5.2.tar.gz
jjz@jjz-Laptop:~$ cd postgis-1.52
bash: cd: postgis-1.52: No such file or directory
jjz@jjz-Laptop:~$ cd postgis-1.5.2
jjz@jjz-Laptop:~/postgis-1.5.2$ ./configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared 
libraries... yes

checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking how to run the C preprocessor... gcc -E
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking whether we are using the GNU C++ compiler... (cached) no
checking whether g++ accepts -g... (cached) no
checking if gcc supports -Wall... yes
checking if gcc supports -Wmissing-prototypes... yes
checking if gcc supports -ffloat-store... yes
checking for flex... no
checking for lex... no
checking for bison... no
checking for byacc... no
checking ieee

rpc4django : convert escaped unicode to characters for textarea

2012-07-15 Thread wgw
When an rpc json call returns escaped unicode  from python (something like 
\u00e8), how do I  decode in javascript those escaped characters? (Is it 
really as complicated as indicated here:  
http://www.rishida.net/tools/conversion/conversionfunctions.js)

I tried the rpc functions at http://rpc4django.davidfischer.name/ . 
Mytestmethod with special characters. It returns escaped unicode, so è + à 
+ é gives  "\u00e8\u00e0\u00e9". How do I transform that into characters 
that I can display on the page in, say, a textarea? I'm assuming this has 
to be done on the javascript side. 

from rpc4django: 

{
"id": "djangorpc",
"method": "rpc4django.mytestmethod",
"params": [
   "è","à","é"
]
}

I get  {"result": "\u00e8\u00e0\u00e9", "id": "djangorpc", "error": null}


-- 
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/-/dseoeE5uStgJ.
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: clean up media file

2012-07-15 Thread ephan
Thanks, was looking for something like this.

On Jul 14, 4:55 pm, -RAX-  wrote:
> Hi all,
>
> I am opensourcing a tool for cleaning all the media upload files.
> It is basically browsing your DB and deleting all the media files which are
> not linked by the DB.
>
> We implemented this tool since django 1.3 in which FileFIeld files are no
> longer deleted when the model is deleted.
> You can fine the source code 
> here:https://github.com/msama/django-uploadcleaner

-- 
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: clean up media file

2012-07-15 Thread ephan
Thanks, was looking for something like this.

On Jul 14, 4:55 pm, -RAX-  wrote:
> Hi all,
>
> I am opensourcing a tool for cleaning all the media upload files.
> It is basically browsing your DB and deleting all the media files which are
> not linked by the DB.
>
> We implemented this tool since django 1.3 in which FileFIeld files are no
> longer deleted when the model is deleted.
> You can fine the source code 
> here:https://github.com/msama/django-uploadcleaner

-- 
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: access the state of a Model object prior to it's modification ?

2012-07-15 Thread Nicolas Emiliani
On Sun, Jul 15, 2012 at 8:10 PM, Jani Tiainen  wrote:

> Hi,
>
> How about telling us what are you trying to achieve by comparing to
> previous state of the object?
>
>
Well, the model has a boolean field called published, and a publish_date
that gets set "automatically"
when the user through the admin panel sets the flag published to true. He
could also unpublish it, but the
date would still remain the same (on the date it was first published). And
here comes the problem :

If the user decides to republish I would have to set the date to current
date, but how do I know if he
is republishing or he modified some other field that has nothing to do with
that attribute ? I would be
republishing only if it's previous state was not published. But how can I
acces that previous state ?

Sounds waky :P



> On Sun, Jul 15, 2012 at 1:49 AM, Nicolas Emiliani wrote:
>
>> Hi,
>>
>> Is there a way to access the state of a Model object prior to it's
>> modification through a form ?
>> Kind of a nasty question :S, let me explain.
>>
>> The thing is that if i use the save_model hook and the user modifies the
>> model through the form,
>> the obj parameter that I receive has already all the modifications
>> loaded, so if  I have, let's say,
>> a boolean attribute called "published"  and the user clicked published
>> then :
>>
>> obj.published == True
>>
>> Is there a way to know which was the state of the model, in this case the
>> state of obj.published,
>> before the user clicked on the save button on the admin form ? or should
>> I use a second model
>> attribute and hide it on the form to keep the previous state ? is there a
>> "Django" way to do this ?
>>
>> It's my first post, be gentle :P
>>
>> Thanks !
>>
>> --
>> Nicolas Emiliani
>>
>> Lo unico instantaneo en la vida es el cafe, y es bien feo.
>>
>> --
>> 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.
>>
>
>
>
> --
> Jani Tiainen
>
> - Well planned is half done, and a half done has been sufficient before...
>
>  --
> 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.
>



-- 
Nicolas Emiliani

Lo unico instantaneo en la vida es el cafe, y es bien feo.

-- 
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: Hierarchy Model

2012-07-15 Thread Setiaman Lee
Hi All,

It works by blocking it with the single quote. :)
Thanks for the help.

Cheers,
Setiaman
On Jul 16, 2012 2:44 AM, "yarko"  wrote:

>
>
> On Sunday, July 15, 2012 9:02:39 AM UTC-5, Setiaman wrote:
>>
>> Hi,
>>
>> I want to implement hierarchy data model which is quite common in
>> Relational Data Model.
>>
>> Let's say I have Employee model which has the relation to the boss which
>> link to the employee model itself.
>> It will look like this:
>>
>> class Employee(models.Model):
>> empname = models.CharField(max_length=**60)
>> boss = models.ForeignKey(Employee)
>>
>
> Employee is in the middle of being defined when you make this reference, so
> ... try something like:
>
> boss = models.ForeignKey('Employee')   # delayed evaluation
>
> or:
>
>boss = models.ForeignKey('self')  # I think this reads nicer
>
> See https://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey
>
>> salary = models.integer()
>>
>>
>> Sample Data:
>>
>> IDempname  bosssalary
>> --**
>> 1  albertnull  1
>> 2  bert  1  5000
>> 3  Chuck  1  5000
>> 4  Donna  3  3000
>> 5  Jack3  2000
>>
>> Albert is the root with Bert and Chuck under him and Chuck has Donna and
>> Jack under him.
>>
>> I got an error when I tried to sync to the database where Django telling
>> me that the employee is not exist in the Foreign key part.
>> Is there any way to manipulate this situation?
>>
>> Cheers,
>> Setiaman
>>
>
>
> Regards,
> Yarko
>
> --
> 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/-/d5YolTy8ZO8J.
> 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.



Django Models: How to allow users to select an image from a choice of 3 pictures

2012-07-15 Thread croberts
I am familiar with the use of Field.choices for text.

However, I'd like the same option for images.  Is this possible?  I want 
users to select one image from a list of 3 and be able to save this.  They 
can later come back in and change it if they wish.  I know that in order to 
save this, it must be in Models.

The idea:

Each day, the has the option of selecting an image: happy face, sad face, 
smiley face of how they are feeling.  Their selection is saved.  They can 
go in later to change it if they wish.

ImageField doesn't seem to do this.  It seems to only allow for uploaded 
images as opposed to a choice.

-- 
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/-/Cr7s4l8i_bcJ.
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 Models: How to allow users to select an image from a choice of 3 pictures

2012-07-15 Thread Ivan Ivanov
На Sun, 15 Jul 2012 18:26:02 -0700 (PDT)
croberts  написа:

> I am familiar with the use of Field.choices for text.
> 
> However, I'd like the same option for images.  Is this possible?  I
> want users to select one image from a list of 3 and be able to save
> this.  They can later come back in and change it if they wish.  I
> know that in order to save this, it must be in Models.
> 
> The idea:
> 
> Each day, the has the option of selecting an image: happy face, sad
> face, smiley face of how they are feeling.  Their selection is
> saved.  They can go in later to change it if they wish.
> 
> ImageField doesn't seem to do this.  It seems to only allow for
> uploaded images as opposed to a choice.
> 
Use Choice field with image in the option. You do not need FIleField,
couse you don't operate with files at all. You just want to put an
image in a select.

There are several ways to achieve this:
background image (pure html+css)
http://binnyva.blogspot.com/2006/01/icons-for-select-menu-options-in.html

Jquery UI;
or something like this:
http://www.marghoobsuleman.com/jquery-image-dropdown

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