Re: Problems from writing test cases.

2018-12-10 Thread ANi
Oh. ok :) Then I tried to call again the item object by its pk, and it works. item = Item.objects.get(pk=self.item.pk) and sorry for the test_item_delete(). I passed the wrong parameter so the view got a None to retrieve the item object, that's why it returns 404. thank you so much. -- You

Re: Problems from writing test cases.

2018-12-10 Thread Yarving Liu
For the: self.assertEqual(self.item.category, 2) this is because you defined self.item in setUp, and self.category = 1. Others have no idea, expect answers the same. On Tue, Dec 11, 2018 at 12:00 PM ANi wrote: > Hello, > I am now trying to write test cases for my project, but I find some > pr

Problems from writing test cases.

2018-12-10 Thread ANi
Hello, I am now trying to write test cases for my project, but I find some problems. 1. class FirstTest(TestCase): @classmethod def setUpTestData(cls): User.objects.create(username = 'johndoe', password = 'goodtobehere123') ... def test_case_one(self): user =

Re: Using reflection with Django models to determine module containing the choices?

2018-12-10 Thread Stodge
Thanks Simon. It's for an offline tool so high performance isn't the top priority. On Monday, 10 December 2018 11:56:53 UTC-5, Simon Charette wrote: > > Given choices are defined at the module level I guess you could > iterate over objects defined in each `sys.modules` (or the ones > likely to de

Re: How to transfer django projects from one pc to another

2018-12-10 Thread Mike Dewhirst
On 11/12/2018 12:03 PM, Simon A wrote: On Tuesday, December 11, 2018 at 3:14:07 AM UTC+8, computer engineering Forum wrote: I want to change my pc but i fear i wont be able to access the projects I would assume my new pc is going to fail five minutes after I successfully transfer pr

Re: How to transfer django projects from one pc to another

2018-12-10 Thread Simon A
if you are really lazy, you can just zip your whole project. then transfer to another machine. I transfer my projects from work (using windows) to home (using ubuntu) then vice versa. I only had to manually install the necessary packages will be notified to you when you need to get them install

Manage static files using Jinja2

2018-12-10 Thread miguel . yurivilca
I am using the documentation to learn Django. When I started creating static files, I started to get problems. I am using this: https://docs.djangoproject.com/en/2.1/howto/static-files/ but I think it is using Django template engine. How can I fix this problem? Does every static file needs a ur

Re: How to transfer django projects from one pc to another

2018-12-10 Thread Swetank Subham Roy
1. Make requirement file let's say requirement.txt using pip freeze command, which keep records of packages used in the project. 2. Make a copy of project folder to the new machine. 3. Create virtual environment on new machine. 4. Activate and install package from requirement.txt file to the virtua

wsgi_module not found on windows

2018-12-10 Thread mostafa .H
I asked a question in this StackOverflow question , Please take a look and if you're able to answer it please help me. this is the question for ones who don't access to StackOverflow: After installing the *mod_w

How to transfer django projects from one pc to another

2018-12-10 Thread computer engineering Forum
I want to change my pc but i fear i wont be able to access the projects -- 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

Re: Order of migration dependencies when running makemigrations from scratch

2018-12-10 Thread Dakota Hawkins
Thanks again, Simon! Filed 30029 On Sunday, December 9, 2018 at 11:28:54 PM UTC-5, Simon Charette wrote: > > Hello Dakota, > > From looking at the autodetector code in charge of generating these > lists[0] > and the loader code in charge of resolving

RE: Cannot get this ModelForm view to save to the db, what am I doing wrong please

2018-12-10 Thread Matthew Pava
It’s hard to tell with some of the spacing in your email. Python cares deeply about spacing. When initializing a form, I typically do it as so: form = RegisterForm(request.POST or None) Also, the save method on the model has several arguments that you are not passing around. def save(self

Re: Using reflection with Django models to determine module containing the choices?

2018-12-10 Thread Simon Charette
Given choices are defined at the module level I guess you could iterate over objects defined in each `sys.modules` (or the ones likely to define choices) and use the `is` operator to compare all of them to the field choices. This will perform badly and shouldn't be used for anything else than one

Cannot get this ModelForm view to save to the db, what am I doing wrong please

2018-12-10 Thread MikeKJ
Cannot seem to get .save() to write to the db This is the model class Customer(models.Model): email = models.EmailField() postcode = models.CharField(max_length=10) def __unicode__(self): return self.email def save(self): self.postcode=upper(self.postcode)

Using reflection with Django models to determine module containing the choices?

2018-12-10 Thread Stodge
Let's say I take the following code from the Django documentatation: class Student(models.Model): FRESHMAN = 'FR' SOPHOMORE = 'SO' JUNIOR = 'JR' SENIOR = 'SR' YEAR_IN_SCHOOL_CHOICES = ( (FRESHMAN, 'Freshman'), (SOPHOMORE, 'Sophom

RE: Poor Performance for Form Rendering In Django 1.11

2018-12-10 Thread Matthew Pava
I vaguely remember having this issue when I moved to Django 1.11. It was frustrating. I have thus far refused to move over to Jinja, and I just use autocompletes for my large select widgets. There is also the possibility of using template fragment caching. Wrap the select in a cache block, a

Re: Poor Performance for Form Rendering In Django 1.11

2018-12-10 Thread John
Yes, the form has about a dozen selects, with two in particular being larger - the country and the currency fields - that probably have a couple hundred options each. I have since removed those two fields which leaves about 10 selects with about 80 options total. While these numbers fluctuate

Re: Poor Performance for Form Rendering In Django 1.11

2018-12-10 Thread James Bennett
On Mon, Dec 10, 2018 at 6:29 AM John Lehmann wrote: > So my takeaway from what you are saying is that no one is running a > production site with a Django select field to render a country or currency > option (e.g., django-countries or django-money), because either of these > would have well over

Re: Django UpdateView and Createview

2018-12-10 Thread Ryan Nowakowski
Hrrmmm... that documentation link should've answered most of your questions. It would be easier to help you if you can say specifically what you're confused about. On Mon, Dec 10, 2018 at 01:34:53AM -0800, Rupam Hazra wrote: > Hi all, > > I know and understand how update view working but in my c

Re: Poor Performance for Form Rendering In Django 1.11

2018-12-10 Thread John Lehmann
Hi James, Thank you for the input! So my takeaway from what you are saying is that no one is running a production site with a Django select field to render a country or currency option (e.g., django-countries or django-money), because either of these would have well over a hundred entries (and my

Issue with model method

2018-12-10 Thread Felix Lazaro Carbobonell
Good day to everyone. I have defined a model method wich is called on a template (DTL) and the result is None when I test the URI with selenium. Normal attributes from the model are displayed correctly. But when I test the same URI with the Django test client it works as expected and the re

Re: Poor Performance for Form Rendering In Django 1.11

2018-12-10 Thread James Bennett
On Mon, Dec 10, 2018 at 5:31 AM John Lehmann wrote: > I am still hoping however for someone to explain to me why the default > renderer cannot handle my use case, such as that a few hundred inputs is > too many, or that I am doing something else improperly. Surely this kind > of a change would n

Re: help

2018-12-10 Thread Jason
that is an invalid URL you have in the browser address bar. you don't need the curly braces or dict format. just simply 127.0.0.1:8000/todo/dailytask -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop rece

Re: Poor Performance for Form Rendering In Django 1.11

2018-12-10 Thread John Lehmann
Hi Simon, thanks for the response. I am still hoping however for someone to explain to me why the default renderer cannot handle my use case, such as that a few hundred inputs is too many, or that I am doing something else improperly. Surely this kind of a change would not be made to the framewor

Re: Django UpdateView and Createview

2018-12-10 Thread Sidnei Pereira
Hi, I don't know if I got it right , but you want to add/update as many instance of Technologies as you want when creating/updating a Project, right? Like when you use an inline on Django's admin .

function get_form_kwargs() not being called

2018-12-10 Thread Simon A
I'm trying to pass a parameter from a redirect to the CreateView and to the form. I have no problem retrieving the value from the redirect to the CreateView. But my issue is when trying get the value to the form. I'm overriding get_form_kwargs function of my CreateView but when I try to do o

Multiple Forms in UpdateView

2018-12-10 Thread Lekan
Hello, is there a way to edit two update and save two forms from two different models with update view.. the issue is that i have two forms that i use in a single form format.now i want to write an update view for the it. how do i update two models in a updateView. -- You received this

Re: drop down multi checkbox with bootstraps selet

2018-12-10 Thread manikanta katikam
can u plese send this code On Saturday, March 18, 2017 at 10:28:07 PM UTC+5:30, ايهاب توفيق wrote: > > I am tring to create drop down checkbox with values from database in my > templet using bootstrap select and form MultipleChoiceField like this > > > > Html > > select class="selectpicker"

pdf file generated using reportlab , getting saved as plain text

2018-12-10 Thread tasiftarikul
this is the first time i'm using reportlab. i copied the exact code from django documentation. https://docs.djangoproject.com/en/2.1/howto/outputting-pdf/. when i save the file its getting saved as plain text document (text/plain). the name remains the same hello.pdf. p = canvas.Canvas(buffer)

Re: Django website

2018-12-10 Thread Riska Kurnianto
Really good to start with diagram, such as UML, theb class diagram, then coding... On Mon, 10 Dec 2018, 01:02 Kasper Laudrup Hi Abiye, > > On 09/12/2018 09.01, Abiye Anabraba wrote: > > Hello am Abiye, > > Please I want to create a site like nnu.ng any idea no how to go about > > this?. Thanks >

Oracle Production DBA automation -django based dbawebmenu application

2018-12-10 Thread Ketan
Dear All, Recently, I have developed new django based application which is useful for Oracle Database Administrator for their daily operational task. Programming is not my major skill. Most of my experience in Oracle Production Support only but automation is my strong desire and due to that,

Re: Django in Linux set image

2018-12-10 Thread Riska Kurnianto
in staging or production env, You need to specify STATIC_ROOT in settings.py and run "manage.py collectstatic". On Mon, 10 Dec 2018, 10:28 pujiarahman Hi all, > > i have instaled django in ubuntu, > i have image and i put in folder (*img*), the locate is > > blog > urls.py > views.py > admin.py

Subclassing Django Views Issue

2018-12-10 Thread Shazia Nusrat
Can someone help me with subclassing django-views as I couldn't understand the pattern to work with. Following is the link to see the code. https://github.com/AndrewIngram/django-extra-views/issues/187 Regards, Shazia -- You received this message because you are subscribed to the Google Groups

Re: Django UpdateView and Createview

2018-12-10 Thread Rupam Hazra
Hi all, I know and understand how update view working but in my case how to implement on my case. Please suggest.; On Sunday, 9 December 2018 23:13:04 UTC+5:30, Okware Aldo wrote: > > Ryan's suggestion should give you a starting point. > > On Sun, Dec 9, 2018 at 3:43 PM Deepak Kumar > wrote:

Re: Django in Linux set image

2018-12-10 Thread PASCUAL Eric
Hi, Which server are you using ? Is is runserver ? When running in debug mode, it serves statics, but not when debug mode is turned off. If you Google with "django runserver static debug" you'll get this hit in the very first ones : https://stackoverflow.com/questions/5836674/why-does-debug-