Re: CRUD code feedback

2018-01-27 Thread Akhil Lawrence
Hi Jarvis, The code which you have posted only shows the model. Within your cat and dog models the owner can be null. Which explains why the owner is not associated with the pets. Can I see the code you tried to insert the records? ## changes needed in models models.ForeignKey(Owner, related_n

Re: CRUD code feedback

2018-01-27 Thread Akhil Lawrence
Your create view do not accept owner as a input and according to your models, owner can be null. That's the problem. Include owner to your create view fields as shown below. Also you may consider making owner mandatory as mentioned in my previous response. class CreateDog(CreateView): mode

Re: CRUD code feedback

2018-01-27 Thread Akhil Lawrence
pet (dog or cat) it will delete the owner who owns them? > > On Sun, Jan 28, 2018 at 1:11 PM, Akhil Lawrence > wrote: > >> Your create view do not accept owner as a input and according to your >> models, owner can be null. That's the problem. Include owner to your cre

Re: CRUD code feedback

2018-01-27 Thread Akhil Lawrence
, tango ward > wrote: > >> Will try it now. >> >> Quesion about the on_delete=models.CASCADE, does this mean that if I >> delete the pet (dog or cat) it will delete the owner who owns them? >> >> On Sun, Jan 28, 2018 at 1:11 PM, Akhil Lawrence > > w

Re: CRUD code feedback

2018-01-27 Thread Akhil Lawrence
or owner field using Pet_Owner = > get_user_model() .Problem is, it shows all the Users in the project not the > only one who is currently logged in. > > On Sun, Jan 28, 2018 at 2:06 PM, Akhil Lawrence > wrote: > >> Its the reverse. If the owner is deleted, all the

Re: CRUD code feedback

2018-01-27 Thread Akhil Lawrence
er(CreateDog, self).get_initial() > initial_data["owner"] = [(self.request.user.id, > self.request.user.username)] > return initial_data > > > still I am getting the Admin user in the drop down list for owner. > > On Sun, Jan 28, 2018 at 2:31 PM, Akhil La

Re: CRUD code feedback

2018-01-28 Thread Akhil Lawrence
gt; On Sun, Jan 28, 2018 at 5:32 PM, tango ward > wrote: > >> Thanks, I'm digesting it. I am going to use the first option. >> >> On Sun, Jan 28, 2018 at 3:20 PM, Akhil Lawrence > > wrote: >> >>> I doubt whether you are reading my response proper

Re: CRUD code feedback

2018-01-28 Thread Akhil Lawrence
):form.instance.owner = self.request.userreturn super(CreateDog, self).form_valid(form)* On Sunday, 28 January 2018 19:32:35 UTC+5:30, Akhil Lawrence wrote: > > This error message is tricky. > > According to your model definition *owner* is of type *Owner*. This error >

Re: CRUD code feedback

2018-01-28 Thread Akhil Lawrence
eturn self.name > > > views.py > > > class CreateDog(CreateView): > template_name = 'dogs_cats/create_dog.html' > model = Dog > fields = ('name', 'bday') > > def form_valid(self, form): > form.instance.owner = self

Re: CRUD code feedback

2018-01-28 Thread Akhil Lawrence
27;dogs', >>> on_delete=models.CASCADE) >>> >>> def __str__(self): >>> return self.name >>> >>> >>> views.py >>> >>> >>> class CreateDog(CreateView): >>> template_name = '

Re: num2words - help

2018-01-28 Thread Akhil Lawrence
You need to write a template tag which will make use of the num2words library to convert the cash to words and apply it in your template. Lets say your template tag name is *num2wo

Re: Error

2018-01-28 Thread Akhil Lawrence
The error stack or explanation you have given is very hard to understand the problem. I guess the *name* you mentioned is *MIGRATION_MODULES[app]*. Within your code you are assigning *MIGRATION_MODULES[app] = None* So I would suggest to add a check like *if name and name.startswith('.'):*

Re: Django view to call api

2018-01-28 Thread Akhil Lawrence
Looking at the log you have posted I guess you are not sending any data to the api. Look at the query dicts, the second one is empty. What is the message that you get along with the 400 response? On Monday, 22 January 2018 15:34:39 UTC+5:30, chern...@gmail.com wrote: > > So i'm using django vie

Re: EDMS (Electronic Document Management System )

2016-05-28 Thread Akhil Lawrence
If you are going to work with documents try mongodb On Saturday, 28 May 2016 01:44:57 UTC+5:30, Jorge Maciel wrote: > > Hi, I'm developing a EDMS (Electronic Document Management System ) for > small business. I am in doubt about the infrastructure should I use to > create this system . I think h

Re: How to implement a ManyToManyField with a View

