Friday, January 31, 2014

Pre-populating data in the admin panel

In the Django Admin I want to populate fields for a foreign key record when I click the add (+) button
I tried with formfield_for_foreignkey but it does not work

model

class Property(models.Model):      name = models.CharField(_('name'), max_length=50)      description = models.TextField(_('description'), blank=True)      class Physic(models.Model):      name = models.ForeignKey(Property, verbose_name=_('name'), null=True, blank=True,)      lapropriete = models.CharField(_('property'), max_length=100)      class UniteProperty2(models.Model):      name = models.ForeignKey(Material, verbose_name=_('name'))                                       nature_unit = models.ForeignKey(Property, verbose_name=_('category'))                         choix = models.ForeignKey(Physic, verbose_name=_('properties'), null=True, blank=True,  related_name='UniteProperty2_choix') 

forms

def formfield_for_foreignkey(self, db_field, request, **kwargs):
         
        if db_field.name == 'nature_unit':
            kwargs['queryset'] = Property.objects.all()
            return db_field.formfield(**kwargs)
        if db_field.name == 'choix':
            kwargs['queryset'] = Physic.objects.all()
            return db_field.formfield(**kwargs)
            
 
        return super(UniteProperty2Inline, self).formfield_for_foreignkey(db_field, request, **kwargs)

--
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+unsubscribe@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/7e356b70-4ec0-48a3-af02-3ec9c5a836ab%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Re: Django with Ubuntu Cloud

Hi,

Why not use S3 for storage? Then you can still keep heroku and don't have to make vast changes to your setup?

Regards,

Andréas


2014-01-31 Vibhu Rishi <vibhu.rishi@gmail.com>:
Hi,

Has anyone setup Django with Ubuntu Cloud ?

My primary interest is how to setup the media server. I am primarily using Heroku for the hosting of the project, but that does not provide hosting for the static / user uploaded files. So, I am looking at what alternatives I have. There are a lot of suggestions to use AWS. I also came across ubuntu cloud - but havent gotten much details if i can use it with ubuntu.

Thanks for your insights!
V.

--
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius

--
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+unsubscribe@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/CAPiONwmd9h%2Bcwb1SYseYeiijag4Aa5weeMtg_eqiDgh7txVOKg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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+unsubscribe@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/CALXYUb%3DxLaVMPLQBcvyObuR19KHQ9rkQ%3DuvWUMqafO-q_EJ%3D_w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Thursday, January 30, 2014

Re: Django with Ubuntu Cloud

Django is a fairly flexible web framework. See read more about STATIC and MEDIA files in Django. The Ubuntu cloud API is documented here https://one.ubuntu.com/developer/files/store_files/cloud, you can interact with it using libraries like requests.

https://docs.djangoproject.com/en/dev/howto/static-files/

--
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+unsubscribe@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/d132b6ad-1f34-4585-888e-20801e020ad0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Re: Django with Ubuntu Cloud

Hi Vibhu,

Everything I know about Ubuntu Cloud I learned from their homepage in the last couple of minutes --  but that website seems to suggest that Ubuntu Cloud is based on OpenStack. OpenStack is a generic API for cloud computing that is shared by a number of providers (most notably Rackspace, but there are others), so if Ubuntu Cloud uses OpenStack, then you just need to look for libraries that support OpenStack, and you should be able to use those libraries on Ubuntu Cloud.

If you're looking for an alternative to S3, then you want OpenStack Swift. There are Python libraries to talk to Swift stores, and there are Django file storage backends that will use Swift as well. 

Yours,
Russ Magee %-)
 




On Fri, Jan 31, 2014 at 2:56 PM, Vibhu Rishi <vibhu.rishi@gmail.com> wrote:
Hi,

Has anyone setup Django with Ubuntu Cloud ?

My primary interest is how to setup the media server. I am primarily using Heroku for the hosting of the project, but that does not provide hosting for the static / user uploaded files. So, I am looking at what alternatives I have. There are a lot of suggestions to use AWS. I also came across ubuntu cloud - but havent gotten much details if i can use it with ubuntu.

Thanks for your insights!
V.

--
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius

--
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+unsubscribe@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/CAPiONwmd9h%2Bcwb1SYseYeiijag4Aa5weeMtg_eqiDgh7txVOKg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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+unsubscribe@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/CAJxq84_F2HTfNAH%2BaUN-evCOm-EZBaYvnnk6iimG2-4FrMr9Mw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Django with Ubuntu Cloud

Hi,

Has anyone setup Django with Ubuntu Cloud ?

My primary interest is how to setup the media server. I am primarily using Heroku for the hosting of the project, but that does not provide hosting for the static / user uploaded files. So, I am looking at what alternatives I have. There are a lot of suggestions to use AWS. I also came across ubuntu cloud - but havent gotten much details if i can use it with ubuntu.

Thanks for your insights!
V.

--
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius

--
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+unsubscribe@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/CAPiONwmd9h%2Bcwb1SYseYeiijag4Aa5weeMtg_eqiDgh7txVOKg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Re: Honest feedback

There have been small, well thought out changes over the last 4 years but fundamentally most still remains pretty much the same.   I have several installs running an patched old .96 version, as well as newer stuff with later versions.  It all feels about the same to work with.   I recently upgraded one from 1.3 to the current with no breakage at all.  They've remained pretty true to the promise of backwards compatibility.  That also means some of the warts are still there like the difficulty in writing reusable apps, file based settings, multiple user profiles, that 30 char username length on the contrib.auth.User model.  Todays Django is a more mature, stable version of what you probably remember.

There have been some changes like south becoming the defacto standard for migrations, and geojango now a bundled part of django.  I think the biggest thing overall is the number of 3rd party apps available  ( https://www.djangopackages.com/ ).  There are some really useful ones like tastypie and django rest framework for out of box API (like the admin was for orm).  Celery for async tasks, several very nice CMS,  Authentication backends for most of the social media sites via python-social-auth.  Several nice asset managers.   Some nice things in the ORM too, like inheritance and a more useful select_related implementation.  Oh, and multiple database support!  Templates can now be cached. The storages api was introduced and there are several backends for doing things like uploading to amazon or other similar apis. 

Sorry for the rambling, just throwing stuff out there! 

--
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+unsubscribe@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/7ab155f4-a39f-4b45-af20-b03f7b6ad025%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Re: problems when interpreter calls module 'taggit'


On 31 Jan 2014 02:13, "Charly Román" <chack14rock@gmail.com> wrote:
>
> You need to install django-taggit.
>
Or add taggit to your INSTALLED_APPS setting.

>
>
> 2014-01-30 Cristiano Araujo <code.lighthouse@gmail.com>:
>
>> goodevening guys
>> i'm new in this group
>>
>> my problem is this: i'm trying to make a simple django app, but when i try to sinc the db the interpreter shows mw this error:
>>
>>
>> i have python 3.3 installed, i already unistalled python 2.7
>> is something about the path? my ide is pycharm.
>>
>> thanks for help
>> and sorry if i can't explain it more clear.
>>
>> --
>> 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+unsubscribe@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/f57365ac-8b65-45a1-8ff6-82503828d157%40googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> --
> 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+unsubscribe@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/CABeWMUYRWJrpVxY4Wh47mEr%3D%2BLE3YkVpa%2BHbk-%3Dx3xK7VmtaVQ%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/groups/opt_out.

--
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+unsubscribe@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%2BWjgXNX2RqfLp1W_6xqGhK2J_77Uy9V7W4Ehx%2BR_HGzo9Gzog%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.