Re: View didn't return an HttpResponse object

2014-10-21 Thread Dariusz Mysior
Thank You, once again it help :) W dniu poniedziałek, 20 października 2014 23:55:28 UTC+2 użytkownik Collin Anderson napisał: > > Hello, > > from django.contrib.auth import logout,login,authenticate,password_change > I think you want: > from django.contrib.auth import logout,login,authenticate >

Re: djangoproject.com tutorial part 3

2014-10-21 Thread Daniel Roseman
On Tuesday, 21 October 2014 00:01:56 UTC+1, Tri Vo wrote: > > I am calling the page with "python manage.py runserver 0.0.0.0:8000" When > I load up the page before adding the views and urls files, I see the polls > and everything that I have set up with the codes from the previous pages of > the

Restricting file access to users who uploaded the file.

2014-10-21 Thread Gaurav Gupta
What is the best way to restrict access of files to specific users. I want to give read access to the user who uploaded the files. In the normal django implementation there seems to be no way to restrict access to file uploads in MEDIA_ROOT. What's the best way to achieve this? Ideally I would

Many-to-many Relationship Between Django Apps Fails

2014-10-21 Thread Paul Childs
*What's been done so far:* - I was on Django 1.5 and upgraded to 1.6 (cannot go higher as we are on Python 2.6) and this did not solve the problem. - I have researched this issue to death and cannot seem to find a definite answer. Looking through the Django Project Bug Tracker, I h

Re: Restricting file access to users who uploaded the file.

2014-10-21 Thread Ben Lopatin
What you want to do is first restrict access to the model instance to which the file is associated. Presumably this model has a foreign key to your User model which you'd associate with the uploading user. Then your view will return some non-200 response, like a 401 response if the requesting u

Re: Specifying modelform meta field as get_user_model() in 1.7

2014-10-21 Thread Collin Anderson
Hi Derek, Interesting. Do you know why it's trying to import your form before the app registry is ready? It seems to me it might be possible to delay until after the app registry is ready. Could you post a traceback? Thanks, Collin -- You received this message because you are subscribed to th

Re: dropdown_filter in django

2014-10-21 Thread Collin Anderson
Hi Sachin, Interesting. It seems to me that should work. Could you post a traceback? Thanks, Collin -- 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-user

Inserting further fields of a foreignkey object into change list view

2014-10-21 Thread Vittorio
Dear Experts, Under Django 1.7 I have, among other things, the following: ### models.py class Patients(models.Model): surname = models.CharField(max_length=60, db_index=True) name = models.CharField(max_length=60, db_index=True) address = models.CharField(max_length=150) city = m

Re: Using ModelForm with ID associated with PostgreSQL Sequence

