Re: Massive import from CSV to Database

2011-11-12 Thread Fabio Natali

On 11/12/2011 07:40 PM, Andre Terra wrote:

Hello,  Fabio

I took a look at django-csv-importer but since my files weren't quite
clean (or comma separated), I ended up rolling my own solution using
celery[1], to make the uploading rask asynchronous, and DSE[2], to allow
for faster bulk imports, as well as a lot of trial and error.


Dear Andre,

thank you very much for your reply.

As for these first attempts, import speed was not my primary concern. I 
just didn't think of it, but I'll probably have to change my mind! So, 
thank you for your tips!


Nonetheless, I am having some problems with django-csv-importer which I 
will be happy to solve.


What I am trying to do is just the "Basic sample" in here:
http://django-csv-importer.readthedocs.org/en/latest/index.html

Here is my try:

###
from django.db import models
from csvImporter.model import CsvModel

class MyCsvModel(CsvModel):
name = models.CharField()
age = models.IntegerField()
length = models.FloatField()
class Meta:
delimiter = ";"

my_csv_list = MyCsvModel.import_data(data = open("file.csv"))
###

My file.csv has just one line: "anthony;35;180.5".
my_csv_list = MyCsvModel.import_data(data = open("file.csv"))

This is the error I get:
ImproperlyConfigured: No field defined. Should have at least one field 
in the model.


What am I doing wrong?

All the best to you and everybody who's listening.

Fabio.

--
Fabio Natali

--
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: [] Re: memcached - Errors and Solution - please provide comments!

2011-11-12 Thread Russell Keith-Magee
On Sun, Nov 13, 2011 at 11:35 AM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> +1 on hashing the key.
> Just my two cents worth but, the way our company does it as standard is
> something like this:
> import hashlib
> def generate_key(*args, **kwargs):
>     return hashlib.sha224(pickle.dumps([args, kwargs])).hexdigest()
> Then you can do stuff like:
> lol = YourModel.objects.all()[0]
> generate_key('YourModel', lol.id, 'other stuff')

Or, alternatively, you could use the cache-key transformation feature
that Django has baked in:

https://docs.djangoproject.com/en/1.3/topics/cache/#cache-key-transformation

Using hashes for memcache keys isn't a completely no-brainer choice --
there are tradeoffs. For example:

 * Hashes aren't free to compute. If you have to generate a lot of
them (and you need to generate them on both read and write), there's a
CPU cost. Caching is supposed to be a mechanism by which you exchange
CPU load for memory; putting a CPU intensive operation in that path
isn't necessarily a good idea.

 * Your memcache keys aren't human readable, and aren't reversible to
human-readable values, so it's potentially harder to debug caching
problems.

 * You introduce a potential collision problem. In practice, this
probably isn't very likely, but it's *possible*; if you don't use
hashes, it isn't possible at all.

Therefore, Django provides a simple and conservative default, but
provides all the tools you need to override the default behavior. If
you decide on a per-site basis that hashing cache keys is a worthwhile
activity, you can implement that behavior easily.

Yours,
Russ Magee %-)

-- 
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: maultiple .js files for debug and one minimized .js for production

2011-11-12 Thread Eric Chamberlain
We serve the static files from Amazon S3.

--
Eric Chamberlain, Founder
RingFree Mobility Inc.

On Nov 8, 2011, at 1:46 AM, Gelonida N wrote:

> Hi,
> 
> 
> I'm having an rather weak (CPU) server accesible over a rather slow network.
> 
> Therfore my  plan is to use
> multiple readable debuggable css files for debugging and
> a single, minizmized  .js for for production.
> 
> This will affect some of my templates.
> 
> How do you handle this setup in your projects.
> 
> If statements in the templates?
> multiple template files and copying over one or the other?
> ???
> 
> In order to build the minimized files?
> Is there any 'intelligent' plugin, which can locates and minimizes all
> the .js files or do you go for a make file like approach or just a
> simple script (finding / minimizing)
> 
> Thanks in advance for any suggestions.
> 
> -- 
> 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: [] Re: memcached - Errors and Solution - please provide comments!

