Re: view user profile access restriction

2018-01-28 Thread sum abiut
I manage to fixed it. I have created two instances (profile_info and info) in my view, i use the first instance to access the information from my Profile model and the second instance to access th User model. I also set the *AUTH_PROFILE_MODULE = 'Profile' in my settings.py.* *my updated view.py*

Re: view user profile access restriction

2018-01-28 Thread sum abiut
Thanks heaps that worked. But then how to i retrieve the rest of the profile info from the second table? i have a one-to-one relationship. i mange to extract data from the user table which is first name, last name, email. but i am having difficulty figuring out accessing information from the

Re: view user profile access restriction

2018-01-28 Thread Dylan Reinhold
There are a bunch of ways to do it. Show us your view, if it's a function based view, just do your select on (username=request.user) Dylan On Sun, Jan 28, 2018 at 4:59 PM, sum abiut wrote: > Hi, > i have a django app that i want the users to be able to view only their > user

view user profile access restriction

2018-01-28 Thread sum abiut
Hi, i have a django app that i want the users to be able to view only their user profile once they have login. currently any user that login is able to view other users profile as well. Appreciate is you could point me to the right direction. cheers, -- You received this message because you are

Re: url issues

2018-01-28 Thread sum abiut
Thanks heaps manage to fix it. On Fri, Jan 26, 2018 at 6:34 PM, wrote: > def login(request): > return render(request,'login.html') > > On Friday, January 26, 2018 at 6:33:07 AM UTC+5:30, suabiut wrote: >> >> Hi, >> i am having some issues with my url pattern. i

Re: javascript transpilers

2018-01-28 Thread Mike Dewhirst
That seems unanimous :( Jani asked what problem I need to solve. Without going into analytical detail, all the code is serverside and now the project needs to move towards AJAX for user experience reasons. M On 29/01/2018 5:44 AM, Nick Sarbicki wrote: Agree with everything already said.

Re: how do I make django search for male or female without needing to specify an age?

2018-01-28 Thread Andy
Why do you make a POST request for displaying a list? Use GET parameters like its done for admin filters. And for building an API that returns JSON Data use DjangoRestFramework and you will just need to define your serializer fields .. the rest is taken care of for you. That code above looks

Django-hotsauce 0.9.0 is out!

2018-01-28 Thread Etienne Robillard
Hi all, I'm very pleased to announce the public release of Django-hotsauce 0.9.0 : https://pypi.python.org/pypi/Django-hotsauce/0.9.0 *Whats new:* 1. Added preliminary support for JIT compilation as a replacement for Cython. (Require PyPy 5.9.0 or later) . *Notes:* This release is for

Re: Get request, has PK, how do I access the PK data with in the model

2018-01-28 Thread Travis Pickle
I am using django 1.8. I read though the docs, however, i not seeing how I can get the PK other attributes to use in model searching. On Saturday, January 27, 2018 at 3:47:05 PM UTC-5, Matemática A3K wrote: > > https://docs.djangoproject.com/en/2.0/intro/tutorial01/ > > On Sat, Jan 27, 2018 at

Re: javascript transpilers

2018-01-28 Thread Nick Sarbicki
Agree with everything already said. Only thing I want to add is that while js has historically been a horrible language, the modern standards have helped rectify this. Modern js can be almost pleasant to work with nowadays. I wouldn't spend time transpiling python to js. Just try to learn js and

Re: Django-Channels: Answer from Background task to channel (websocket)

2018-01-28 Thread Andrew Godwin
It sounds like you're doing the right thing - storing reply channel names and sending to them from a background process - so I think the problem must be in the channel layer configuration. Have you confirmed the background task has the same Django settings? Have you tried monitoring the redis

Re: Native JIT compiler for Django?

2018-01-28 Thread Etienne Robillard
Django-hotsauce is a high-performance toolkit for Django. Using Cython under the hood is really a good method to optimize standard Django applications, but I want to investigate how JIT and PyPy can further improve performances beyond Cython. Le 2018-01-28 à 11:14, Jani Tiainen a écrit : So

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

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: 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

Re: num2words - help

2018-01-28 Thread Kasper Laudrup
On 2018-01-28 17:30, Ariel Matysiak wrote: Hello :) Howdy! It's my first post in here. I've made simple model and simple app. I want to use num2words library and I want to see my "cash" i words. I don't know how to do it/ Can you help me ??? I'm not really sure I understand your

Re: javascript transpilers

