Re: Polls tutorial receive object not object representation

2013-01-28 Thread James Schneider
On Jan 27, 2013 5:58 PM, "Sayth Renshaw" wrote: > > Hi > > Just seeking a little clarification. > > In the Polls tutorial we get this section. > > >>> p = Poll.objects.get(pk=1) > > # Display any choices from the related object set -- none so far. > >>> p.choice_set.all() > [] > > # Create three c

Re: url pattern correct but not working

2013-02-21 Thread James Schneider
The regex you are using will only match a SINGLE letter or number, followed by a dash, and then the nid. I'm betting it will work if you have a url like a-2355.html. Check out this SO post, it's pretty much identical to what you are looking for: http://stackoverflow.com/questions/2525327/regex-fo

Re: Lost CSS & Javascript in Django Admin

2013-03-25 Thread James Schneider
This is probably a STATIC_URL issue. Check to make sure it is set correctly and that you've run manage.py collectatatic and that apache, etc. is set to serve those files directly. The dev server does some funny magic behind the scenes to get these files served up. -James On Mar 25, 2013 2:12 PM, "

Re: New data field in models.py "does not exist".

2015-01-12 Thread James Schneider
ested it with Django 1.6.9, syncdb does not add fields to existing > models > > On Mon, Jan 12, 2015 at 5:20 PM, James Schneider > wrote: > >> Adding a column to a model is supported by syncdb, no need for South >> migrations. Any other operation (ie changing/delet

Re: updating data in a row

2015-01-12 Thread James Schneider
gt; >> Thanks heaps for your help. your help is very much appreciated . I manage >> to fix my issue. I wouldn't have done it without your help. :) >> >> Cheers. >> >> On Tue, Jan 13, 2015 at 10:24 AM, sum abiut wrote: >> >>> Hi James, >>

Re: Django development running on 127.0.0.1:8000 not accessible from same machine

2015-01-16 Thread James Schneider
You should be running 'python manage.py runserver' from inside the directory of your project root , not using the django-admin.py command. The manage.py file should have been automatically generated when you created the project using django-admin.py. I hadn't even realized that django-admin.py supp

Re: Reverse for 'detail' with arguments '('',)' and keyword arguments '{}' not found

2015-01-16 Thread James Schneider
Change poll_id to poll.id. poll_id is probably not defined anywhere, so your URL tag is getting an argument of '' (empty string). -James On Jan 16, 2015 11:23 AM, "Adil Erpat" wrote: > {% if latest_poll_list %} > > {% for poll in latest_poll_list %} > {{ poll.question > }} >

Re: Handle multiple modelforms in one html form

2015-01-17 Thread James Schneider
I'm guessing that if you look at the generated source code in the browser, all of the names for the fields in the pform form's are the same, which likely collide on the Django side (if the browser actually posts all the copies with the same field names, not sure what the typical browser behavior is

Re: Best way to test handle optional FKs in model __str__?

2015-01-17 Thread James Schneider
You can reroll your original example like this: def __str__(self): pk = self.pk customer_name = None customer_phone = None try: customer_name = self.lead.customer_name customer_phone = self.lead.customer_phone except AttributeError: pass return _(

Re: Best way to test handle optional FKs in model __str__?

2015-01-17 Thread James Schneider
Yes, it's a bit more verbose, but much easier to follow. Hope it helps. -James On Jan 17, 2015 2:58 PM, "Micky Hulse" wrote: > Hi James! Thank you for the reply and for the example code! > > On Sat, Jan 17, 2015 at 2:52 PM, James Schneider > wrote: > > You can

Re: Best way to test handle optional FKs in model __str__?

2015-01-17 Thread James Schneider
You can definitely do it that way if all you need to do is check if values exist and provide a default if they don't. I do this all the time for my __str__() methods as well. You also mentioned similar situations that may require more logic checks (variables depending on each other or printing com

Re: How to make generic variables available in settings and contexts?

2015-01-18 Thread James Schneider
If I understand you right, you want to set MAIN_CATEGORY as a "global" variable/setting containing a Category object with an ID of 1. Is that right? If so... Rather than populating a "global" variable, I would instead create a custom model manager for the Category model: https://docs.djangoprojec

Re: How to make generic variables available in settings and contexts?

2015-01-18 Thread James Schneider
question is: > How do I now access the CategoryManager.get_main_category() in my > template.html? I guess I have to pass it over to context within the view? > > > Am Sonntag, 18. Januar 2015 12:28:30 UTC+1 schrieb James Schneider: >> >> If I understand you right, you want to set MAIN_CATEG

Re: Unicode character in Django project path

2015-01-18 Thread James Schneider
After a quick search, this bug looks similar, but it's for an ancient version of Django. Might still give you some hints as to where to look. https://code.djangoproject.com/ticket/8965 If you can replicate the bug with an empty project and your template paths set, I would recommend filing a bug,

Re: Newbie question: How to avoid a very long view function?

2015-01-19 Thread James Schneider
I second moving some (or most) of the functionality to models.py. For instance, calculating the SHA value should be done as part of the model's save() function, not done in the view. Convention dictates that the only code that is placed in the view itself should be logic related to prepping the te

Re: Newbie question: How to avoid a very long view function?

2015-01-19 Thread James Schneider
I wouldn't decorate them as class methods. You would want to call them from the objects themselves. For the save_to_disk() method, I was actually referring to the Django save() method ( https://docs.djangoproject.com/en/1.7/topics/db/models/#overriding-predefined-model-methods ). As you have it no

Re: Authenticate users with both username and email

2015-01-19 Thread James Schneider
I guess I'm not clear on what you are trying to achieve. There are a couple of scenarios to consider. As it stands with the default contrib.auth authentication backend, sending both the username and email address entered by the user will only work IF the user registered/was created using their ema

Re: having problem with jquery ajax

2015-01-19 Thread James Schneider
Quick guess, you are visiting the site in your browser using http://localhost:8000. I'm betting if you instead visited it using http://127.0.0.1:8000, the AJAX query would work fine. You have http://127.0.0.1:8000 hard coded (or being generated) everywhere. Either change your JavaScript to use loc

Re: Authentication when usernames are not unique

2015-01-19 Thread James Schneider
That's an interesting (but understandable) requirement, which means you are probably in for an interesting time. Undoubtedly you'll need to roll your own authentication backend ( https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#authentication-backends) and a custom user that contains

Re: Authentication when usernames are not unique

2015-01-19 Thread James Schneider
Hmm, yes, Shibboleth will require some extra trickery in multiple views with redirects to the respective campus portal, etc. I've never done it myself, but I believe the API is pretty well documented. -James On Jan 19, 2015 1:48 PM, "James Schneider" wrote: > That

Re: Authentication when usernames are not unique

2015-01-19 Thread James Schneider
For a pure authentication scenario where permission checks never go beyond user.is_authenticated(), that's probably true. If all the OP is doing is displaying data, they may be able to get away with manually associating the campus and user within the session after, and displaying data based on thos

Re: Authentication when usernames are not unique

2015-01-19 Thread James Schneider
r model and avoid creating separate Django > users that shadow the LegacyUser, as I do a lot of synchronization of > LegacyUsers with the legacy system. I'll see how it goes and post a > solution if I get that far. > > Erik > > > Den 19/01/2015 kl. 23.24 skre

Re: Authentication when usernames are not unique

2015-01-19 Thread James Schneider
d. -James On Jan 19, 2015 11:32 PM, "James Schneider" wrote: > "A pallet of authentication systems..." > > Yep, you work for an educational entity, as do I. :-D > > You can pursue the LegacyUser model as your custom user model. That would > make your Legac

Re: Authentication when usernames are not unique

2015-01-20 Thread James Schneider
Wow, nice. You are probably right in not inheriting from PermissionMixin and AbstractBaseUser and just re-implementing the needed functionality. I ended up doing the same thing for my custom user and auth backend as well. Not as convenient, but hey, it works right? ;-) Bravo. -James On Jan 20, 20

Re: Map Django Model to Legacy multi-join query

2015-01-20 Thread James Schneider
Not sure what you mean. Are you looking to build the model definitions in your models.py files, or are you trying to take the results of a query against MSSQL and pass them to a constructor for a model that has already been defined? Either way, eventually you'll end up with a copy of the 'model'

Re: django.contrib.auth doesn't support template context processors?

2015-01-20 Thread James Schneider
The FBV's included in contrib.auth.views don't use RequestContext(), they jump straight to TemplateResponse(): https://github.com/django/django/blob/master/django/contrib/auth/views.py#L192 IIRC, rendering a context via a RequestContext() is what triggers the TEMPLATE_CONTEXT_PROCESSORS to run.

Re: django.contrib.auth doesn't support template context processors?

2015-01-21 Thread James Schneider
Hmm, I stand corrected: https://github.com/django/django/blob/1.7.3/django/template/response.py#L156 It does render the context via RequestContext(). However, I can also point out why I thought I was right (in addition to my apparently flawed/rushed test): https://github.com/django/django/blob/

Re: django select extremely slow on large table

2015-01-22 Thread James Schneider
How many results do you typically get back from that query? It sounds like the DB is highly optimized if you can gather results from tables that large that quickly running the query outside of Django. If you are returning a large dataset, then it is more likely that Django is furiously coercing ev

Re: django select extremely slow on large table

2015-01-23 Thread James Schneider
th the same Django model call several times to see if the timing drops down into the sub-second range (it should). -James On Fri, Jan 23, 2015 at 12:05 AM, Erik Cederstrand < erik+li...@cederstrand.dk> wrote: > > > Den 23/01/2015 kl. 08.19 skrev James Schneider >: > > >

Re: Django default auth user but unique email

2015-01-26 Thread James Schneider
If you want any sort of enforcement of a unique email address at the database level, you'll need a custom user model. If you don't care about that, all you'd need to do is override the user forms and create a custom clean_email function that checks for duplicates before saving the form data. Not 10

Re: forloop

2015-01-26 Thread James Schneider
Instead of looping through the all() set of objects (which works quickly with small sets of objects, imagine >20K objects, that would be noticeably slower, probably seconds or more), you should just query the object you want directly using something like: obj = newleave.objects.order_by('-pk')[0]

Re: Django UnicodeDecodeError at /admin/login/

2015-01-27 Thread James Schneider
Did you read the comments on that snippet? It appears there may need to be some extra encoding/decoding needed (example additional code is listed there), which would make sense given the decoding errors you are seeing. -James On Jan 27, 2015 9:54 AM, "Supermario" wrote: > I try to implement this

Re: sending email

2015-01-29 Thread James Schneider
Couple things. I think the return statement for thankyou.html needs to get kicked in a tab, otherwise the form will show successful every time the form is submitted, even if it had errors.If there are errors, it will also skip your email code, but still show as successful. This line is very confu

Re: Problem with sitemap.xml in django project.

2015-02-01 Thread James Schneider
That makes perfect sense as to why Google would reject it. You would need to make your site live, and generate the site map using the real domain name, otherwise Google has nothing to index against. The address you provided is either a local proxy or the dev server running on port 8001 on your loca

Re: ListView and Deleteview

2015-02-02 Thread James Schneider
You've defined your class-based view as a function: def PozoList(ListView): You should be defining it as a class: class PozoList(ListView): And you should be calling the to_view() method for the PozoList class from your urls.py. Please post your urls.py and any traceback and error messages you

Re: sending email

2015-02-02 Thread James Schneider
Oh, I see what you are trying to do. It looks like you are running needless queries though. Your newleave model has this: username =models.ForeignKey(User, default =1) That's an FK to User, which means this line in your view: to_emails = [u.email for u in User.objects.filter(username_

Re: two django sites at different revisions with apache

2015-02-03 Thread James Schneider
I don't see why not. For Apache, you would just place the relevant WSGIScriptAlias and WSGIPythonPath inside of your VirtualHost elements. You would need to be cautious about running a single WSGI process though, since the first site settings read will apply to all of your Django sites (which is pr

Re: Dropzone.js and images POST on new object

2015-02-10 Thread James Schneider
I wouldn't store binary data like an image in a session, especially if you have a DB-backed session system. I would instead use a separate model just for the images so that they can be created on the fly by dropzone via an API call, and then you can save the ID of the image object in the session (

Re: Hit API in python django

2015-02-14 Thread James Schneider
Do you want code in your Django project to contact an API provided by another site in order to display information on your site? Or are you writing an API to provide services for end users? If the latter, I would recommend the DRF in the link provided in the previous response by Mike. -James On F

Re: confirm_login_allowed in subclassed authentication returns wrong error message

2015-02-17 Thread James Schneider
You should raise the error in your custom user login form when attempting to authenticate the user, not directly from the custom user model or authentication backend. -James On Feb 17, 2015 12:20 PM, "Tomáš Sekanina" wrote: > Hello, > > I have a custom user model and I need to extend the user au

Re: How to make a list-view sortable in frontend?

2015-02-17 Thread James Schneider
Are you displaying the data in a table? If so, I've always used django-tables2, which includes the ability to have sorting in each of the columns via a generated link in the header row of any or all columns (up/down arrow, etc.). -James On Feb 17, 2015 2:43 PM, "ThomasTheDjangoFan" < stefan.eichho

Re: allow certain users to access certain views

2015-02-18 Thread James Schneider
You should be able to handle this pretty easily with Django's built-in permission system. Just create a group, add the users to it, and assign the requisite permissions to the group. Our add the needed permissions individually to each user. https://docs.djangoproject.com/en/1.7/topics/auth/defaul

Re: How to filter by Group_BY ?

2015-02-20 Thread James Schneider
Without more detail, a good place to start would be with the ORM aggregation documentation: https://docs.djangoproject.com/en/1.7/topics/db/aggregation/#filter-and-exclude I would advise reading the whole page, though. Note that the placement/order of filters are much more significant than with n

Re: extracting data from three tables

2015-02-20 Thread James Schneider
I would suggest reading this: https://docs.djangoproject.com/en/1.7/topics/db/queries/#lookups-that-span-relationships and see if that helps out. You can span relationships (in this case, using FK's) using the double-underscore notation. I would also check out using select_related() if you would

Re: html response to be loaded in a div

2015-02-20 Thread James Schneider
In most cases, including the CSRF token in AJAX requests is trivial, and processing the token is handled automatically by Django. I would recommend spending a few minutes to implement the CSRF protection in your code of you plan to ever move to production. It is easy enough and pays good dividends

Re: How to handle model constants

2015-02-23 Thread James Schneider
For global constants, I would second the strategy that Mike outlined, and rename your constants in a more specific way, such as TASK_CANCELLED, TASK_COMPLETE, etc. unless of course CANCELLED can apply to more than just tasks. The use of a separate class to store such constants is of course viable,

Re: How to handle model constants

2015-02-23 Thread James Schneider
>>> In my case, a Task can have one or more TaskStatus. I do not wish to store >>> the TaskStatus in the database since they are simply constants. >>> >>> Does anyone have a better way of how I can approach this? >>> I just read this a bit closer. I think what you mean is that you don't want a sep

Re: Using class based views.

2015-02-23 Thread James Schneider
Sure, you would just override the get() and post() and possibly dispatch() methods in your classes as needed. I always recommend the classy CBV inspector, helps immensely with understanding the available methods and inheritance in the CBV's. http://ccbv.co.uk/ Also check out the source code of D

Re:

2015-02-25 Thread James Schneider
A failure in name resolution indicates a DNS query failure. >From the machine where the script is failing, can you run 'ping portal' and/or 'nslookup portal' and see if an IP is returned (even if the ping fails)? Are the failures occurring in the view on the same machine (and virtual environment i

Re: TypeError: __str__ returned non-string (type bytes)

2015-02-25 Thread James Schneider
What happens when you throw in a print(obj.__dict__[field]) before the val assignment? You should see on the console what value each iteration of the loop is using and see if you have a strange attribute that is throwing things out of kilter. -James On Feb 24, 2015 8:33 PM, "Mike Dewhirst" wrote:

Re: django deployment in a virtual machine.

2015-02-25 Thread James Schneider
I believe a2ensite is a Debian-specific shortcut that allows you to quickly enable/disable various site configurations through the use of symlinks. For CentOS you'll need to create a configuration file in your conf.d directory for your virtual host. I believe it will be included automatically by h

Re: Can the new `Prefetch` solve my problem?

2015-02-25 Thread James Schneider
I assume that you are talking about the select_related() and prefetch_related() queryset methods? https://docs.djangoproject.com/en/1.7/ref/models/querysets/#select-related https://docs.djangoproject.com/en/1.7/ref/models/querysets/#prefetch-related Both of those sections have excellent examples,

Re: Can the new `Prefetch` solve my problem?

2015-02-25 Thread James Schneider
esk` where every desk has an attribute names `favorite_or_nearby_chairs` > which contains the queryset of chairs that I desrcibed, prefetched. > > > Thanks, > Ram. > > On Wed, Feb 25, 2015 at 11:18 PM, James Schneider > wrote: > >> I assume that you are talking

Re: Can the new `Prefetch` solve my problem?

2015-02-26 Thread James Schneider
with `Chair.objects`? I'm not looking to get a `Chair` >> queryset. I'm looking to get a `Desk` queryset, which has a prefetched >> attribute `favorite_or_nearby_chairs` which contains the `Chair` >> queryset I wrote down. >> >> >> Thanks, >> Ram

Re: Can the new `Prefetch` solve my problem?

2015-02-26 Thread James Schneider
your friend in these cases, but obviously a high number of even relatively fast queries can have a detrimental effect on your load times. Also ensure that the fields you are using to filter contain indexes, if appropriate/available. -James On Thu, Feb 26, 2015 at 10:17 AM, James Schneider wr

Re: Can the new `Prefetch` solve my problem?

2015-02-26 Thread James Schneider
Heh, I just realized that aRkadeFR had replied with a similar idea to use a property. At least I know I'm not too far off on my thinking. :-D -James On Thu, Feb 26, 2015 at 11:02 AM, James Schneider wrote: > Whoops, accidentally sent that last one too early, here's the

Re: Can the new `Prefetch` solve my problem?

2015-02-27 Thread James Schneider
ed guesses and may not be valid at all given other requirements or design considerations in the project. > aRkadeFR > > > On 02/26/2015 08:27 PM, James Schneider wrote: >> >> Heh, I just realized that aRkadeFR had replied with a similar idea to use a property. At least I

Re: djangoproject.com https access problems

2015-02-27 Thread James Schneider
The proxy is likely forcing a TLS fallback in a way that Firefox doesn't like. Ensure you are using the latest version of FF, but even then, unless you have control off the proxy, there may not be much you can do except open a support ticket with your IT department. https://bugzilla.mozilla.org/sh

Re: Django OperationalError

2015-02-27 Thread James Schneider
Generally this happens when you don't apply the initial migration. Have you run 'python manage.py migrate' (assuming Django >= 1.7 since you mentioned making migrations) and if you have, what was the output? If you aren't sure, run it again as it shouldn't hurt anything. Check your database and ma

Re: Can the new `Prefetch` solve my problem?

2015-03-01 Thread James Schneider
all of them). > > > > > Still watching the thread cause I have couple of problems > > like this one :) > > > > I don't necessarily run in to this specific problem, so I'm not sure how > much more I can contribute. A lot of the model changes I suggested were &

Re: Traversing relationships based on lookup strings

2015-03-02 Thread James Schneider
Nothing in Django specifically that I'm aware of (although that's not saying much), but you can probably do something pretty slick with the operator library and attrgetter: https://docs.python.org/2/library/operator.html#operator.attrgetter It would probably look something like this (untested):

Re: Traversing relationships based on lookup strings

2015-03-02 Thread James Schneider
Whoops, I meant to swap out 'item' for 'instance' to make it a bit more readable, but got myself distracted and forgot to finish and hit send. So, s/item/instance/... HTH, -James On Mon, Mar 2, 2015 at 2:11 PM, James Schneider wrote: > Nothing in Django specifi

Re: Complex Querys And Results Response Processing/Formatting

2015-03-02 Thread James Schneider
So, do objects ever get successfully added to the list? I had a bit of trouble following your workflow and figuring out where your issue actually lives. When you say 'send the final list back to an HTML page' do you mean the Django process is generating the HTML and sending it back as a response t

Re: Can't run django!

2015-03-04 Thread James Schneider
Is there a possibility of having more than one settings file? If so, ensure that your manage.py is pointing at the right settings file. The output of 'manage.py runserver' should also show the dotted path of the settings file that it is using just before that error is displayed (I believe). You ca

Re: Django Documentation 1.7 shows "django-admin.py" whereas it should be "django-admin"

2015-03-04 Thread James Schneider
Not technically a bug, although it is a common point of confusion. It depends on how you installed Django. Both perform the same function on their respective systems. There's a note with this link on the first page of the tutorial, although admittedly I believe they should be more explicit with thi

Re: [Choose Database based on geolocalization]

2015-03-09 Thread James Schneider
To me, the question needs more explanation. If a request is made of a server in the US, how does it make any sense to send a database query from that server in the US over to Luxembourg if that is in the proximity of where the user is located? Efficiency? No, that would actually cause double the tr

Re: [Choose Database based on geolocalization]

2015-03-09 Thread James Schneider
Perhaps you can investigate more into the 'why' portion of the requirement (which is what I was interested in)? You may be able to convince them to abandon/modify their requirement if you lay out the technical issues and complication they are introducing, and for what gain? I suspect the feature y

Re: How to make responsinator.com working with Django?

2015-03-10 Thread James Schneider
Does the site load when accessing it from your own browser (or better yet, from a different machine connected to the Internet)? Are you pasting in an http://127.0.0.1:8000 address? If so, that won't work with tools like responsinator.com. Your site will need to be publicly accessible on the Interne

Re: Django template not displaying

2015-03-12 Thread James Schneider
You also have two different URL's named 'home', which will lead to a bad time. Make sure that those are unique. >From what I can tell, none of your views render/reference 'signup.html', so I would never expect that template to be rendered. Configure a fields attribute on your form to get rid of t

Re: Django 1.7 issue

2015-03-16 Thread James Schneider
Can you please paste in a copy of your urls.py file that is referenced in the error? -James On Mar 16, 2015 1:21 AM, "Piyush Sharma" wrote: > i was following the django 1.7 documentation and having issue in creating > an app part 3 > please help > > TypeError at /polls/34/results/ > > 'function'

Re: Changing table name in response to a QuerySet

2015-03-17 Thread James Schneider
That sounds more like an exact use case for model inheritance. You would define a single model that matches the columns in both tables. You can define that model as abstract, then have the two real models (one for each table) inherit from that abstract model. In the definition for the child models,

Re: How to make request ie GET/POST to soap (windows web service ) in Django?

2015-03-18 Thread James Schneider
I would recommend that you use the suds-jurko fork. It should be a drop in replacement for the suds library available via pip, but is actively maintained. The original suds library looks to be abandoned and has some issues parsing current WSDL definition files that suds-jurko can handle. -James On

Re: Changing table name in response to a QuerySet

2015-03-18 Thread James Schneider
e string replace to switch > tables. I was hoping that someone had some kind of “switch table” command > on the queryset or something similar. > > On Mar 17, 2015, at 3:08 AM, James Schneider > wrote: > > That sounds more like an exact use case for model inheritance. You wo

Re: migrations don't work

2015-03-22 Thread James Schneider
I think the end of the traceback is pretty telling: ValueError: Lookup failed for model referenced by field quedar.LearningGroup.members: quedar.User You have a LearningGroup model with an attribute called members which is still referencing the original User model that was removed. -James On Mar

Re: importing csv data into database

2015-03-31 Thread James Schneider
Is it a one-time import or are you looking to have a form that accepts CSV files? Either way, I would start with the Python csv module. Works really well and should be able to convert your CSV file to a standard Python list of lists, which you should be able to coerce into models, etc. https://do

Re: Python Soap

2015-04-02 Thread James Schneider
Suds is an old (abandoned) library. suds-jurko is a newer fork of it, and may handle SSL connections better. You may need to provide more detail as to what you are trying to do, as the SSL portion is handled by underlying libraries in Python, not by suds-jurko directly. -James On Apr 2, 2015 8:57

Re: virtualenv-wrapper

2015-04-03 Thread James Schneider
Name them appropriately? You can have as many as you like. They also don't all bed to reside in the same location. You can keep your code in one folder, your virtual env in another, and have both of them inside of a patent folder using the name of the project. For virtualenvwarpper specifically,

Re: Django Server Deployment - OperationalError on shared hosting ASO

2015-04-18 Thread James Schneider
You don't mention running 'manage.py makemigrations' or 'manage.py migrate' in any of your output. The error you are getting indicates that Django has access to a database, but the table schema is incorrect. If you haven't previously run migrate, then you have no tables, which explains the error yo

Re: Django Server Deployment - OperationalError on shared hosting ASO

2015-04-19 Thread James Schneider
No need to switch databases. Do you have any shell access to the server? Can you manually inspect the database to see if the table actually exists (outside of any Django commands)? I'm not sure what ASO offers. -James On Apr 19, 2015 9:19 AM, "David F" wrote: > Or I'm using sqlite should I swit

Re: generating pdf report with django-easy-pdf

2015-04-22 Thread James Schneider
Have you validated that there is actual data in the govstaff variable within your template? Nothing is going to show up if it is an empty variable or doesn't exist in your template context. While I'm not familiar with the package you're using, I suspect you need to add the govstaff variable to you

Re: generating pdf report with django-easy-pdf

2015-04-22 Thread James Schneider
_data() i am getting the > error non-keyword arg after keyword arg. Is there are other ways to > generated pdf reports on Django? > > Cheers, > > On Thu, Apr 23, 2015 at 12:34 PM, James Schneider > wrote: > >> Have you validated that there is actual data in the govstaff vari

Re: model.FileField

2015-04-27 Thread James Schneider
Have you seen this? https://docs.djangoproject.com/en/1.8/topics/http/file-uploads/ Has an example showing an example exactly as you asked without any models involved. Also make sure you recognize the difference between models.FileField and forms.FileField: https://docs.djangoproject.com/en/1.8/

Re: model.FileField

2015-04-27 Thread James Schneider
You can save the file wherever you like, just change the file path where you are writing the file to make use of settings.MEDIA_ROOT rather than a hard-coded URL. Since you aren't using a model, Django is assuming you want to do something fancy with the file, so you are responsible for doing the h

Re: Django oauth2 password encrypt

2015-04-30 Thread James Schneider
What is the view code that you are calling to actually create the user? I suspect you are simply doing something like: user.password = That will store the password in plain text in the DB, but Django is expecting it to be hashed, so it never matches. You should be using either the create_user()

Re: __str__ and __unicode__ not working!!

2015-05-04 Thread James Schneider
Python 2 or Python 3? What code ate you using to print the object? A simple print statement? -James On May 4, 2015 3:20 PM, "Yann Ashuach" wrote: > In tutorial number one in django documentations, i have tried and tried > again, and neither the __str__ or the __unicode__ is working! This has be

Re: NoReverseMatch at /polls/1/results/

2015-05-07 Thread James Schneider
I'm guessing the issue is actually in your template if you are following along that page. None of the code in your views would generate that error from what I can see. The error indicates that you are trying to reverse('polls:detail') and not providing any arguments for the URL resolver (or are pa

Re: NoReverseMatch at /polls/1/results/

2015-05-08 Thread James Schneider
tion} (with a Q) in views.results and see > how it goes again. > > All the best. :) > > Sincerely, > Muhammad > On May 8, 2015 10:41 PM, "Luis Zárate" wrote: > >> Which urls.py you paste here? The project URLs or the app urls .? >> >> It is because

Re: NoReverseMatch at /polls/1/results/

2015-05-09 Thread James Schneider
> > I agree that the typo is also an issue and should be fixed, but that >> wouldn't result in the OP's error, since reverse() is complaining about a >> 'detail' URL specifically. The typo would result in a similar error when >> the result page is displayed, and would show 'guestion' as one of the

Re: Suggiestion on how split a views.py file

2015-05-12 Thread James Schneider
There's no requirement that you use views.py, or any of the file names that are created using 'django-admin.py', and you can create as many others as you like. You can run an entire Django project from a single file if you were so inclined. All of the file name references are just for convention an

Re: Suggiestion on how split a views.py file

2015-05-13 Thread James Schneider
> > ​Thanks James for the answer, my problem is to update the various import in my app to refer to the new file with the code I moved into. At the moment, the only thing that can help is to have all the view tested to show an error in the import during the Test Harness. > ​ > ​Obviously I have not

Re: What is the ideal web server to use with Django?

2015-05-13 Thread James Schneider
If you get enough traffic to trounce a (web server of choice) installation, you probably are making enough money to hire an expert with that system to tune it properly or recommend adding additional resources. Don't get bogged down in Apache vs. Nginx vs. uWSGI, etc. You're nowhere near that point

Re: rollback the update query

2015-05-13 Thread James Schneider
> asset_spec = AssetSpecification.objects.filter(asset_id_id=inventory,utilized_value=0).values_list('asset_id', flat=True) > trans = transaction.savepoint() // Here I am trying not to commit the code and store it in transaction. > > if

Re: Django Report Builder Throws immediate error after installing

2015-05-13 Thread James Schneider
You should post the code for the view, model, and the entire traceback. I often get messages like this when using the SuccessMessages view mixin and I reference an invalid field name in success_messages within the view (usually due to copy/paste from a similar view). -James On May 13, 2015 7:01 A

Re: rollback the update query

2015-05-13 Thread James Schneider
Did you try changing the position of the save point like I mentioned? -James On May 13, 2015 9:33 PM, "Simran Singh" wrote: > Hi James, > > Thanks for your feedback. I basically want to rollback that query where I > update the db. Basically I want to rollback all the updates that were made > dur

Re: possible bug - CharField accepts string as max_length

2015-05-18 Thread James Schneider
I'd post a bug report. Based on the behavior you've outlined (haven't looked at the Django source), there may have been some oversight on the duck typing that python performs. It sounds like the migration package is taking advantage of duck typing (since 16 == int('16')), but the validation functio

Re: Adding a one field to user model: trying not to create custom one)

2015-05-18 Thread James Schneider
The point of using a OneToOne relation to create a 'profile' is that the profile is meant to contain information that is only accessed on an individual basis (such as displaying a single users' address, etc.), and generally not involved on bulk queries as you describe. If your __str__() method in

Re: Cannot resolve keyword -> on reverse ForeignKey after upgrade to 1.8

2015-05-18 Thread James Schneider
My guess is a select_related('follow') call somewhere is causing the issue. The behavior for select_related() changed in 1.8. Can you post the entire trace back? -James On May 18, 2015 4:49 PM, "Galia Ladiray" wrote: > Hi, > I wonder if anyone can help me, or just share the pain ... > > I have

Re: MultipleSelectCheckbox problem (working on dev, not on production)

2015-05-23 Thread James Schneider
Caching is often the culprit in these situations. Disable it and recheck. Obviously clear cookies and history in the browser as well. Also, verify that your database shows the correct data state (meaning that the fields in the database show as checked) once the models are saved, either through the

Re: MultipleSelectCheckbox problem (working on dev, not on production)

2015-05-23 Thread James Schneider
; 1. disable memcached -> Nothing changed > 2. Checked the databased -> Saved correctly > 3. Checked browser cache -> Used chrome dev mode (with disable cache) -> > Not working > > I'm really banging my head off on this one...:( > > > Op zaterdag 23 mei 2015 11:

Re: MultipleSelectCheckbox problem (working on dev, not on production)

2015-05-24 Thread James Schneider
ce(selection, int) therefore always gave a False!!! Now I fixed the > check to also check for long and it works :):):) so happy! > > Thank you once more! > > > Op zondag 24 mei 2015 01:13:09 UTC+2 schreef James Schneider: >> >> In that case you should post up the re

  1   2   3   4   5   6   7   8   >