2011-11-12 Thread Cal Leeming [Simplicity Media Ltd]
+1 on hashing the key.

Just my two cents worth but, the way our company does it as standard is
something like this:

import hashlib
def generate_key(*args, **kwargs):
return hashlib.sha224(pickle.dumps([args, kwargs])).hexdigest()

Then you can do stuff like:
lol = YourModel.objects.all()[0]
generate_key('YourModel', lol.id, 'other stuff')

We actually have a replacement caching class which does all this stuff
behind the scenes that uses this approach, been doing this for almost a
year with not a single problem so far (although ours still uses md5, rather
than sha224)

Cal


On Thu, Nov 10, 2011 at 12:07 PM, Henrik Genssen
wrote:

> Hi inonc,
>
> >Why am I the only one who seems to be faced with such issues?
> >I thought millions out there do use memcached as their backend...?
> >Wouldn't be MD5 a great solution to all of us? The guys with small
> >sites, don't have issues with scaling, and the guys with big sites are
> >in the need of a stable memcached backend.
> >
> >Thanks for your help
> >ionic
>
> this is a question I stopped asking my self.
> We inherited the cache-module and overwrote simply the problematic
> function, where the key are generated (also to support caching POST
> requests).
> I was tiered, discussing the need for this (e.g. for XMLRPC requests - as
> 2 + 2 might always be 4 :-)
>
> regards
>
> Henrik
>
> --
> 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: ForeignKey relationship to FlatPage not available in filter()

2011-11-12 Thread Sceva
I think the problem was I did not have 

from django.db import models


at the top. 

-- 
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/-/cBRkBTlxUuQJ.
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 many read operations is the get() method causing?

2011-11-12 Thread Emil Sandin
Hi, I am running a Django app on appengine, but I am constantly
hitting the roof with read operations.
I have not found an easy way to find what's causing this, so I am
trying to find it out myself.
To me, it seems that even if I use all().filter(..) or get(), the
database is queried for all instances.

I wrote a custom manager like this:

class LoggingManager(models.Manager):
def get_query_set(self):
query_set = super(SignalsManager, self).get_query_set()
logging.debug("Got the following queryset from the backend:")
logging.debug(query_set)
if query_set.count():
key = "num_of_reads_for_" + str(type(query_set[0]))
num_of_calls_so_far = memcache.get(key) or 0
num_of_calls_so_far += query_set.count()
memcache.delete(key)
memcache.add(key, num_of_calls_so_far )
logging.debug("++")
logging.debug("total number of reads for " + key)
logging.debug(num_of_calls_so_far)
logging.debug("--")
return query_set

I then created a class:

class Foo(models.Model):
bar = models.CharField(max_length=10)
objects = LoggingManager()

When I tried this in the shell I got:

>>> Foo(bar="Hi").save()
>>> Foo(bar="there").save()
>>> Foo.objects.get(bar="Hi")
DEBUG:root:Got the following queryset from the backend:
DEBUG:root:[, ]
DEBUG:root:++
DEBUG:root:total number of reads for num_of_reads_for_
DEBUG:root:2
DEBUG:root:--

>>> Foo.objects.all().filter(bar="Hi")
DEBUG:root:Got the following queryset from the backend:
DEBUG:root:[, ]
DEBUG:root:++
DEBUG:root:total number of reads for num_of_reads_for_
DEBUG:root:4
DEBUG:root:--
[]
>>> Foo.objects.all().filter(bar="NotExisting")
DEBUG:root:Got the following queryset from the backend:
DEBUG:root:[, ]
DEBUG:root:++
DEBUG:root:total number of reads for num_of_reads_for_
DEBUG:root:6
DEBUG:root:--
[]