2016-05-28 Thread Akhil Lawrence
Hi Bruce, You need to call `contact.relationship.all` instead of `contact.relationship_set.all` We use `_set.all` when we want to retrieve the related items from the master/parent object (Relationship in your case). So if you want to retrieve all contacts under a relationship you can use `.re

Re: I am not able to run the following code

2016-05-28 Thread Akhil Lawrence
Hi Madhusudhana, When you try to create the instance of Template, its looking for settings that is why you are getting error. *You cannot play in python shell without creating django project* Create the project and use django shell. The following code snippets may help you in creating project

Re: why blank page when load a list or dictionary into web to display a list

2016-05-28 Thread Akhil Lawrence
Dude, You need to make the following changes. 1. you need to pass a dictionary as the context in your views return render(request, 'approval.html', {'posts': posts}) 2. the prefer the posts to be list of dict change posts = {} ... LL = [(1,eac

Re: Model inheritance with constraints

2016-05-28 Thread Akhil Lawrence
Its already addressed. You can simply run ./manage.py makemigrations and ./manage.py migrate it will create migrations only for MyAnotherFunModel On Thursday, 26 May 2016 01:02:08 UTC+5:30, Arnab Banerji wrote: > > Hi all, > > I currently have a set of models associated with my Django app, w

Re: How to send e-mail asynchronously

2016-05-28 Thread Akhil Lawrence
You can create a celery task fro this. See this link for more details. http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html On Saturday, 28 May 2016 19:51:49 UTC+5:30, 2me wrote: > > I have to implement a thread in order to test if (temperature>maximmum) it > sends an em

Re: UpdateView - problem with change model

2016-05-28 Thread Akhil Lawrence
Check the primary key you are passing in the URL while calling the view. Key of PersonalInfo need not to be the same as that of MySiteUser On Saturday, 28 May 2016 23:44:00 UTC+5:30, Dariusz Mysior wrote: > > I have that problem when I change model in view class EditView on > PersonalInfo I ha

Re: passing url variables to views

2016-05-31 Thread Akhil Lawrence
Hi, The URL you are calling is wrong.. You should call it like http://127.0.0.1:8000/my_app/run_delete/ccc_ccc***a_b***/ No need to pass it as an query parameter. On Tuesday, 31 May 2016 15:03:59 UTC+5:30, dk wrote: > >

Re: Django websites for study and improvement

2016-05-31 Thread Akhil Lawrence
You can get many django based applications from github. https://github.com/taigaio/taiga-back https://github.com/mayan-edms/mayan-edms/ https://github.com/stephenmcd/cartridge You can also refer https://github.com/rosarior/awesome-django https://github.com/search?q=django Even though you are

Re: Django: Begginer Problems

2016-05-31 Thread Akhil Lawrence
As Ryan mentioned. Go through the forms tutorial. Formsets may also help. Have a look. https://docs.djangoproject.com/en/1.9/topics/forms/formsets/ On Monday, 30 May 2016 04:54:16 UTC+5:30, David Zárate wrote: > > Hi! I'm making a financial analysis app in Django and to have some data to >

Re: Adding view permission by default to auth_permission

2016-05-31 Thread Akhil Lawrence
Ander, Please add your suggestion as a ticket in django ticketing system. https://code.djangoproject.com/newticket On Monday, 30 May 2016 23:43:18 UTC+5:30, Ander Ustarroz wrote: > > I am surprised this feature is not implemented yet, at the moment when we > create a new model three permissi

Re: how to append all-auth in my django project

2016-05-31 Thread Akhil Lawrence
This might help http://piratelearner.com/en/C/course/computer-science/django/django-all-auth-all-you-need-to-know/8/ On Sunday, 29 May 2016 22:15:56 UTC+5:30, pratyush singh wrote: > > i started a project and now i dont understand how to add all-auth to my > project i am having problem to un

Re: passing url variables to views

2016-05-31 Thread Akhil Lawrence
Yeah In your view you can access it by kwargs.get('user_del') On Wed, 1 Jun 2016 at 02:33 dk wrote: > and then i can use it in the view? as an argument? > > > On Tuesday, May 31, 2016 at 12:33:55 PM UTC-5, Akhil Lawrence wrote: >> >> Hi, >> >>

Re: Django inside Docker

2016-06-04 Thread Akhil Lawrence
No where in the dockerfile you are copying your project files or mounting external file system.. Are you doing those at runtime with the help of docker compose or fig? If yes paste those code snippets also.. On Saturday, 4 June 2016 02:44:55 UTC+5:30, Davi Diório Mendes wrote: > > Hi everyon

Re: Real time change color website

2016-06-30 Thread Akhil Lawrence
Hi, Your requirement has nothing to do with django. The images should be combined using JS/CSS. Its a pure front end tweak. If your question is regarding the backend. Definitely django can do the job. What I mean is, you can build API's using django which will server layers of images requeste

Re: pywkhtmltopdf [Was: [mezzanine-users] Re: Images in .pdf Invoice]

2016-06-30 Thread Akhil Lawrence
To answer *how do I change from function based views to class based views,* The simplest way to do that is, create a view file as below: from django.views.generic import View class ViewName(View): def get(self, request, *args, **kwargs): def post(self, request, *args, **k

Re: Real time change color website

2016-06-30 Thread Akhil Lawrence
generate the image. > This is a Javascript cambas problem not django. > > > 2016-06-30 5:59 GMT-03:00 Akhil Lawrence : > >> Hi, >> >> Your requirement has nothing to do with django. The images should be >> combined using JS/CSS. Its a pure front end tweak. >>