Possible bug in Django WSGI get_script_name ?

2014-07-15 Thread Petr Tůma
Hello, while debugging a Django site recently, I came across surprising behavior related to WSGI handling. In django/core/handlers/wsgi.py (current git head), the get_script_name function contains the following fragment: if script_url: path_info = get_bytes_from_wsgi(environ, 'PATH_

Re: how do i return an int as the returned object for admin panel

2014-07-15 Thread monoBOT
The __unicode__ method is meant to return a human readable representation of the model object as a unicode. EG: def __unicode__(self): return u'%(id)s' % {'id': self.vm__id} althought not very human readable is a correct __unicode__ method. The reason behind you wanting a int number in the _

Re: Django setup with elsatic beanstalk

2014-07-15 Thread Stefano Tranquillini
i gave up and create a machine on AWS and deployed everything. it's not that complex, u can find tutorial online . On Sat, Jul 12, 2014 at 1:24 AM, Rob wrote: > gmail.com> writes: > > > > > > > I'm having a similar problem - I don't see errors from the > EB console - but django is not load

date field validation

2014-07-15 Thread hardik . sottany
i want validation in form.py in which the datetime should not be less than datetime.now please i need it urgently please help me -- 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,

checkout system for ecommerce site

2014-07-15 Thread ROHITH KUMAR Miryala
I have an e-commerce site where i need a cart system and checkout system.I have the whole website ready and i just needed these two features. Please help me in finding django-plugins for accomplishing those tasks.thanks. -- You received this message because you are subscribed to the Google Grou

Re: date field validation

2014-07-15 Thread monoBOT
like that: def clean_date(self): date = self.cleaned_data['date'] if date < datetime.datetime.now(): raise forms.ValidationError(_(u'Must be a future date')) return date 2014-07-15 12:29 GMT+01:00 : > i want validation in form.py in which the datetime should

Re: Django-admin set foreign key to Null for inlines selected item instead of delete

2014-07-15 Thread ROHITH KUMAR Miryala
> > > B-id=models.ForeignKey('B',on_delete=models.SET_NULL) > -- 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 pos

Re: imagens com django templates

2014-07-15 Thread erico
No settings.py MEDIA_ROOT = os.path.join(ROOTDIR, 'media') MEDIA_URL = '/media/' urls.py # arquivos de media-uploads (r'^media/(.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), no .html {% for item in lista_itens %} {% endfor %} Altera imagem =

Django 1.7c1 app without models data migrations

2014-07-15 Thread aRkadeFR
Hello everyone, First post on this mailing list. Big thanks to the community and the core dev of Django! I'm using Django 1.7c1 with python 3.2 or 3.4. I'm splitting lots of my website as Django apps. So my main app is handling (only) the urls routing, the settings, some tests and that's it. I

Are these tests redundant?

2014-07-15 Thread Tianyi Wang
Hi, I have a very simple model: class Action(models.Model): name = models.CharField('Name', max_length=100) deleted = models.BooleanField('Deleted', default=False) def __unicode__(self): return self.name class Meta: ordering = ('name',) My tests for this model i

Re: Admin UI not commiting to DB

2014-07-15 Thread Timothy W. Cook
On Mon, Jul 14, 2014 at 12:44 PM, Tom Evans wrote: > > > Have you ruled out that this is simply a mid air collision? IIRC, > django admin has no mid air collision detection system > > Cheers > > Tom > > Eg if user A loads Item i, user B loads Item i, user A changes > i.foo='hi' and saves item i,

Admin Page Customization Questions

2014-07-15 Thread G Z
I have a few questions, is it possible to template the admin page? second I'm trying to customize some of the individuals pages for my particular issue I have a table named vm_licenses and a licenses table, I have my models set up l

Re: Admin Page Customization Questions

2014-07-15 Thread G Z
Ive also tried class License(models.Model): license_id = models.BigIntegerField(primary_key = True, editable = False, db_column = 'license_id') license_authority = models.ForeignKey(License_authoritie, on_delete = models.PROTECT) product = models.CharField(max_length = 20) class

Re: Are these tests redundant?

2014-07-15 Thread Esau Rodriguez
Imho all but 4 are redundant. That is already tested in django itself. Regards, Esau Rodriguez. El 15/07/2014 16:48, "Tianyi Wang" escribió: > Hi, > > I have a very simple model: > > class Action(models.Model): > name = models.CharField('Name', max_length=100) > deleted = models.BooleanF

Re: Are these tests redundant?

2014-07-15 Thread Tianyi Wang
After looking at these tests again, yes, I agree. No point of testing model object creation since it's Django's job. Testing the methods on the Model would be more useful I guess. Cheers, Tianyi On Tuesday, 15 July 2014 17:59:04 UTC+1, esauro wrote: > > Imho all but 4 are redundant. That is alr

Django ManytoMany Relationships

2014-07-15 Thread G Z
I will start by saying I have an existing database, for the purpose of my question it has three tables: Vm Vm_licenses Licenses This database is per-existing before we decided to make a django web-portal. Basically licenses is a da

Re: Django ManytoMany Relationships

2014-07-15 Thread C. Kirby
ManyToMany fields actually create a new intermediary join table in the database. If you are using an unmanaged database then you will need to create the intermediary table yourself. See the ManyToMany field reference On

Re: MultiValueDictKeyError in Django admin edit inline generic model

2014-07-15 Thread Alex
I am having a similar problem that started when I upgraded from django 1.4.x to 1.6.5 My parent model has a custom pk and the model in my inline is using the default autogenerated id. Here is some snippets from my models and admin: (note I have edited down for simplicity and have not tested the

Re: Django ManytoMany Relationships

2014-07-15 Thread G Z
Kirby, This is what i have so far but i dont understand how to get the table to do what I want. Because all I get on vm_licenses is the ability to select the vm there is no licenses anymore. I'm not quite sure how all of this works together. class License(models.Model): license_id = models

Re: Django ManytoMany Relationships

2014-07-15 Thread G Z
Admin.py class vm_license_admin(admin.ModelAdmin): list_display = ('vm',) search_fields = ('vm__vm_name',) ordering = ('vm',) filter_horizontal = ('license',) admin.site.register(Vm_license, vm_license_admin) class License(models.Model): license_id = models.BigIntegerFie

Re: Admin Page Customization Questions

2014-07-15 Thread Michiel Overtoom
On Jul 15, 2014, at 17:59, G Z wrote: > > I have a few questions, is it possible to template the admin page? Yes, you can copy the default admin templates and change them. It is described here: https://docs.djangoproject.com/en/dev/intro/tutorial02/#customize-the-admin-look-and-feel Gree

Strange error during migration

2014-07-15 Thread Arkaitz Mugica Islas
I'm migrating from Django 1.5.8 to 1.6.5. I've solved quite a lot of bug related to my code, but this time I think it could be a bug. Can anybody help me to fix it or should I post it to django-developers? Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 1.6.5 Python Ve

Re: Strange error during migration

2014-07-15 Thread Tianyi Wang
Hi, It says that datetime object is not JSON serializable. You should convert it to string before converting it to JSON. For example: current_date = datetime.datetime.now() # it will throw error if you do json.dumps(current_date) # You should do as below json_string = json.dumps(('{:%Y-%m-%d %H:

Django Models PrimaryKey not incrimenting I dont understand this framework and the documentation is poorly written.

2014-07-15 Thread G Z
So I have a database that we are using to collect vm statistics. It is always running and writing to a django database. I built my models file to resemble the db. However I have run into quite a few issues. I was wondering if anyone else has run into these issues and found out how to solve them.

Re: Django Models PrimaryKey not incrimenting I dont understand this framework and the documentation is poorly written.

2014-07-15 Thread G Z
I can update items just not add them always the same error cannot insert null for the primary key -- 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-use

using revers inside @user_passes_test

2014-07-15 Thread Domagoj Kovač
Hi Guys, I have a problem. I have web application that supposed to have two logins, one for admin other for regular users. Inside my backend i am using @user_passes_test decorator to allow access only to admins. This is my code: my_view > from django.core.urlresolvers import reverse > from d

Re: Django Models PrimaryKey not incrimenting I dont understand this framework and the documentation is poorly written.

2014-07-15 Thread Tom Evans
On Tue, Jul 15, 2014 at 10:23 PM, G Z wrote: > So I have a database that we are using to collect vm statistics. It is > always running and writing to a django database. > I built my models file to resemble the db. However I have run into quite a > few issues. I was wondering if anyone else has run

Re: Django Models PrimaryKey not incrimenting I dont understand this framework and the documentation is poorly written.

2014-07-15 Thread G Z
Tom, It fails with both autofield and bigintergerfield class License(models.Model): license_id = models.AutoField(primary_key = True, editable = False, db_column='license_id') license_authority_id = models.ForeignKey(License_authoritie, on_delete = models.PROTECT, db_column='license_auth

Re: Django Models PrimaryKey not incrimenting I dont understand this framework and the documentation is poorly written.

2014-07-15 Thread G Z
http://www.oracle.com/technetwork/articles/dsl/vasiliev-django-100257.html the guide I followed from oracle. On Tuesday, July 15, 2014 4:16:54 PM UTC-6, G Z wrote: > > Tom, > > It fails with both autofield and bigintergerfield > > class License(models.Model): >license_id = models.AutoField(pr

Re: Django Models PrimaryKey not incrimenting I dont understand this framework and the documentation is poorly written.

2014-07-15 Thread Tom Evans
On Tue, Jul 15, 2014 at 11:16 PM, G Z wrote: > Tom, > > It fails with both autofield and bigintergerfield > > class License(models.Model): >license_id = models.AutoField(primary_key = True, editable = False, > db_column='license_id') >license_authority_id = models.ForeignKey(License_author

combine date time field taking from user and give validation

2014-07-15 Thread hardik . sottany
combine date time field taking from user and give validation try: date = cleaned_data.get('date') except: date = '' if not date: msg = "Please fill up all mandatory fields" self._errors['date'] = self.error_class([msg]) return self.cleaned_data try: time = cleaned_data.get('time') print "time",ti

Re: date field validation

2014-07-15 Thread hardik . sottany
bro i want to check that i want to give a appointment model appointment is available for 6 days a week from monday to saturday and from 11 am to 7pm can you please give me this coding coz i have to submit my project today On Tuesday, July 15, 2014 4:59:18 PM UTC+5:30, hardik