According to the Django documentation, 'the act of creating a QuerySet
doesn't involve any database activity'.
But since the queryset contains two instances of Foo object when I use
the get() method or all().filter(), isn't the database queried for all
Foo instances? And then the queryset is filtered?
Am I doing something wrong here? Is there a better way to do this?
And does anybody know how this would affect App Engines Quote Details,
since they have a limit of number of operations?

I am using:
Python 2.5.1,
Django (1, 3, 0, 'alpha', 1)

-- 
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: key error in templates - solved

2011-11-12 Thread Evan Reiser
I had the same thing happen to me and this was the only post I found on the 
internet that mentions it.

Note to other people who have this problem: 

*Be careful passing instances of model objects into celery tasks since they 
get pickled and your FileField fields will probably be removed via pickling.
*

The reason this is a problem is because of the way ImageField (and I assume 
FileFields) work.  When there is no File object associated with the 
FileField (its set to None) and you call instance.filefieldname on the 
instance it will return "None" and be == to "None" even though the field 
exists (without a file).  Since the field 'appears' to be not set (it 
evaluates to None) i don't think pickle is adding it to the serialized 
version of the instance, so when you de-serialize (in the celery task, or 
wherever) the field does not exist  

-- 
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/-/yWZIu_p8BEgJ.
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: Network configuration with django webpage

2011-11-12 Thread Ivo Brodien
You will  have to make some system calls from your django views (in python of 
course)

Cheers

On Nov 12, 2011, at 6:22, Ganesh Kumar  wrote:

> Hi guys,
> 
> I am new to django, I want to create a simple page to configure
> network configuration,
> to configure ip address and set submask and gateway configuration.
> 
> How to do with django, any clues and please guide me.
> 
> -Ganesh.
> Did I learn something today? If not, I wasted it.
> 
> -- 
> 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 exclude via model_set property?

2011-11-12 Thread Joshua Russo
it looks like this is the best way to tackle the problem. 

http://stackoverflow.com/questions/1724317/django-exclude-on-a-many-to-many-relationship-through-a-third-table

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



ForeignKey relationship to FlatPage not available in filter()

2011-11-12 Thread Sceva
I have a project using the FlatPage app.  I have added a search app with a 
keyword model. It has a foreignkey relationship to the FlatPage model:

from django.contrib import admin
>
> from django.db import models
>
> from django.contrib.flatpages.models import FlatPage
>
>
>>
>> class SearchKeyword(models.Model):
>
> keyword_search = models.CharField(max_length=50)
>
> page = models.ForeignKey(FlatPage, related_name='fkpage')
>
>
>> def __unicode__(self):
>
> return self.keyword_search
>
>
The problem is when trying to do a filter like so:

Flatpage.objects.filter(fkpage__keyword__contains='one') 


I get an error:

"FieldError: Cannot resolve keyword 'fkpage' into field. Choices are: 
> content, enable_comments, id, registration_required, sites, template_name, 
> title, url" 


In trying to solve this I set up another model within the search app called 
FlatPage2 and am successful with:

Flatpage2.objects.filter(fkpage2__keyword__contains='one')  

 
So the problem seems to be accessing relationships across apps.  Anyone 
have any ideas? The model code is below:

from django.contrib import admin
>
> from django.db import models
>
> from django.contrib.flatpages.models import FlatPage
>>
>
>> class FlatPage2(models.Model):
>>
> url = models.URLField()
>
> title = models.CharField(max_length=50)
>
>
>> def __unicode__(self):
>
> return self.title
>
>
>> class SearchKeyword(models.Model):
>
> keyword_search = models.CharField(max_length=50)
>
> page = models.ForeignKey(FlatPage, related_name='fkpage')
>
> page2 = models.ForeignKey(FlatPage2, related_name='fkpage2')
>
>  

> def __unicode__(self):
>
> return self.keyword_search
>
>
>
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/-/bNzdyatPBD8J.
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.



Query exclude via model_set property?

2011-11-12 Thread Joshua Russo
I have a 3 table solution

class Organization(models.Model):
name = models.CharField("Organization's name", max_length=100)