2018-01-28 Thread Avraham Serour
If you don't want and don't have the time to learn JS you may as well consider outsourcing the frontend work, I've worked in places that did just that and everybody was happy, the internal team liked python and the outsourced company people liked UX and JS. On Sun, Jan 28, 2018 at 6:09 PM, Jani

num2words - help

2018-01-28 Thread Ariel Matysiak
Hello :) It's my first post in here. I've made simple model and simple app. I want to use num2words library and I want to see my "cash" i words. I don't know how to do it/ Can you help me ??? Please edit code for me. --- models.py class

Django-Channels: Answer from Background task to channel (websocket)

2018-01-28 Thread Arne Wieding
Hi there, i have implemented django channels into my project to turn an intensive data importing task into a background task. This works fine. I also implemented Websocket channels which work fine as well, however, i want to send a message to a specific websocket channel (of a user) from the

Re: javascript transpilers

2018-01-28 Thread Jani Tiainen
Hi, You don't describe to what extent you need to use JavaScript - IOW, what problem you need to solve with JavaScript? Depending you needs you might get away with basic knowledge and usage of some helpful JavaScript library/framework. On Sun, Jan 28, 2018 at 12:44 AM, Mike Dewhirst

Re: javascript transpilers

2018-01-28 Thread Jason
I have to agree with Andreas about this. If you want to look at a somewhat successful project, consider the Google Web Toolkit project which allows developers to write large scale web applications in Java. The compilation process outputs JS, CSS and HTML. Its an ok and acceptable approach if

Re: CRUD code feedback

2018-01-28 Thread tango ward
Thanks a lot for your help and patience. I really appreciate it! On Sun, Jan 28, 2018 at 11:32 PM, Akhil Lawrence wrote: > Happy to see that you were able to get it in working condition. Cheers > > On Sunday, 28 January 2018 20:35:48 UTC+5:30, tangoward15 wrote: >>

Re: CRUD code feedback

2018-01-28 Thread Akhil Lawrence
Happy to see that you were able to get it in working condition. Cheers On Sunday, 28 January 2018 20:35:48 UTC+5:30, tangoward15 wrote: > > Holy smoke it's working!!! > > Thanks a lot! > > I can use the same pattern for update and delete right? > > On Sun, Jan 28, 2018 at 10:59 PM, Akhil

Re: CRUD code feedback

2018-01-28 Thread tango ward
Holy smoke it's working!!! Thanks a lot! I can use the same pattern for update and delete right? On Sun, Jan 28, 2018 at 10:59 PM, Akhil Lawrence wrote: > The takeaway from the above error is *AnonymousUser* > > > This means you are not logged into the system. By

Re: CRUD code feedback

2018-01-28 Thread Akhil Lawrence
The takeaway from the above error is *AnonymousUser* This means you are not logged into the system. By default *self.request.user* will be an instance of *AnonymousUser*, the moment you login it becomes *User* instance Make sure you login before hitting this code Thanks. On Sunday, 28

Re: CRUD code feedback

2018-01-28 Thread tango ward
I am getting another error: Cannot assign ">": "Dog.owner" must be a "User" instance. models.py from django.db import models from django.contrib.auth import get_user_model from django.contrib.auth.models import User, PermissionsMixin from django.urls import reverse # Create your models here.

Re: CRUD code feedback

2018-01-28 Thread Akhil Lawrence
Oops I missed something, you are creating a different table all together for *Owner*. In that case you need to insert owner record (This is not recommended, since the data is going to be the exact copy of User. This will cause data inconsistency, use User instead) class CreateDog(CreateView):

Re: CRUD code feedback

2018-01-28 Thread tango ward
Now I am getting this error "save() prohibited to prevent data loss due to unsaved related object 'owner'." Really appreciate you're help/suggestions. My first time to mess around with CRUD with user registration, login, logout. On Sun, Jan 28, 2018 at 10:02 PM, Akhil Lawrence

Re: javascript transpilers

