Re: i'm having issues displaying parent.model.childmodel_set.all on my template

2018-05-03 Thread stanley oguazu
Yes all the data in ScrumyUser table displays -- 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: serving admin files in Apache

2018-05-03 Thread sum abiut
Thanks, i've try that but still doesn't solve the problem On Fri, May 4, 2018 at 11:51 AM, James Farris wrote: > Did you run > $ python manage.py collectstatic in your project folder on the server that > is running Apache? > > This add all css, js, and images to the

Re: How can I use a variable from the instance of my data in the upload path for a FileField in my model?

2018-05-03 Thread Alexander Joseph
Thanks! Heres my method now, it works great... def upload_path(instance, filename): return os.path.join('uploads/' + datetime.datetime.now().strftime('%Y/%m/%d/') + instance.design_ui, filename) On Thursday, May 3, 2018 at 6:59:17 PM UTC-6, James Farris wrote: > > I did something very

Re: Working through the Django tutorial and have run into a problem I cannot figure out. Help would be appreciated. What am I missing here? whenever is search the url "http://127.0.0.1:8000/polls/" th

2018-05-03 Thread James Farris
In looks like there is a syntax error also in your polls/urls.py Your missing the opening < This: path(‘int:question_id>/vote/', views.vote, name='vote'), Should be this: path('/vote/', views.vote, name='vote'), On Thu, May 3, 2018 at 10:12 AM Avitab Ayan Sarmah wrote: >

Re: How can I use a variable from the instance of my data in the upload path for a FileField in my model?

2018-05-03 Thread James Farris
I did something very similar in my models.py. I think for the date you have to get the year, month with datetime. def get_upload_path(self, filename): return 'pictures/{0}/{1}'.format(self.user.username, filename) pet_image = models.ImageField(upload_to=get_upload_path, blank= True) On Thu, May

Re: serving admin files in Apache

2018-05-03 Thread James Farris
Did you run $ python manage.py collectstatic in your project folder on the server that is running Apache? This add all css, js, and images to the static root folder you specified in settings.py On Thu, May 3, 2018 at 4:40 PM sum abiut wrote: > Hi, > I have recently setup my

Re: i'm having issues displaying parent.model.childmodel_set.all on my template

2018-05-03 Thread James Farris
If you add {{ my_users }} to your template do you get any output? If not, you’re query set has no results. On Thu, May 3, 2018 at 4:51 PM stanley oguazu wrote: > //My template is only displaying the parent table, and not displaying > child table > > You received this message

Upgrading from 1.11 to 2.0: "sqlite3.OperationalError: no such table"

2018-05-03 Thread Michael Gauland
I've got a project that's been developed using django 1.11. I've tried upgrading to 2.0, but now I'm getting an error I haven't been able to track down. My database engine is sqlite3. I have three database files: - db.sqlite3 is the default. This is the only one that django manages, and the

Re: OperationalError

2018-05-03 Thread Gerald Brown
Thanks for the reply.  Will check it out.  Just printed the documentation. On Friday, 04 May, 2018 03:08 AM, 'Anthony Flury' via Django users wrote: Django 2.0 docs suggest using reportlab : https://docs.djangoproject.com/en/2.0/howto/outputting-pdf/ I had some success with : pupeteer -

i'm having issues displaying parent.model.childmodel_set.all on my template

2018-05-03 Thread stanley oguazu
//My template is only displaying the parent table, and not displaying child table

serving admin files in Apache

2018-05-03 Thread sum abiut
Hi, I have recently setup my django app with Apache. The app files are serve alright but, however when i access the admin page it looks all over the place. Please advise how to i serve the admin files in Apache. Cheers, -- You received this message because you are subscribed to the Google

Re: Nullable vs empty strings

2018-05-03 Thread George Lubaretsi
Short answer: because you'll know when you need it. And unless that's the case - there's no good reason to do it. Long answer: Because there's really no reason to do it except for when you have unique constraint on that column. It's just a convention. When you have a `CharField`, you expect

Re: How can I use a variable from the instance of my data in the upload path for a FileField in my model?

2018-05-03 Thread Alexander Joseph
Actually I figured this out... kind of You have to make a method for assigning the upload path in the model.. something like def upload_path(instance, filename): return os.path.join('uploads/%Y/%m/%d/' + instance.design_ui, filename) and instance the method in your FileField...

Re: Admin site and ModelAdmin

2018-05-03 Thread jt . oldnews
Thanks for the response Mike. I generally don't like it when a design has to change to fit a framework, however, in this case I decided to try your solution. I ran into a couple of problems though :-( 1) The fields that I'm looking up were required fields. Validation failed and error messages

How can I use a variable from the instance of my data in the upload path for a FileField in my model?

2018-05-03 Thread Alexander Joseph
Not even sure if you can do it this way. I'm thinking theres another way like overriding the save or the form_valid function in the view... but I'm trying to use a variable from my instance in my upload path for my file field. If I should do something like override the save method in the view

Re: Upload of file with FileField working in admin but not in template

2018-05-03 Thread Alexander Joseph
That was it, thank you! On Thu, May 3, 2018 at 12:35 PM, Andréas Kühne wrote: > Hi, > > The problem isn't CBV's, it's probably your template. > > You have the following: > > > But it should be: > > > Otherwise the browser doesn't know how to encode the files

Re: Nullable vs empty strings

2018-05-03 Thread Nick Sarbicki
Thanks for the replies both. I know the difference between a NULL value and an empty string :-D. My question was more why Django recommends _never_ using null=True on CharFields. >From both replies it sounds like neither of you agree with this guideline... On Thursday, May 3, 2018 at 2:18:32

Re: Djangocon Europe plans?

2018-05-03 Thread Jani Tiainen
Hi. I'm staying in Holiday Inn at city centre. Not sure is it any closer than confrence hotels. I got my room reserved at the beginning of March though. to 3. toukokuuta 2018 klo 19.59 C. Kirby kirjoitti: > Who is going? where are you staying? etc > > I'll be flying in on

Re: OperationalError

2018-05-03 Thread 'Anthony Flury' via Django users
Django 2.0 docs suggest using reportlab : https://docs.djangoproject.com/en/2.0/howto/outputting-pdf/ I had some success with : pupeteer - http://django-puppeteer-pdf.readthedocs.io/en/latest/ - which works by having a CBV type framework - so you subclass a PDF template view - and that will

Re: Upload of file with FileField working in admin but not in template

2018-05-03 Thread Andréas Kühne
Hi, The problem isn't CBV's, it's probably your template. You have the following: But it should be: Otherwise the browser doesn't know how to encode the files Regards, Andréas 2018-05-03 18:44 GMT+02:00 Alexander Joseph : > I'm using CBVs and trying to

Re: Working through the Django tutorial and have run into a problem I cannot figure out. Help would be appreciated. What am I missing here? whenever is search the url "http://127.0.0.1:8000/polls/" th

2018-05-03 Thread Avitab Ayan Sarmah
thank you Anthony, now i will try your code and i am sure it will run this time On Thu, May 3, 2018 at 10:37 PM, 'Anthony Flury' via Django users < django-users@googlegroups.com> wrote: > I think the root cause of the errors was due to an incorrect settings - > but Fidel is right that your

Re: Working through the Django tutorial and have run into a problem I cannot figure out. Help would be appreciated. What am I missing here? whenever is search the url "http://127.0.0.1:8000/polls/" th

2018-05-03 Thread 'Anthony Flury' via Django users
I think the root cause of the errors was due to an incorrect settings - but Fidel is right that your views.py wasn't great either. On 03/05/18 17:36, Avitab Ayan Sarmah wrote: thank you Fidel, and i will take care of it On Thu, May 3, 2018 at 9:57 PM, Fidel Leon

Djangocon Europe plans?

2018-05-03 Thread C. Kirby
Who is going? where are you staying? etc I'll be flying in on Tuesday from DC. I'm in for the conference but not the sprints. Will be giving a talk at the end of the first day. I haven't booked my hotel yet. I usually like staying closer to the venue so I can walk and not deal with public

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread 'Anthony Flury' via Django users
Serves me right for writing code without testing :-( It of course should be :             import os             top_dir = os.path.join(os.getcwd(), 'python_created_me')             os.makedirs(top_dir) Glad you have it sorted - and glad it turned out not to be Django ... On 03/05/18 17:06,

Upload of file with FileField working in admin but not in template

2018-05-03 Thread Alexander Joseph
I'm using CBVs and trying to upload a file with a FileField. It seems to work in admin but not in my template. It doesnt give any errors when creating the record and it saves the rest of the data in the form, but it doesnt save the attachment Heres my model class

Re: Working through the Django tutorial and have run into a problem I cannot figure out. Help would be appreciated. What am I missing here? whenever is search the url "http://127.0.0.1:8000/polls/" th

2018-05-03 Thread Avitab Ayan Sarmah
thank you Fidel, and i will take care of it On Thu, May 3, 2018 at 9:57 PM, Fidel Leon wrote: > Sure: > > from django.http import HttpResponse > > from .models import Question > > > def index(request): > latest_question_list = Question.objects.order_by('-pub_date')[:5] >

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread Duška Miloradović
Ha! I will try to see what will happen when I disable Comodo. I hope it will work properly then. Thanks Fidel Leon. On Thu, May 3, 2018 at 6:24 PM, Fidel Leon wrote: > As part of its protection, Comodo Antivirus has something named > “sandboxing”, so when you execute anything,

Re: Working through the Django tutorial and have run into a problem I cannot figure out. Help would be appreciated. What am I missing here? whenever is search the url "http://127.0.0.1:8000/polls/" th

2018-05-03 Thread Fidel Leon
Sure: from django.http import HttpResponse from .models import Question def index(request): latest_question_list = Question.objects.order_by('-pub_date')[:5] output = ', '.join([q.question_text for q in latest_question_list]) return HttpResponse(output) def detail(request,

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread Fidel Leon
As part of its protection, Comodo Antivirus has something named “sandboxing”, so when you execute anything, Comodo catches it, runs it inside a protected environment and if it finds it’s not malware, runs the actual command. Seems Comodo is mapping your D: drive to that C:\VTRoot\HarddiskVolume1

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread Duška Miloradović
Yes? :/ On Thu, May 3, 2018 at 6:09 PM, Fidel Leon wrote: > Are you using Comodo Antivirus? > > https://forums.malwarebytes.com/topic/181573-cvtroot/ > > > > El jue., 3 may. 2018 a las 18:06, Duška Miloradović (< > daisyfields...@gmail.com>) escribió: > >> Anthony, I got this: >>

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread Fidel Leon
Are you using Comodo Antivirus? https://forums.malwarebytes.com/topic/181573-cvtroot/ El jue., 3 may. 2018 a las 18:06, Duška Miloradović (< daisyfields...@gmail.com>) escribió: > Anthony, I got this: > > D:\projectdir>python create_dir.py > Traceback (most recent call last): > File

Re: Working through the Django tutorial and have run into a problem I cannot figure out. Help would be appreciated. What am I missing here? whenever is search the url "http://127.0.0.1:8000/polls/" th

2018-05-03 Thread Avitab Ayan Sarmah
hello Fidel Leon can you please rewrite the whole views.py code so that i can understand what is the exact code is On Thu, May 3, 2018 at 9:19 PM, Fidel Leon wrote: > > > El jue., 3 may. 2018 a las 17:38, Avitab Ayan Sarmah (< > avitabay...@gmail.com>) escribió: > >> >>

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread Duška Miloradović
Anthony, I got this: D:\projectdir>python create_dir.py Traceback (most recent call last): File "create_dir.py", line 2, in top_dir = path.join(os.getcwd(), 'python_created_me') NameError: name 'path' is not defined I searched for it through windows explorer again and I actually *found

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread Fidel Leon
Please try to create a different project specifying -v 3: $ django-admin startapp -v 3 mytest The output should tell you where django-admin is creating its files and could be a clue about where is your mysite :) El jue., 3 may. 2018 a las 14:24, Duška Miloradović (< daisyfields...@gmail.com>)

Re: Working through the Django tutorial and have run into a problem I cannot figure out. Help would be appreciated. What am I missing here? whenever is search the url "http://127.0.0.1:8000/polls/" th

2018-05-03 Thread Fidel Leon
El jue., 3 may. 2018 a las 17:38, Avitab Ayan Sarmah () escribió: > > *polls/views.py*: > > from django.http import HttpResponse > from django.template import loader > > from . models import Question > > def index(request): > return HttpResponse("Hello, world.You're at the

Working through the Django tutorial and have run into a problem I cannot figure out. Help would be appreciated. What am I missing here? whenever is search the url "http://127.0.0.1:8000/polls/" the si

2018-05-03 Thread Avitab Ayan Sarmah
*mysite/urls.py:* from django.contrib import admin from django.urls import include, path urlpatterns = [ path('', include('polls.urls')), path('admin/', admin.site.urls), ] *polls/templates/polls/index.html*: {% if latest_question_list %} {% for question in latest_question_list %} {{

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread 'Anthony Flury' via Django users
On 03/05/18 08:06, Anthony Flury wrote: On Thursday, 03 May, 2018 03:25 PM, Daisy wrote: I tried what you suggested and got this: D:\projectdir>python create_dir.py Traceback (most recent call last):   File "create_dir.py", line 1, in     from os import mkdirs

Re: Use self-increasing arguments in numeric for-loop in Django

2018-05-03 Thread Peter of the Norse
First of all, this is a terrible idea. You should fix up graphobject in your view to do what you want, not try to massage it in your template. Second, you can’t use template tags inside a template. That’s not how it works at all. Third, you are not the first to have this terrible idea. You

Re: Trouble raising forms.ValidationError in save() override in admin.py

2018-05-03 Thread Gonzalo Amadio
This is very old, but in the case someone red this. If you do it on the save method of the admin, you MUST save the model. So you should override admin's form. Check it here how to do it : http://itegram.com/2018/05/03/ add-extra-control-to-admin-save-method/

Re: model permission assignment via groups requires further config at model level?

2018-05-03 Thread gibsonal2026
that is good On Monday, April 30, 2018 at 7:08:16 AM UTC-5, Rob B wrote: > > Thanks George - I understand now. I never thought it would only apply to > the admin interface but should have. Kind regards, > > Rob > > > On Sun, Apr 29, 2018, 10:05 PM George Lubaretsi, >

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread Duška Miloradović
I wrote what versions I have installed in first post, but here is a result of what you've asked: For the first command output is: Python 3.6.3 and for the second: 2.0.5 On Thu, May 3, 2018 at 3:43 PM, James Farris wrote: > If you run these two commands from your command

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread James Farris
If you run these two commands from your command line, what is the output? python -V django-admin.py version > On May 3, 2018, at 5:23 AM, Duška Miloradović > wrote: > > Ayser, thank you very much but that did not help neither. It is still the > same - command ends

RE: OperationalError

2018-05-03 Thread Matthew Pava
I use PhantomJS with Django to create PDFs. I just pass in the URL with the session variable (to maintain authentication) and a few other parameters into a customized Rasterize.js script. Is it an “easy” way? I wouldn’t say so, but it works for us. It gets really crazy when you start asking,

Re: Nullable vs empty strings

2018-05-03 Thread Jani Tiainen
And then you find out that Oracle implicitly converts empty strings to NULLs which causes all kind of hassle. :) On Thu, May 3, 2018 at 3:39 PM, Ken Whitesell wrote: > Nick, > > A null string (string with length 0) is _not_ the same as a null > field (no string).

Re: Nullable vs empty strings

2018-05-03 Thread Ken Whitesell
Nick, A null string (string with length 0) is _not_ the same as a null field (no string). The two are distinct, and (can) serve two very different functions. Take a look at this for some more detailed information:

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread Duška Miloradović
Ayser, thank you very much but that did not help neither. It is still the same - command ends successfully but still I do not see new folder created. On Thu, May 3, 2018 at 8:13 AM, Ayser shuhaib wrote: > Create your projectdir manually then inside the projectdir

Re: OperationalError

2018-05-03 Thread Gerald Brown
FINALLY. SUCCESS!!! What I ended up doing to correct the problem was to drop the whole database (NO RECORDS YET). When I tried to run migrations it said there were no changes. I then had to run makemigrations and migrate so I am now back in business!!! Now does anyone know of an *easy* way

[no subject]

2018-05-03 Thread Muwanguzi Derrick
Hlo am a new django user I want be your friend for help -- 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

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread Umar Kambala
That its not recognized as internal or external command On May 3, 2018 11:21 AM, "Ayser shuhaib" wrote: > Create your projectdir manually then inside the projectdir folder (right > click with your mouse and open command window here) > After that continue with Django

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread Ayser shuhaib
Create your projectdir manually then inside the projectdir folder (right click with your mouse and open command window here) After that continue with Django commands django-admin startproject ... On Thu, 03 May 2018 at 07:59, Daisy wrote: > Thank you very much for your

Re: OperationalError

2018-05-03 Thread Gerald Brown
I finally discovered what I think is the cause of my problem. *DJANGO MIGRATIONS ARE NOT WORKING.*On the system that has the problem is where I made migration to change some of the field names.  The fields that were not found where the ones that did get changed but the old unchanged names were

Re: Adding to all templates context via Middleware

2018-05-03 Thread Daniel Roseman
On Thursday, 3 May 2018 01:36:26 UTC+1, Bernd Wechner wrote: > > This interests me: > > > https://teamtreehouse.com/community/django-how-can-i-retrieve-a-value-from-the-middleware > > alas no answer there, and time has changed things. > > I have checked form experience, that stuff added to

Nullable vs empty strings

2018-05-03 Thread Nick Sarbicki
I just saw this in the docs: https://docs.djangoproject.com/en/2.0/ref/models/fields/#null Suggesting that you should never set a CharField to null unless using a unique index. Is this generally accepted? Historically I've always nulled a CharField because using empty strings, as opposed to

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread Duška Miloradović
It is on C. I tried to create "mysite" also on C path but the result is the same. On Thu, May 3, 2018 at 9:49 AM, Gerald Brown wrote: > Is Django installed on your C: or D: drive? If it is on C: then "mysite" > should also be on C: > > On Thursday, 03 May, 2018 03:25 PM,

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread Gerald Brown
Is Django installed on your C: or D: drive?  If it is on C: then "mysite" should also be on C: On Thursday, 03 May, 2018 03:25 PM, Daisy wrote: I tried what you suggested and got this: D:\projectdir>python create_dir.py Traceback (most recent call last):   File "create_dir.py", line 1, in    

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread Daisy
I tried what you suggested and got this: D:\projectdir>python create_dir.py Traceback (most recent call last): File "create_dir.py", line 1, in from os import mkdirs ImportError: cannot import name 'mkdirs' среда, 02. мај 2018. 23.13.29 UTC+2, Daisy је написао/ла: > > I installed django

Re: Need help: django-admin.py startproject [projectname] creates directory which I cannot access

2018-05-03 Thread 'Anthony Flury' via Django users
On 03/05/18 06:59, Daisy wrote: Thank you very much for your reply, and here I my answers:   * Does the directory show up when you do a *dir* command in projectdir ? It does not show up, although it says that there are 2 directories (see attachment). Those two directories '.' & '..' are

Re: OperationalError

2018-05-03 Thread Gerald Brown
Been there. Done that. Many times!!!  Still can't find the field list that it is complaining about. What is really weird is that the same code runs on 2 other computers without any errors. On Wednesday, 02 May, 2018 09:16 PM, Matthew Pava wrote: “random letters & numbers” That looks