class OrganizationDepartment(models.Model):
organization = models.ForeignKey(Organization)
name = models.CharField("Name", max_length=100)
contacts = models.ManyToManyField("Contact")

class Contact(models.Model):
organization = models.ForeignKey("Organization", blank=True, null=True)
name = models.CharField("Contact's name", max_length=100)

I want to create a list of contacts within an organization and not in a 
given department. The problem is that it looks like I can't use the 
contact.organzationdepartment_set in an exclude. Is that correct?

-- 
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/-/irkjf3hcKrkJ.
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: Massive import from CSV to Database

2011-11-12 Thread Dan Poirier
There are some ways to make large data imports much faster.  See e.g. 

  http://www.caktusgroup.com/blog/2011/09/20/bulk-inserts-django/

Dan

-- 
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: Massive import from CSV to Database

2011-11-12 Thread Andre Terra
Hello,  Fabio

I took a look at django-csv-importer but since my files weren't quite clean
(or comma separated), I ended up rolling my own solution using celery[1],
to make the uploading rask asynchronous, and DSE[2], to allow for faster
bulk imports, as well as a lot of trial and error.

Take a look at those libraries as they may help you in rolling out your own
solution as well. Let be know if you need more pointers!

Cheers,
AT

[1] http://celeryproject.org
[2] http://pypi.python.org/pypi/dse

On Nov 12, 2011 2:08 PM, "Fabio Natali"  wrote:
>
> Hi everybody!
>
> I am developing a Django website. I want the admin to be able to perform
massive import of products into the database.
>
> This is the workflow:
>
> - the admin uploads a CSV file with a long list of products
> e.g.:
> product_1;230$;16kg;img_001.jpg;"A very good item of ours"
> product_2;130$;10kg;img_002.jpg;"An even better item of ours"
> product_3;440$;22kg;img_003.jpg;"The best item"
>
> - the website parses the file and inserts products into the DB
>
> Is this a good way to go? Is there any good library to use?
>
> I found django-csv-importer. Do you know of any better solution?
>
> Thank you very much, all the best, Fabio.
>
> --
> Fabio Natali
>
> --
> 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: Can you drop a Python script into a Django page?

2011-11-12 Thread Steve McConville
> Is it possible to drop a Python script (around 50 lines) into one of your
> django pages? Would this be embedding into the template code?

You could wrap it in a custom template tag:

https://docs.djangoproject.com/en/1.3/howto/custom-template-tags/

-- 
steve

-- 
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: Why does Django create Postgres timestamp columns with time zones?

2011-11-12 Thread Kevin
>From 
>postgresql.org/docs/8.4/static/datatype-datetime.html:
> 
"All timezone-aware dates and times are stored internally in UTC. They are 
converted to local time in the zone specified by the timezone configuration 
parameter before being displayed to the client."

So I guess all that is needed is
SET TIME ZONE 'UTC';

Problem solved.

-- 
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/-/YHu1TkJ9xJ4J.
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: Why does Django create Postgres timestamp columns with time zones?

2011-11-12 Thread K.C. Smith
It's not required by PostgreSQL.  See,
http://www.postgresql.org/docs/8.4/interactive/datatype-datetime.html
, for example.

You may be able to change the data type of that column directly in the
database.  (See 
http://www.postgresql.org/docs/8.4/interactive/ddl-alter.html#AEN2595
.)

Maybe "ALTER TABLE notification_notice ALTER COLUMN created TYPE
timestamp without time zone ;"

K.C.