2014-10-21 Thread Collin Anderson
Hi Néstor, Are you using an AutoField()? It seems to me that _should_ work correctly. In any case setting editable=False should fix it. Otherwise, would it work to put your primary key field in exclude? class MyForm(forms.ModelForm): class Meta: model = MyModel exclude = ['i

Re: Many-to-many Relationship Between Django Apps Fails

2014-10-21 Thread Collin Anderson
Hi Paul, Interesting. Your code should work fine. So if you run this code in the shell it gives a FieldError? affpart.damage_types.all() What do your sitar models look like? There should not be a ManyToManyField in the other direction. Collin -- You received this message because you are sub

Re: Many-to-many Relationship Between Django Apps Fails

2014-10-21 Thread Daniel Roseman
On Tuesday, 21 October 2014 14:32:04 UTC+1, Paul Childs wrote: > > *What's been done so far:* > >- I was on Django 1.5 and upgraded to 1.6 (cannot go higher as we are >on Python 2.6) and this did not solve the problem. >- I have researched this issue to death and cannot seem to find a

Re: Inserting further fields of a foreignkey object into change list view

2014-10-21 Thread Collin Anderson
Hi Vittorio, Would this work? class OperationAdmin(admin.ModelAdmin): list_display = ('patient','date_of_operation') fields = ('patient', 'patient_address', 'patient_city_zip', 'date_of_operation') readonly_field = ['patient_address', 'patient_city_zip'] inlines= [DetailsInline

Re: Many-to-many Relationship Between Django Apps Fails

2014-10-21 Thread Paul Childs
Hey Collin, I had no problem in the shell... In [4]: AffectedPart.objects.all().count() Out[4]: 4090 # pick a random AffectedPart In [5]: affpart = AffectedPart.objects.all()[22] In [6]: affpart.damage_types.all() Out[6]: [] I'm not sure why this doesn't work running under the server.

Re: Restricting file access to users who uploaded the file.

2014-10-21 Thread Jon Dufresne
On Tue, Oct 21, 2014 at 7:09 AM, Ben Lopatin wrote: > Presuming you're working with Nginx or > Apache and local files, you can use X-Accel-Redirects or X-Sendfile to do > this. Basically the request for a file is made to your Django app, e.g. > /files/some-file-name.doc, and the app checks if the

Re: Inserting further fields of a foreignkey object into change list view

2014-10-21 Thread Collin Anderson
oops readonly_field should be readonly_field*s* -- 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,

Re: Many-to-many Relationship Between Django Apps Fails

2014-10-21 Thread Paul Childs
Here is the stack trace... Environment: Request Method: POSTRequest URL: http://127.0.0.1:8000/trending/trend/ Django Version: 1.6Python Version: 2.6.7Installed Applications:('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.cont

Re: Many-to-many Relationship Between Django Apps Fails

2014-10-21 Thread Collin Anderson
Hi Paul, This is great. The traceback helps. Could post more of your convert_queryset_to_lists. It looks like a list comprehension and there may be more complicated things going on there. Thanks, Collin -- You received this message because you are subscribed to the Google Groups "Django user

Re: Many-to-many Relationship Between Django Apps Fails

2014-10-21 Thread Collin Anderson
Hi Paul, Try putting 'trending' in INSTALLED_APPS. Collin -- 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

getting 500 131 error on page not found

2014-10-21 Thread Sabine Maennel
I really do not understand what is happening. I have a 404.html along with a 500.html in my template directory. They are both simple and look like this: 404.html: Server Error 404!Das netTeachers-Team ist informiert und kümmert sich darum. Wir hoffen auf Ihr Verständnis. 500.html: Server E

Re: robots.txt 404 errors are not ignored, even though I put it in my settings file

2014-10-21 Thread Sabine Maennel
Thank you very much for your help Collin! Am Dienstag, 21. Oktober 2014 03:29:38 UTC+2 schrieb Collin Anderson: > > Hi Sabine, > > IGNORABLE_404_URLS = ( > re.compile(r'^/apple-touch-icon.*\.png$'), > re.compile(r'^/favicon\.ico$'), > re.compile(r'^/robots\.txt$'), > ) > remove the sla

Re: Many-to-many Relationship Between Django Apps Fails

2014-10-21 Thread Paul Childs
I am SHOCKED. That was the problem. THANK YOU I guess that leads to a couple of questions: 1. How did you know!?! 2.I have the same code in production and it was working with no problems. Any idea why? Cheers! On Tuesday, October 21, 2014 1:12:33 PM UTC-3, Collin Anderson wrote: > > Hi Pau

Data migration fails because contenttypes not yet ready

2014-10-21 Thread Torsten Bronger
Hallöchen! I want to implement an initial data migration (basically, the same thing initial_data.json used to do). The problem is that my initial data must be connected with ContentType instances. However, update_all_contenttypes() hasn't been called at this stage, so my migration fails. As far

Re: Data migration fails because contenttypes not yet ready

2014-10-21 Thread Markus Holtermann
Hey Torsten, Are you talking about Django 1.7 migrations or South? In the former case you need to make sure that your datamigration depends on the contenttypes application. If you use South: yes, calling update_all_contenttypes seems to be a valid solution. Best, Markus On Tue, Oct 21, 2014 a

Re: djangoproject.com tutorial part 3

2014-10-21 Thread Tri Vo
Ok, I forgot say this. I'm using a different server to run Django. It works on the server that I am using. On Tue, Oct 21, 2014 at 3:42 AM, Daniel Roseman wrote: > On Tuesday, 21 October 2014 00:01:56 UTC+1, Tri Vo wrote: >> >> I am calling the page with "python manage.py runserver 0.0.0.0:8000"

Re: getting 500 131 error on page not found

2014-10-21 Thread Collin Anderson
Hi Sabine, It may be an issue with your core.context_processors.resolvermatch. I recommend setting ADMINS so you get the error emailed to you. https://docs.djangoproject.com/en/dev/howto/deployment/checklist/#admins-and-managers https://docs.djangoproject.com/en/dev/ref/settings/#admins Collin

Re: Inserting further fields of a foreignkey object into change list view

2014-10-21 Thread Vittorio
Great, it works! Thanks a lot Collin Ciao from Rome Vittorio Il giorno 21/ott/2014, alle ore 18:00, Collin Anderson ha scritto: > Hi Vittorio, > > Would this work? > > class OperationAdmin(admin.ModelAdmin): > list_display = ('patient','date_of_operation') > fields = ('patient', 'patie

Re: Many-to-many Relationship Between Django Apps Fails

2014-10-21 Thread Collin Anderson
Hi Paul, 1. How did you know!?! > I hack... kidding :). I suspected something wasn't getting loaded, and the list of installed apps was in the traceback you posted. 2.I have the same code in production and it was working with no problems. > Any idea why? > In development, most, if not all of yo

Re: Many-to-many Relationship Between Django Apps Fails

2014-10-21 Thread Paul Childs
Thanks man. This was a huge relief! On Tue, Oct 21, 2014 at 2:35 PM, Collin Anderson wrote: > Hi Paul, > > 1. How did you know!?! >> > I hack... kidding :). I suspected something wasn't getting loaded, and the > list of installed apps was in the traceback you posted. > > 2.I have the same code i

Re: Data migration fails because contenttypes not yet ready

2014-10-21 Thread Torsten Bronger
Hallöchen! Markus Holtermann writes: > Are you talking about Django 1.7 migrations or South? In the > former case you need to make sure that your datamigration depends > on the contenttypes application. I'm talking about Django 1.7 migrations. Unfortunately, contenttypes is already migrated bef

Django model complex query ( use table A.column1 as parameter to query result from table B)

2014-10-21 Thread zhang rock
Hi All, I have a question: how to use table A.column1 as parameter to query result from table B? I have two tables : 1. UserStay idcandidatePoiIdsselectedPoiId 1101,102,103 100 2. POIs id name address 100 starbuck 100 main st, 101 mcdonalds 101 m

Reverse lookup in search_fields on Admin

2014-10-21 Thread Emanuel
Hello all! I have this models: class Article(models.Model): name = models.CharField(...) class Sale(models.Model): ... class SaleItems(models.Model): article = models.ForeignKey(Article) And the Admin: class SaleAdmin(admin.ModelAdmin): search_fields = ('...', < and here is the proble

Re: Django model complex query ( use table A.column1 as parameter to query result from table B)

2014-10-21 Thread Vijay Khemlani
I think you are trying to establish a many-to-many relationship between the models, that way it would be like this poiRes = models.ManyToManyField(POIS) and the candidatePois is unnecessary in that case. On Tue, Oct 21, 2014 at 3:16 PM, zhang rock wrote: > Hi All, > > I have a question: how

Re: getting 500 131 error on page not found

2014-10-21 Thread Tom Evans
On Tue, Oct 21, 2014 at 4:19 PM, Sabine Maennel wrote: > I really do not understand what is happening. I have a 404.html along with a > 500.html in my template directory. They are both simple and look like this: > > 404.html: > > Server Error 404! > Das netTeachers-Team ist informiert und kümmert

Re: djangoproject.com tutorial part 3

2014-10-21 Thread Lee
Im not sure I understand so maybe I am stating the obvious here... but "python manage.py runserver" shouldnt call the page. It should start your dev server. Then you call http://localhost:8000/polls as Daniel mentioned when the server is started. On Tuesday, 21 October 2014 18:14:34 UTC+1, Tri

Re: Customize admin page title (from tutorial)

2014-10-21 Thread Pat Claffey
On Saturday, October 18, 2014 1:16:32 PM UTC+1, pranee...@gmail.com wrote: > > Hi, > I am new to django. I am following Django tutorial(part2). I want to > know how to customize title of my admin page from "*Django > administration" to " some Text".* Help me..*! *Thanks in advance.. >

Django tutorial with eCommerce solution

2014-10-21 Thread Mudassar Hashmi
I am looking for a django project based tutorial with fully developed eStore or a commerce solution. Please advise. -- 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 emai

Re: Django tutorial with eCommerce solution

2014-10-21 Thread Ezequiel Bertti
Try this: http://www.getlfs.com/ On Tue, Oct 21, 2014 at 11:28 PM, Mudassar Hashmi < mudassarhashm...@gmail.com> wrote: > I am looking for a django project based tutorial with fully developed > eStore or a commerce solution. > > Please advise. > > -- > You received this message because you are s

Re: dropdown_filter in django

2014-10-21 Thread Sachin Tiwari
Hi Collin, It works when I comment the filters.py and change admin.py as below, from receivedata.filters import DropdownFilter class PersonAdmin (admin.ModelAdmin): list_filter = (PersonIdFilter) Thanks & Regards, Sachin Tiwari -- You received this message because you are subscribed t

how to save in inline form total sum

2014-10-21 Thread carlos
Hi, i need sum inlines field but i no have idea example for more clean, i have 2 models in models.py i have: class ModelA(models.Model): field1 = charfield(...) field2 = integeterfield() . CHOICE_TYPE = ((1,"option1"),(2,"option2"),(3,"option3")) class ModelB(models.Model):