2018-01-28 Thread Andréas Kühne
Hi, I think you are making things worse by adding a transpiler from python code to javascript. Yes you will be working in a language you are familiar with, but you will still need to understand the underlying javascript to debug issues (things will happen that are strange because of javsascripts

Re: CRUD code feedback

2018-01-28 Thread Akhil Lawrence
This error message is tricky. According to your model definition *owner* is of type *Owner*. This error message actually comes from the *Owner* model. Instead of *form.instance.owner = self.request.user*, try *form.instance.owner = Owner(id=self.request.user.id)* It should work. On

Re: Customizable Invoice

2018-01-28 Thread Andréas Kühne
Hi, Your question is really too broad. Do you want to create a template layout for invoices? Do you want to create a backend solution for storing the information about invoices dynamically? What is it you want to create? Regards, Andréas 2018-01-28 5:45 GMT+01:00 Rakhee Menon

Re: Native JIT compiler for Django?

2018-01-28 Thread Etienne Robillard
Hi Jani, I agree. I'm really not interesting in "fixing" bad code. I work with open-source grade only softwares like Django. :) Cheers, Etienne Le 2018-01-28 à 08:30, Jani Tiainen a écrit : Hi. 28.1.2018 3.10 ip. "Etienne Robillard" >

Re: Native JIT compiler for Django?

2018-01-28 Thread Jani Tiainen
Hi. 28.1.2018 3.10 ip. "Etienne Robillard" kirjoitti: Hi Jason, Please don't read me wrong. I want to allow my users to optimize the efficiency of Python/Django web applications using JIT. And thats the catch. You can easily write code that is slow and no language, no JIT

Re: Native JIT compiler for Django?

2018-01-28 Thread Etienne Robillard
Hi Jason, Please don't read me wrong. I want to allow my users to optimize the efficiency of Python/Django web applications using JIT. Cheers, Etienne Le 2018-01-28 à 07:55, Jason a écrit : What I get from you, Etienne, is that you think this is a cool area to look into, but don't have

Re: CRUD code feedback

2018-01-28 Thread tango ward
Sorry, for asking again. In option one, It appears that I am getting an error for using the owner field which is a ForeignKey. " ">": "Dog.owner" must be a "User" instance." class CreateDog(CreateView): template_name = 'dogs_cats/create_dog.html' model = Dog fields = ('name',

Re: [pypy-dev] How to implement a JIT compiler for Django ?

2018-01-28 Thread Etienne Robillard
Great! Thanks very much for this post, Yury. I'll do just what you suggested. :) Cheers, Etienne Le 2018-01-28 à 07:35, Yury V. Zaytsev a écrit : On Sun, 28 Jan 2018, Etienne Robillard wrote: Anyways, having that said, I can't even infer what your original line of thinking was to embed

Re: Native JIT compiler for Django?

2018-01-28 Thread Jason
What I get from you, Etienne, is that you think this is a cool area to look into, but don't have anything else aside from that suspect coolness factor to apply to your proposal. Besides, this thing you said above I don't want to optimize my code manually except with machine-compiled >

Re: [pypy-dev] How to implement a JIT compiler for Django ?

2018-01-28 Thread Etienne Robillard
Le 2018-01-28 à 05:11, Yury V. Zaytsev a écrit : I think that you might be confused about the fundamentals of the technologies involved here. Yes, I admit, i'm really just starting to understand PyPy fundamentals and LLVM. Once you translate a Django app into C code (let's assume this

Re: Native JIT compiler for Django?

2018-01-28 Thread James Bennett
You have not really provided an argument, though. Programmers generally do not just do a thing for the sake of doing the thing, even if it's a "neat" thing. They do a thing because they have a need for that thing. We turn to things that can speed up our programs once we have determined that some

Re: Native JIT compiler for Django?

2018-01-28 Thread Etienne Robillard
The reason I want to use a JIT compiler for running embedded Django applications is this: "More recently, developers began pioneering a new field in dynamic compilation called trace compiling, or tracing. During compilation into the intermediate language, the compiler can mark the branches

Re: Native JIT compiler for Django?

2018-01-28 Thread Jani Tiainen
Hi, So what is your motivation to even try to make Python(and thus Django to convert it to C code (or run it on top of something like LLVM)? Is there some part which is too slow in your application? Are you even sure that doing things that Django does would even be faster when compiling it to

Re: CRUD code feedback

2018-01-28 Thread tango ward
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 properly. Let me reiterate my > response for you. > > > *There are two ways to do this. * > > *1. You can

Re: Native JIT compiler for Django?

2018-01-28 Thread Etienne Robillard
Hi Jani, I don't want to optimize my code manually except with machine-compiled instructions. Cheers, Etienne Le 2018-01-28 à 03:12, Jani Tiainen a écrit : Hi Why you even want to add such a complexity? Have you measured what part in your apps are really slow? Have you tried to

Re: Native JIT compiler for Django?

2018-01-28 Thread Jani Tiainen
Hi Why you even want to add such a complexity? Have you measured what part in your apps are really slow? Have you tried to optimize your python code before trying such an extreme actions? 27.1.2018 9.04 ip. "Etienne Robillard" kirjoitti: > Hi, > > I would like to know if