On Nov 11, 7:32 pm, Kevin  wrote:
> I thought that Django created datetime columns that were time zone
> agnostic, but when I looked at my Postgres table I saw that the values
> recorded there have time zone information.
>
> Going further I found that the Postgres backend directs Django to create
> columns that use time zones.
>
> From django/db/backends/postgresql/creation.py:
>
>     data_types = {
>             ...
>             'DateTimeField':     'timestamp with time zone',
>             ...
>
> The schema shows that the created column is specified as "timestamp with
> time zone".
>
>     CREATE TABLE notification_notice
>     (
>       ...
>       created timestamp with time zone NOT NULL,
>       ...
>
> The Postgres log shows the update statement that was sent. Django
> constructed a SQL statement that used UTC as the time zone as directed by
> my Django settings file.
>
>     UPDATE "notification_notice" SET "sender_id" = 1, "group_id" = NULL,
> "notice_type_id" = 1, "content_type_id" = 21, "object_id" = 3, "created" =
> E'2011-11-11 22:31:08.022148' WHERE "notification_notice"."id" = 14
>
> This is what my table looks like. The created column has a timestame that
> has "-08" for its time zone. Postgres must be inspecting the time zone of
> my system clock to find the time zone.
>
>     my_db=# select * from notification_notice limit 1;
>      id | sender_id | group_id | notice_type_id | content_type_id |
> object_id |           created            | last_interaction_time
>
> +---+--++-+---+ 
> --+---
>       1 |           |        3 |             21 |              53 |
> 6 | 2011-11-11 14:31:02.98882-08 |
>     (1 row)
>
> Questions:
> Doesn't Django have a hands off policy to time zones?
> Why does the Postgres backend use time zones for models.DateTimeField? Is
> this required by Postgres?
> Is there a way to force Django to create timestamp columns in Postgres that
> don't use the time zone?

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



Massive import from CSV to Database

2011-11-12 Thread Fabio Natali

Hi everybody!

I am developing a Django website. I want the admin to be able to perform 
massive import of products into the database.


This is the workflow:

- the admin uploads a CSV file with a long list of products
e.g.:
product_1;230$;16kg;img_001.jpg;"A very good item of ours"
product_2;130$;10kg;img_002.jpg;"An even better item of ours"
product_3;440$;22kg;img_003.jpg;"The best item"

- the website parses the file and inserts products into the DB

Is this a good way to go? Is there any good library to use?

I found django-csv-importer. Do you know of any better solution?

Thank you very much, all the best, Fabio.

--
Fabio Natali

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

2011-11-12 Thread Mo Mughrabi
Yes, definitely we accept offshore developers working from their countries.

On Sat, Nov 12, 2011 at 5:32 PM, Casey Greene wrote:

> He means, "are you interested in job applicants that are not on-site (i.e.
> people working remotely)?"
>
> Hope this helps,
> Casey
>
>
> On 11/12/2011 08:52 AM, mo.mughrabi wrote:
>
>> We are located in Kuwait as for the second question am not quite sure
>> what you mean.
>>
>> On Nov 12, 6:07 am, Russell 
>> Keith-Magee
>> >
>> wrote:
>>
>>> On Fri, Nov 11, 2011 at 9:49 PM, Mo Mughrabi
>>>  wrote:
>>>
 Hello fellows django developers,

>>> ...
>>>
 Please email me back if you are interested and I could share more
 details,
 Best regards,

>>>
>>> Hi Mo,
>>>
>>> Two very important details that you might want to share:
>>>
>>>  * Where is your company located?
>>>
>>>  * Are you interested in applicants that want to telecommute?
>>>
>>> Remember -- django-users is a mailing list with an international
>>> audience. Just saying "Who wants a job" isn't very helpful unless you
>>> are genuinely willing to hire anyone, anywhere.
>>>
>>> Yours,
>>> Russ Magee %-)
>>>
>>
>>
> --
> 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.



MVP--an open source repository for libraries and modules

2011-11-12 Thread skier31415
I'm a coder, but I don't code for the majority of my time.  What I do
is identify, install, employ, and adapt mostly working solutions.  I
stand on the shoulders of giants.  There are very few good ways to
identify these solutions.  The top on my list is "how flashy is the
site", and "how extensive is the documentation".  Not necessarily the
best metrics.  I want to curate and peer review open source code.
It's called Open Include.

I'm looking for help creating an MVP for this site.  I have my design
docs in place, and have a front end developer.  I am an algorithm
developer--check out my work at deterministicprogramming.com  We need
help with django specifically.

