Re: Strip ArrayField input from admin

2015-09-02 Thread Erik Cederstrand

> Den 18/08/2015 kl. 10.54 skrev Erik Cederstrand :
> 
> Hi list
> 
> I have a model with a field defined like this:
> 
>   categories = ArrayField(models.CharField(max_length=32))
> 
> 
> This field is accessible via the admin interface, and when I enter 
> comma-separated values in the charfield, they are stored as an array in the 
> DB.
> 
> However, I just discovered that if I enter comma+space separated values, e.g. 
> "teachers, locations, students", it gets converted to ['teachers', ' 
> locations', ' students'] which is not what I want. How go I get the 
> ArrayField to strip the values after splitting by comma?

Well, that was easy. Just subclass ArrayField:

   class StrippedArrayField(ArrayField):
   def pre_save(self, model_instance, add):
   stripped_array = [s.strip() for s in getattr(model_instance, 
self.attname)]
   setattr(model_instance, self.attname, stripped_array)
   return stripped_array


Erik

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


Receive post_save signal from another project

2015-09-02 Thread Kishan Mehta
Hi All,

I am working on requirement where after user sign up, User model of one app
should send some data to another app in different project. For that we are
thinking if we can use "post_save" signal on model.  Is there any way if I
can listen to signal of other porject's app.


Regards,
-- 

[image: --]
Kishan Mehta
[image: https://]about.me/kishan_mehta


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


Re: No module named http_client

2015-09-02 Thread sum abiut
Do you mind explain, what where you trying to do when you encounter this
error??

On Thu, Sep 3, 2015 at 2:43 PM, Pawanesh Gautam  wrote:

> Hiii,
>
> i am getting following issue on my django project :
>
> ImportError at /admin
>
> No module named http_client
>
>
> please suggest some solution ..
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5d0ef214-9b1f-4fa3-8864-c6457752d0a0%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


No module named http_client

2015-09-02 Thread Pawanesh Gautam
Hiii,
 
i am getting following issue on my django project :

ImportError at /admin

No module named http_client


please suggest some solution ..

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


Electronic Notebook (ELN)

2015-09-02 Thread Aref
I am looking for an electronic notebook for general engineering notes. It 
seems that this would be a good candidate application for Django. Does 
anyone know if such an application has been written using Django or how 
difficult such an application would be to write?

Thanks.
Aref

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


Re: Basic M2M Self Reference Through Question

2015-09-02 Thread monoBOT
to be able to diferentiate  both follower and following you should define
at least in one of those foreigkeys a related_name argument, so you can
call back from your user.

if you try to do it without related_name django will complain, showing you
the error message and addressing you to the sollution.


2015-09-02 21:46 GMT+01:00 James Schneider :

>
> On Sep 2, 2015 9:51 AM, "jeff newburn"  wrote:
> >
> > I apologize if this is basic and I am just missing something in the
> django docs.  The Django ORM allows you to do a self reference through
> another table.  I understand everything about this process EXCEPT how
> Django determines which of the foreign keys to use for each side of the M2M
> relationship.
> >
> > class MyUser(...):
> > connections = models.ManyToManyField('self', through=Relationship,
> symmetrical=False)
> >
> > class Relationship(...):
> > follower = models.ForeignKey(MyUser)
> > following = models.ForeignKey(MyUser)
> >
> > So in the psuedocode example above how does Django ORM know which of the
> 2 foreign key fields to connect to?  Does it just assume the first field is
> the one to use?  Thanks for any help on this.
> >
>
> When you have multiple references to the same model, you have to do a bit
> of extra work to tell Django how you want things to line up. I think what
> you need to do is specify the 'through_fields' on the M2M, and set
> appropriate 'related_name' arguments for the FK's.
>
>
> https://docs.djangoproject.com/en/1.8/ref/models/fields/#django.db.models.ManyToManyField.through_fields
>
> -James
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWUHERQxWxOzraYknnZSdpPU654vu4DRVQasG8Fqf9Hfg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*monoBOT*
Visite mi sitio(Visit my site): monobotsoft.es/blog/

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


Re: Django for data management in a no-UI application?

2015-09-02 Thread Avraham Serour
+1 to DRF, you may also use the django admin as a quick CRUD to your data
On Sep 2, 2015 10:34 PM, "Rafael E. Ferrero" 
wrote:

> I don't quite understand very well your use case, but, i think that you
> can go with REST, maybe?? [http://www.django-rest-framework.org/]
>
> --
> Rafael E. Ferrero
>
> 2015-09-02 16:20 GMT-03:00 :
>
>> I'm designing a program which was originally meant to be a server
>> application, and I planned to write it with Django. I haven't used Django
>> before, so I've been reading about it to help me think about the design.
>>
>> Now there has been a change in direction. I'm being asked to develop the
>> program as a no-UI service. A browser-based user interface will be added
>> later.
>>
>> However, the program will make extensive use of a SQL database. I'd like
>> to use Django's data management features from the start, so that when the
>> GUI is added I won't have to choose between rewriting the data management
>> and leaving it outside the Django framework.
>>
>> None of the tutorial material I've read addresses this case, where Django
>> is used for data management but there is no UI. Will I have any problems
>> developing a program this way?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/c9e96c5a-689f-4b20-bd9d-c23fc34e844d%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJJc_8U8_ZAP3MGADz6T1jDxmm%3DoDTKoAc-hYTqfLRpx-PyzJA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: Basic M2M Self Reference Through Question

2015-09-02 Thread James Schneider
On Sep 2, 2015 9:51 AM, "jeff newburn"  wrote:
>
> I apologize if this is basic and I am just missing something in the
django docs.  The Django ORM allows you to do a self reference through
another table.  I understand everything about this process EXCEPT how
Django determines which of the foreign keys to use for each side of the M2M
relationship.
>
> class MyUser(...):
> connections = models.ManyToManyField('self', through=Relationship,
symmetrical=False)
>
> class Relationship(...):
> follower = models.ForeignKey(MyUser)
> following = models.ForeignKey(MyUser)
>
> So in the psuedocode example above how does Django ORM know which of the
2 foreign key fields to connect to?  Does it just assume the first field is
the one to use?  Thanks for any help on this.
>

When you have multiple references to the same model, you have to do a bit
of extra work to tell Django how you want things to line up. I think what
you need to do is specify the 'through_fields' on the M2M, and set
appropriate 'related_name' arguments for the FK's.

https://docs.djangoproject.com/en/1.8/ref/models/fields/#django.db.models.ManyToManyField.through_fields

-James

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


Re: Django for data management in a no-UI application?

2015-09-02 Thread Rafael E. Ferrero
I don't quite understand very well your use case, but, i think that you can
go with REST, maybe?? [http://www.django-rest-framework.org/]

--
Rafael E. Ferrero

2015-09-02 16:20 GMT-03:00 :

> I'm designing a program which was originally meant to be a server
> application, and I planned to write it with Django. I haven't used Django
> before, so I've been reading about it to help me think about the design.
>
> Now there has been a change in direction. I'm being asked to develop the
> program as a no-UI service. A browser-based user interface will be added
> later.
>
> However, the program will make extensive use of a SQL database. I'd like
> to use Django's data management features from the start, so that when the
> GUI is added I won't have to choose between rewriting the data management
> and leaving it outside the Django framework.
>
> None of the tutorial material I've read addresses this case, where Django
> is used for data management but there is no UI. Will I have any problems
> developing a program this way?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c9e96c5a-689f-4b20-bd9d-c23fc34e844d%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Django for data management in a no-UI application?

2015-09-02 Thread jsachs
I'm designing a program which was originally meant to be a server 
application, and I planned to write it with Django. I haven't used Django 
before, so I've been reading about it to help me think about the design.

Now there has been a change in direction. I'm being asked to develop the 
program as a no-UI service. A browser-based user interface will be added 
later.

However, the program will make extensive use of a SQL database. I'd like to 
use Django's data management features from the start, so that when the GUI 
is added I won't have to choose between rewriting the data management and 
leaving it outside the Django framework.

None of the tutorial material I've read addresses this case, where Django 
is used for data management but there is no UI. Will I have any problems 
developing a program this way?

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


Basic M2M Self Reference Through Question

2015-09-02 Thread jeff newburn
I apologize if this is basic and I am just missing something in the django 
docs.  The Django ORM allows you to do a self reference through another 
table.  I understand everything about this process EXCEPT how Django 
determines which of the foreign keys to use for each side of the M2M 
relationship.

class MyUser(...):
connections = models.ManyToManyField('self', through=Relationship, 
symmetrical=False)

class Relationship(...):
follower = models.ForeignKey(MyUser)
following = models.ForeignKey(MyUser)

So in the psuedocode example above how does Django ORM know which of the 2 
foreign key fields to connect to?  Does it just assume the first field is 
the one to use?  Thanks for any help on this.

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


Re: How to serve any static directory?

2015-09-02 Thread Yann Salaün
Hi,

The main reason I try to serve those static files with django is because I
would like to use django to configure the route.

Trying to clarify my question:

1. The url (http:///site//) doesn't match the
directory name (which could be anything, like `XYZ_html/`).
2. Administrators must be able to upload new archives, which should be
extracted and served automatically.

For those two reasons, I don't have any idea how to serve this content
using the webserver, because how is it possible to configure the routes
then?

Thank you for your answer

On Tue, Sep 1, 2015 at 4:43 PM, Florian Schweikert 
wrote:

> On 01/09/15 16:34, Yann Salaün wrote:
> > In summary : is there a way to put something like `return
> > serve_this_static_directory()` in the view? or is there any workaround
> > there?
>
> Not sure if I get you right, you want to serve static files with django?
> Is there any reason why it's not possible to serve them with nginx/apache?
>
> regards,
> Florian
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/55E5B97B.3070607%40ist-total.org
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: two modelForm fields to a one model Field

2015-09-02 Thread Leandro Severino
 Thanks James.
 

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


Re: webdav

2015-09-02 Thread James Schneider
On Sep 1, 2015 3:55 AM, "Pawanesh Gautam"  wrote:
>
> whats the use of webdav in django project ?
>

WebDAV and Django are usually handled separately. Normally WebDAV is hooked
directly into the web server.

Not to say that Django couldn't offer such services; it would seem easier
to do this through  established and battle-tested mechanisms that are
already necessary and present for a Django installation anyway.

Can you be more explicit in what you are trying to accomplish?

-James

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