Re: dhango class based views - Saving post data

2015-06-02 Thread Shekar Tippur
James, I was able to get thro with the save operation. It was quite a bit of learning. Meta section on the model existed but I was not populating validated_data properly. I was under the assumption that when I did serializer=UserPrefSerializer(data=request.data) seriazer object will be popu

Re: dhango class based views - Saving post data

2015-06-02 Thread James Schneider
No, it looks like you need to set a model in the Meta class as part of your ModelSerializer class. http://www.django-rest-framework.org/api-guide/serializers/#modelserializer Is "XYZ" a valid slug to retrieve that Address object? You probably need to provide the PK value for the 'address' rather

Django session key collision

2015-06-02 Thread Greg
I've noticed a number of apparent session collisions (i.e., two or more users getting the same session key and therefore each others session data) on a site I manage. The site is on django 1.3.7, which shouldn't have any issues with session key collisions (there were some in earlier django vers

Re: dhango class based views - Saving post data

2015-06-02 Thread Shekar Tippur
James. address table already has a record of name xyz. Request object has a address value of address: xyz. As I am initializing serialize with request.data, why is it that I don't see it in validated_data? Do I need to add address_id to validated_data in my view? -- You received this message

Re: dhango class based views - Saving post data

2015-06-02 Thread James Schneider
The 'address' field is an FK to the Address model (hence the reference to 'address_id'), and you'll either need to 1) add null=True to the address field definition in UserPrefs and update your migrations and allow a UserPref model to not be connected to an Address model, 2) find the right Address m

Re: dhango class based views - Saving post data

2015-06-02 Thread Shekar Tippur
Here is my view. request.data has the 2 fields I am passing however serializer.validated_data has only prefs. class AddToUserProfile(generics.CreateAPIView): permission_classes = (permissions.IsAuthenticatedOrReadOnly,IsOwnerOrReadOnly) serializer_class = UserPrefSerializer querys

Re: how to get get-pip.py

2015-06-02 Thread Vijay Khemlani
https://pip.pypa.io/en/latest/installing.html On Tue, Jun 2, 2015 at 7:37 PM, Steve Burrus wrote: > how do I get get-pip.py? > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails f

Re: i have got a forbidden error in my project plz help for solve it

2015-06-02 Thread Lachlan Musicman
DHaval, Attachments wont cut it. Please paste the code into your email or into http://dpaste.com/ Also, a pyc file isn't a file that is readable by humans - you will need to send the code from the py file. You will need to also send the exact error. Cheers L. -- let's build quiet armies f

Re: Update dates in models auto

2015-06-02 Thread Lachlan Musicman
Over ride the save() method on teh Actions: class Actions(models.Model): date_start_preview = models.DateField('Data Prevista Inicial', blank=True) date_end_preview = models.DateField('Data Prevista Final', blank=True) date_start = models.DateField('Data Real Inicial', blank=True)

Re: django-summernote WYSIWYG editor: mixing modelForm and model, problem with Images

2015-06-02 Thread James Schneider
Sorry about that. What I meant was what do the URL's look like after the template rendering completes (ie what does the browser see as the value for your tags). Since it is breaking while editing the document, that question is now moot. Your media settings are probably OK (however I'm smashing to

Re: dhango class based views - Saving post data

2015-06-02 Thread Shekar Tippur
James, You are right. I am able to get past that issue. The next stumbling block is with null value in column "address_id" violates not-null constraint DETAIL: Failing row contains (10, Likes, null, null). Here is my curl curl -H "Authorization: Bearer $usertoken" -H "Content-Type: applicati

Re: Trouble w. Setting Up Virtual Env.

2015-06-02 Thread Mike Dewhirst
Steve If you have uninstalled and reinstalled virtualenv exactly the way the virtualenv docs require for Windows and you still get the same problem I think your environment must be blocking things. Maybe there is a virtualenv mailing list you could join and get some help from virtualenv expe

Re: dhango class based views - Saving post data

2015-06-02 Thread Shekar Tippur
Here is my serializer class UserPrefSerializer(serializers.ModelSerializer): #user = serializers.ReadOnlyField(source='owner.username') def create(self, validated_data): print ("Validated data") print (validated_data) #return Screens.objects.create(**validated_data)

how to get get-pip.py

2015-06-02 Thread Steve Burrus
how do I get get-pip.py? -- 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, send email to djang

Re: django-summernote WYSIWYG editor: mixing modelForm and model, problem with Images

2015-06-02 Thread hemulin
I'm not sure I understood your question. If by "final HTML" you mean the rendered template which displays the article, then there's nothing interesting here. I'm just passing the article in the context to the template and in the template assigning in various tags the relevant content ({% article

Re: new to Django having models/views/templates question

2015-06-02 Thread James Schneider
Posting the actual model code will probably help. Your template has this: item.customer_location.name But you specified the issue later as this: item.customer_location.customer The former won't work per your summarized model definitions. The Location model has no attribute called 'name'. The

Re: django-summernote WYSIWYG editor: mixing modelForm and model, problem with Images

2015-06-02 Thread James Schneider
Have you validated that the URL being generated in the final HTML (the source HTML in the browser) is pointing to the right location? If not, I would tend to agree with your assertion that the media settings need tweaking. -James On Jun 2, 2015 1:17 PM, "hemulin" wrote: > Hi, > not sure what I'v

Re: dhango class based views - Saving post data

2015-06-02 Thread James Schneider
Wait, what does your serializer look like? I found this in the traceback: ile "/Users//PycharmProjects///modelserializer.py" in create 48. return Screens.objects.create(**validated_data) Are you sure that you are referencing the right serializer and/or is the serializer referencing the

Re: Help with customizing Django authentication

2015-06-02 Thread Carlos Ribas
Hello Carl, I really appreciate your comments and I agree with you. I'll put here soon the code I'm writing, maybe this can be helpful for others too. Thanks! Em sexta-feira, 29 de maio de 2015 18:53:25 UTC-3, Carl Meyer escreveu: > > Hello Carlos, > > On 05/29/2015 03:19 PM, Carlos Ribas wro

Re: why i failed to install django?

2015-06-02 Thread Gergely Polonkai
This doesn’t seem to be a Django issue to me… Can you install any other packages with pip? 2015-06-02 20:12 GMT+02:00 mnz hz : > > > IOError: [Errno 22] invalid mode ('wb') > > > detailed error message is as follows: > > > http://pastie.org/10219723#1,21 > > -- > You received this message becaus

why i failed to install django?

2015-06-02 Thread mnz hz
IOError: [Errno 22] invalid mode ('wb') detailed error message is as follows: http://pastie.org/10219723#1,21 -- 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

Re: django-summernote WYSIWYG editor: mixing modelForm and model, problem with Images

2015-06-02 Thread hemulin
Hi, not sure what I've done but I don't get the error anymore, instead I got nothing. No error, no image in the preview and no image after the saving and displaying the article. To your questions, yes and yes. I can find the image in the server (under static/media/django-summernote/), and I can

Re: dhango class based views - Saving post data

2015-06-02 Thread Shekar Tippur
James, I have commented save in model code. I have also changed the prefs field to be char(20) for now. I still get 'prefs' is an invalid keyword argument for this function - Shekar -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsu

Re: dhango class based views - Saving post data

2015-06-02 Thread James Schneider
I just looked over your model again. Your save() override has a super(Screens,...) reference, which doesn't match the model class. That may explain why you are getting the invalid parameters error, since you are probably calling the wrong save function from a different class. I'd remove that save

Re: new to Django having models/views/templates question

2015-06-02 Thread Chris Strasser
Hi James thanks for the response... this line: {{item.customer_location.customer}} . worked this morning and all last week now gives this error: RuntimeError at /sto/ maximum recursion depth exceeded while calling a Python object Request Method: GET Request URL: http://10.0.0.102:80

Re: dhango class based views - Saving post data

2015-06-02 Thread Shekar Tippur
Just to add, if I use a curl request curl -H "Authorization: Bearer $usertoken" -H "Content-Type: application/json" -X POST -d '{"user":"foo1","stock":"XYZ","prefs":"Likes"}' http://${endpoint}/addPrefs I get a error: {"prefs":["\"Likes\" is not a valid choice."]} If I use curl -H "Authori

Re: non DB related fiels in model to appear in a form

2015-06-02 Thread Chris Strasser
hi Reiner I think what you want to do is controlled in the view not the model. in your view do something like this: context = {'form':form, 'infotext': "some informational text"} return render(request,'form.html', context) then in your template you can refer to it as follows:

Re: new to Django having models/views/templates question

2015-06-02 Thread James Schneider
Can you post the error and traceback? It sounds like you may have an encoding issue. -James On Jun 2, 2015 11:00 AM, "Chris Strasser" wrote: > Hi am plugging away at learning Django and have done well so far (thanks > to great documentation and Stackoverflow) but I have run into a problem > that

Re: All Urls lead to home.html

2015-06-02 Thread Thomas Murphy
Hi Jariel, What URI are you accessing to get to your admin page? Can you show us your urls.py? Best, Thomas On Tue, Jun 2, 2015 at 1:46 PM, Jariel Arias wrote: > For some reason every time I try to go to my admin page it takes me back > to my home.html which is just : > > Hi There > > anyon

All Urls lead to home.html

2015-06-02 Thread Jariel Arias
For some reason every time I try to go to my admin page it takes me back to my home.html which is just : Hi There anyone know why this could be happening? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and st

new to Django having models/views/templates question

2015-06-02 Thread Chris Strasser
Hi am plugging away at learning Django and have done well so far (thanks to great documentation and Stackoverflow) but I have run into a problem that i cant seem to figure out. I have a model that refers to another model that refers to another model. example : Class ServiceOrder id -in

i have got a forbidden error in my project plz help for solve it

2015-06-02 Thread DHaval Joshi
i try to solve forbidden error bt its not working . i m new in django so plz help me to solv this error i attach my templet views.py and url.py if u need more thing then reply me i send it to u.. -- You received this message because you are subscribed to the Google Groups "Django users" g

Trouble w. Setting Up Virtual Env.

2015-06-02 Thread Steve Burrus
*I hasve repeatedly tried now to set up the Django Virtual Environment without any success! Just what am I doing wrong anyway?? I am at my "wit's end" trying to figure out what the specific problem is.* *c:\Users\SteveB\Desktop>virtualenv steve1* *Using base prefix 'C:\\Python 3.5'* *New pyth

Help needed for big django project (crm+shop+cms+autoresponder). What apps shall I build on?

2015-06-02 Thread ThomasTheDjangoFan
Hi guys, I am planning on a bigger django project with a lot of functionality. The thing is that I have NO experience with existing django-apps that might fit and definetly need your help. Can you give me a hint which existing (and stable) django-apps I could use as a foundation for my project

Re: Reduce number of sql calls to database

2015-06-02 Thread Larry Martell
On Tue, Jun 2, 2015 at 11:48 AM, Cherie Pun wrote: > Hi, > > I am new to Django and I am trying to reduce the number of calls to database > as it's slowing down the app. I am performing iteration over the queryset > and I used django_debug_toolbar to check the number of queries made, and the > num

Re: Reduce number of calls to database

2015-06-02 Thread Simon Charette
Hi Cherie, A `id__in` queryset lookup should issue a single query. levels = Level.objects.filter(id__in=level_ids) Cheers, Simon Le mardi 2 juin 2015 11:42:19 UTC-4, Cherie Pun a écrit : > > Hi, > > I am new to Django and I am performing some iteration on a queryset. When > I use django_debug_

Reduce number of sql calls to database

2015-06-02 Thread Cherie Pun
Hi, I am new to Django and I am trying to reduce the number of calls to database as it's slowing down the app. I am performing iteration over the queryset and I used django_debug_toolbar to check the number of queries made, and the number is huge. It looks like django is making a query call to

Reduce number of calls to database

2015-06-02 Thread Cherie Pun
Hi, I am new to Django and I am performing some iteration on a queryset. When I use django_debug_toolbar to look at the SQL usage, I realised that Django is actually calling the database once in each iteration. Is there a way to make it call the database only once and somehow store it locally s

Re: Reuse jquery

2015-06-02 Thread guettli
Hi, we had a very strange problem with the ordering of the JS files. the jquery.init.js from django removed the jquery from us which had jquery-ui loaded. The problem is solved. Thomas Güttler Am Dienstag, 2. Juni 2015 17:24:56 UTC+2 schrieb ke1g: > > Are you saying that you can't access it

Re: dhango class based views - Saving post data

2015-06-02 Thread Shekar Tippur
Here is the trace: Traceback: File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response 132. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/Library/Frameworks/Pytho

Re: Reuse jquery

2015-06-02 Thread Bill Freeman
Are you saying that you can't access it as django.jQuery ? On Tue, Jun 2, 2015 at 4:22 AM, guettli wrote: > I guess I am missing something. > > Is there no way to load jquery only once per page? > > Use case: I have two widgets which need jquery. I want to use > these widgets inside the admin in

Re: dhango class based views - Saving post data

2015-06-02 Thread James Schneider
Can you post the entire traceback for the error, and the view code as well? -James On Jun 2, 2015 12:47 AM, "Shekar Tippur" wrote: > Hello, > > I am trying to save post data and I get a error. I am trying to use enum > field. > > prefs' is an invalid keyword argument for this function > > Reques

Update dates in models auto

2015-06-02 Thread Juliano Araújo Farias
Dears, First I thx for ur attentions... and I novete in Django... but a have a question... Second: I have this in my model: class Actionplan(models.Model): date_start_preview = models.DateField('Data Prevista Inicial', blank=True, null=True) date_end_preview = models.DateField('Data P

Re: Migrate command does not respect options for db connections?

2015-06-02 Thread George Silva
Any news? Hello? On Sat, May 30, 2015 at 4:28 PM, George Silva wrote: > Context: > > Django 1.7.1 > PostgreSQL 9.4 > > I have the following database entry in settings: > > DATABASES = { > 'default': { > 'ENGINE': 'django.contrib.gis.db.backends.postgis', > 'NAME': 'xpto', >

Re: Graph theory ??

2015-06-02 Thread Rafael E. Ferrero
Thanks Erik, Defining custom actions its what i try to do!! because, the user can add some custom type of Action and he need to specify what to do with. With this, the user can perform his own graph and rules to control the vertex. For example, a Contact of the business can be a Provider or a Cus

Django CMS/ Framework for Banking /Financial service

2015-06-02 Thread Swapnil Bhadade
Which are Django packages for full stack development of an e-banking web app based on P2P model. Any resources / frameworks would be of help. Best -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Re: Graph theory ??

2015-06-02 Thread Erik Cederstrand
Hi Rafael, Assuming you have a static and limited set of actions, and they can only be defined programmatically, I would do something like this: class Vertex(models.Model): some_field = models.CharField() class Edge(models.Model): from = models.ForeignKey(Vertex, related_name='outgoi

Graph theory ??

2015-06-02 Thread Rafael E. Ferrero
Hello everyone, I think to do an app where i would save a directed graph. The vertex and edges there must be dinamics. The vertex can represent some Tag or Category... or something. The edge who links the vertex can be N between two vertex and represent some event or action... and let me explain h

Re: Why sqlite time is different from my settings.py TIME_ZONE?

2015-06-02 Thread Dan Tagg
Hi Hyunseo Yang, SQLite does not save the timezone in the database. If you pass it a datetime with timezone encoding then it calculates the UTC time that that time represents and stores that. It is explained here: https://www.sqlite.org/lang_datefunc.html As far as I understand whatever database

Why sqlite time is different from my settings.py TIME_ZONE?

2015-06-02 Thread Hyunseo Yang
I'm using Sqlite for my project database. I need date and time in my model so i'm using this field. date = models.DateTimeField() On the result template (results.html), the time is correct (localtime or TIME_ZONE in my settings.py) The problem is, when i check the database on Django admin pag

Reuse jquery

2015-06-02 Thread guettli
I guess I am missing something. Is there no way to load jquery only once per page? Use case: I have two widgets which need jquery. I want to use these widgets inside the admin interface and on custom pages. The admin interface has its own jquery and in jquery.init.js this gets done: var django

dhango class based views - Saving post data

2015-06-02 Thread Shekar Tippur
Hello, I am trying to save post data and I get a error. I am trying to use enum field. prefs' is an invalid keyword argument for this function Request Method:POSTRequest URL:http://127.0.0.1:8000/setPrefs/Django Version:1.8.2Exception Type:TypeError Here is my model class UserPrefs(models.Mo

Re: web2py like SQLFORM

2015-06-02 Thread Masklinn
> On 02 Jun 2015, at 04:57, Abhijit Chatterjee wrote: > > Hello everyone. I am new in django but I have been using web2py for sometime. > Do we have anything like SQLFORM that automatically renders the ORM or we > have redundantly call each tables and fields? Tou have not explained what sqlfo