Thank you very much,
Bill Dvorak

--


William Dvorak

Algorithms Consultant
Deterministic Programming
deterministicprogramming.com

-- 
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: Can you drop a Python script into a Django page?

2011-11-12 Thread Joey Espinosa
Jimmy,

I don't know your specific situation, but this is probably not worth a fee.
You already know Django and Python, all you need to do is extend that
knowledge with some AJAX.

If you run into problems, there's always this group ;)

--
Joey "JoeLinux" Espinosa
Software Developer
http://about.me/joelinux
On Nov 12, 2011 9:31 AM, "jc"  wrote:

> Oh, this does help...tremendously. Thanks for taking the time out and
> explaining. I think that's enough for me to start learning via the
> docs/experimenting and hopefully get something implemented.
>
> If I can't implement this, do you know anyone that could do this for a fee?
>
> thanks,
> jimmy
>
> --
> 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/-/LiX0uN29AQYJ.
> 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 Gig

2011-11-12 Thread Casey Greene
He means, "are you interested in job applicants that are not on-site 
(i.e. people working remotely)?"


Hope this helps,
Casey

On 11/12/2011 08:52 AM, mo.mughrabi wrote:

We are located in Kuwait as for the second question am not quite sure
what you mean.

On Nov 12, 6:07 am, Russell Keith-Magee
wrote:

On Fri, Nov 11, 2011 at 9:49 PM, Mo Mughrabi  wrote:

Hello fellows django developers,

...

Please email me back if you are interested and I could share more details,
Best regards,


Hi Mo,

Two very important details that you might want to share:

  * Where is your company located?

  * Are you interested in applicants that want to telecommute?

Remember -- django-users is a mailing list with an international
audience. Just saying "Who wants a job" isn't very helpful unless you
are genuinely willing to hire anyone, anywhere.

Yours,
Russ Magee %-)




--
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: Can you drop a Python script into a Django page?

2011-11-12 Thread jc
Oh, this does help...tremendously. Thanks for taking the time out and 
explaining. I think that's enough for me to start learning via the 
docs/experimenting and hopefully get something implemented.

If I can't implement this, do you know anyone that could do this for a fee?

thanks,
jimmy

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



Weird, but likely really stupid ManyToMany save issue

2011-11-12 Thread mpm
This is going to sound pretty ridiculous but I am having an issue
saving a ManyToMany relationship through a post.  I stripped my app
down to the most basic example from the tutorial.

Applicable Model Code: (I have forms and an Author, but those populate
just fine.  So I already have a few authors created)

class Book(models.Model):
name = models.CharField(max_length=100)
authors = models.ManyToManyField(Author)

class BookForm(ModelForm):
class Meta:
model = Book

Applicable View:
def save(request):
form = BookForm(request.POST)
form.save()
return HttpResponse("save success")

For background purposes:
1. The BookForm shows up just fine in my browser.
2. Within the "authors" section of the BookForm in my browser, I see
the test authors I created.
3. I checked the post parameters and the post parameter 'authors'
correctly contains the ID's of the Authors I selected in the form.

I know this is ridiculously stupid, but I have been struggling with
this.  I see that the "form.save()" method saves to the Book table,
but not the ManyToMany attributes.  I was reading that you first have
to save the Book (to get the PK) then you can save the ManyToMany
relationships.  What's the best way to do this?

Thanks in advance,
MM

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

2011-11-12 Thread mo.mughrabi
We are located in Kuwait as for the second question am not quite sure
what you mean.

On Nov 12, 6:07 am, Russell Keith-Magee 
wrote:
> On Fri, Nov 11, 2011 at 9:49 PM, Mo Mughrabi  wrote:
> > Hello fellows django developers,
> ...
> > Please email me back if you are interested and I could share more details,
> > Best regards,
>
> Hi Mo,
>
> Two very important details that you might want to share:
>
>  * Where is your company located?
>
>  * Are you interested in applicants that want to telecommute?
>
> Remember -- django-users is a mailing list with an international
> audience. Just saying "Who wants a job" isn't very helpful unless you
> are genuinely willing to hire anyone, anywhere.
>
> Yours,
> Russ Magee %-)

-- 
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: Can you drop a Python script into a Django page?

2011-11-12 Thread Joey Espinosa
Jimmy,

Not sure what JavaScript library you use (or if you're familiar with
JavaScript at all), but this is a very rudimentary example:

First, create a View in Django that you can call, and capture the results:

import os
> from django.http import HttpResponse
> ...
> def ajax(req):
> if req.is_ajax():
> stdout = os.popen("script_you_want_to_run.py")
> output = stdout.read()
> return HttpResponse(output)


Make sure you can call it by adding it in your urls.py (be sure that it's
defined *above* any other line that may redirect you somewhere else):

urlpatterns = patterns('',
> url(r'^ajax', 'your_project.your_app.views.ajax'),

...

)


Then call it from whatever template you're wanting to use (I'm going to use
Dojo for this example, just because it's my favorite JavaScript library):

var resultDisplay = dojo.byId("results");  // whatever element you want to
> display your results
> dojo.xhrGet({
> url: '/ajax',  // this accesses the view you created earlier
> load: function(data) {
> resultDisplay.innerHTML = data;  // 'data' should be the output
> that you returned from the view
> }
> });


Again, this is very basic, but this should get you started. Use some test
scenarios to try it out just so you get the idea (such as dropping in a
Python script that does nothing but output "Hello").

I hope this helped.

--
Joey "JoeLinux" Espinosa*
*





On Sat, Nov 12, 2011 at 6:43 AM, jc  wrote:

> Oh, that would *totally* be fine. I have no idea how to do that, do you
> know of any docs that might show me how to execute this code on the
> server-side and print out via AJAX?
>
> thanks!
> jimmy
>
> --
> 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/-/KnKT8mJOggUJ.
>
> 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: Can you drop a Python script into a Django page?

2011-11-12 Thread jc
Oh, that would *totally* be fine. I have no idea how to do that, do you 
know of any docs that might show me how to execute this code on the 
server-side and print out via AJAX?

thanks!
jimmy

-- 
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/-/KnKT8mJOggUJ.
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: Can you drop a Python script into a Django page?

2011-11-12 Thread Joey Espinosa
Jimmy,

Does it NEED to be embedded into the page? I ask because something like
this would be a lot easier if you executed server-side, and simply returned
the output to the front-end using AJAX.

Would that serve your purpose here, or am I misunderstanding the original
question?

--
Joey "JoeLinux" Espinosa
Software Developer
http://about.me/joelinux
On Nov 12, 2011 5:32 AM, "jc"  wrote:

> Hi,
>
> Is it possible to drop a Python script (around 50 lines) into one of your
> django pages? Would this be embedding into the template code? I am
> experimenting with doing this but I haven't had any luck in finding out how.
>
> An example of what I am trying to do is to place a script like this
> http://www.goldb.org/**ystockquote.html
>  and
> see if I can't drop it into a page like this http://demo.**
> satchmoproject.com/category/**book/fiction/
>  and
> have it print out the info on the page.
>
> First thing that comes to mind is once I figure out how to embed the
> script, how will I execute it?
>
> thanks,
> jimmy
>
> --
> 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/-/heUngZyYuE8J.
> 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.



Can you drop a Python script into a Django page?

2011-11-12 Thread jc
Hi,

Is it possible to drop a Python script (around 50 lines) into one of your 
django pages? Would this be embedding into the template code? I am 
experimenting with doing this but I haven't had any luck in finding out how.

An example of what I am trying to do is to place a script like this 
http://www.goldb.org/ystockquote.html and see if I can't drop it into a 
page like this http://demo.satchmoproject.com/category/book/fiction/ and 
have it print out the info on the page.

First thing that comes to mind is once I figure out how to embed the 
script, how will I execute it? 

thanks,
jimmy

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