Re: Showing Errors for Non-Form Errors in a Formset

2015-04-06 Thread Bill Blanchard
Hi Stephanie, It looks like you're not returning anything when you hit an error. Try: ... def clean(self): if any(self.errors): return self.errors ... On Mon, Apr 6, 2015 at 12:00 PM, Stephanie Socias wrote: > I implement a custom clean method to validate my formset. I know there a

Re: How can I work with pyserial and django form?

2015-04-07 Thread Bill Freeman
It sounds as though you have a set of sensors (scales, license readers, barcode readers) which provide their readings over asynchronous serial (that's what pyserial can connect with). You have some computer or set of computers that collectively provide a sufficient number of serial ports to interf

Re: classic: unsupported operand type(s) for +: 'int' and 'NoneType'

2015-04-13 Thread Bill Blanchard
rations and set a default value (it could be zero if you want, but since you have two choices, you can make it one of the two as well). You could leave it as null=True and set a default value, but that seems like bad practice. Bill On Mon, Apr 13, 2015 at 4:07 PM, makayabou wrote: > It'

Re: Difficulty in passing positional arguments in url !!!

2015-04-21 Thread Bill Freeman
I think that it is the question mark in your url pattern that is causing the problem. In a real url, question mark separates the path from the query parameters. Parentheses in url patterns are for capturing parts of the path, and are not associated with query parameters. Just leave out the ? and

Re: Runserver/DEBUG only, serve / from static directory

2015-04-21 Thread Bill Freeman
If I understand your needs, try r'^$', which will catch only the top of the site. (You might want r'^(?:index.html)?$' in case some old browser you deal with has that fiddle, but the browser really should try what you typed first.) On Tue, Apr 21, 2015 at 3:02 PM, LiteWait wrote: > I have the n

Re: Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)

2015-04-21 Thread Bill Freeman
That may work for most static things. The question is whether the static server is happy with an empty path, assuming that you're trying to serve "/" this way. If not, you might add a separate (earlier) pattern of r'^$' that specifies a path in the extra parameters dictionary (where you have 'doc

Re: Difficulty in passing positional arguments in url !!!

2015-04-21 Thread Bill Freeman
ive. On Tue, Apr 21, 2015 at 4:41 PM, HIMANSHU RANJAN < livelikehimansh...@gmail.com> wrote: > Thanks for replying Bill :D > Ooops !! > i removed the question mark but it is till not working !! > The problem is that i dont have a form and i think form maynot be suitable >

Re: Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)

2015-04-22 Thread Bill Freeman
Are css and js subdirectries of apps as implied by the (as received) indentation of your message? Note that your "other" url pattern has js, css, and img, but no apps. On Wed, Apr 22, 2015 at 9:28 AM, LiteWait wrote: > Well, this doesn't work completely. > > Consider the (static) tree: > > /cli

Re: Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)

2015-04-22 Thread Bill Freeman
x27;^(?P(?:js|css|img)/.*)$', 'apps/css/style.css') # Does not match >>> re.match(r'^(?P(?:js|css|img)/.*)$', 'apps/another.html')# Does not match >>> re.match(r'^(?P(?:apps|js|css|img)/.*)$', 'apps/another.html') <_sr

Re: Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)

2015-04-22 Thread Bill Freeman
)$', 'serve'), The second url patter above must be the last one overall. Any of your other patters, for you Django views, for example, have already not matched by the time this one gets tried. On Wed, Apr 22, 2015 at 11:17 AM, Bill Freeman wrote: > By the way, you can test

Re: clear database (drop all tables)

2015-04-29 Thread Bill Freeman
With suitable privileges, you can drop the database and recreate it. In at least some databases the user privilege grants are not lost with the database and don't have to be recreated when the database is. And, if you're using SQLite, just remove the file. On Wed, Apr 29, 2015 at 6:10 AM, lars v

Re: Embeding HSQLDB in a standalone App

2015-05-20 Thread Bill Freeman
Can you access the js files via their static urls? Does your html load the js (e.g. in script tags)? Can you make it work with html accessed via file:/// type urls (keeping django out of the mix)? On Tue, May 19, 2015 at 10:06 PM, Robert librado wrote: > Anybody understand how to connect Django

Re: Testing a new app

2015-05-28 Thread Bill Freeman
If the "new" app doesn't need services from the larger app in order t work, but rather the other way around, why not leave it separate, and later, just make it an install requirement for the larger app? On Thu, May 28, 2015 at 5:54 AM, Klaas Feenstra wrote: > Using GIT would be the way of workin

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: Ready to throw the keyboard using Django 1.7 on Windows 7

2015-06-19 Thread Bill Freeman
Is this under manage.py or behind a wsgi front end like Apache/mod_wsgi or ngnx? If under manage.py, you need to cd to the directory containing manage.py first. (There are ways around this if absolutely necessary.) If behind a wsgi front end, there are other means for insuring that this director

Re: comment and uncomments in django html template

2015-06-19 Thread Bill Freeman
If your JavaScript comes from a django template, yes, the comment tag will work. If, instead, you want the lines delivered to the browser, but commented out as far as JavaScript is concerned, use /* to start the comment and */ to end it -- multiple lines are allowed. On Fri, Jun 19, 2015 at 12:48

Re: ValueError: No JSON object could be decoded

2015-06-22 Thread Bill Freeman
You probably don't want request.body. You are probably POSTing the JSON using a form, which means that it shows up as something like request.POST['data'], where you should replace 'data' with the name of the form element (textarea?) where you are putting the JSON. Posting with a form wraps things

Re: Can't Start Project.

2015-07-01 Thread Bill Freeman
cd to the directory containing manage.py (the project directory), then: python manage.py runserver On Wed, Jul 1, 2015 at 2:04 PM, Steve Burrus wrote: > well I was able to create a new project earlier however I am now having > trouble with starting the django ser ver. when I ran this cpommand

Re: Can't Start Project.

2015-07-01 Thread Bill Freeman
port > execute_from_command_line ImportError: No module named > django.core.management" I r enamed my newly created project to "src". > > > On Wed, Jul 1, 2015 at 3:14 PM, Bill Freeman wrote: > >> cd to the directory containing manage.py (the project directory

Re: Can't Start Project.

2015-07-01 Thread Bill Freeman
to connect to the django server. I assume trhat I can easily do the > "python manage.py syncdb" to connect to the sqllite3 server? > > > On Wed, Jul 1, 2015 at 3:58 PM, Bill Freeman wrote: > >> It sounds like django isn't on your path. If you are running in a >&g

Re: Can't Start Project.

2015-07-01 Thread Bill Freeman
As long as you're happy with the default file name. On Wed, Jul 1, 2015 at 6:06 PM, Gergely Polonkai wrote: > No, Django does that for you. You only have to worry about DB settings if > you want something else like MySQL or Postgres. > On 1 Jul 2015 23:40, "Bill Freema

Re: Can't Start Project.

2015-07-02 Thread Bill Freeman
at 9:08 PM, Steve Burrus wrote: > "As long as you're happy with the default file name." What exactly are you > referring to Bill? The database settings? Say how dpo you synch either > mysql or the postgres database server into django anyway? I really haven't >

Re: How to save base64 string in Python django

2015-07-14 Thread Bill Freeman
You don't show where the 'Image' object comes from (in Image.open), so I can't be specific, but here are some generalities: "Incorrect padding" is probably a message from the base 64 decoder. Capture your request.POST[photo] to play with separately. If you are doing this under the development ser

Re: Match multiple URLs to the same pattern

2015-07-14 Thread Bill Freeman
You will want a routing view, or a fallback cascade. In either case, make that urlpattern r'^([\w-]+)$'. You don't need to escape the - because it's the last char in the class. You don want to restrict the urls to those in which the entire url matches (^ and $), and the parentheses capture the s

Re: Amazon S3 Storage

2015-07-16 Thread Bill Blanchard
I've used this with success in the past: https://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html On Thu, Jul 16, 2015 at 10:22 PM, Rootz wrote: > Can you explain to me the easiest way to store uploaded image to a Django > Project using Amazon S3 for all my uploads to the proje

Re: Need Django Help Again.

2015-07-22 Thread Bill Freeman
Try no space between ".\Scripts\" and "django-admin.py" You could also try forward slashes on the django-admin.py line (I think that you need the back slashes on the activate line). And I don't think that you need the ".\" on the django-admin.py line. And, if that activate is activating a virtua

Re: Find Django Source Files

2015-07-22 Thread Bill Freeman
Note that this is a limitation of you shell. (I presume that you are using cmd.exe.) On linux in bash the tutorial version works fine. You are likely to find a number of things that are different from the experience of the document writers if you are using Windows. On Wed, Jul 22, 2015 at 12:46

Re: Need Django Help Again.

2015-07-22 Thread Bill Freeman
I presume that you have actually checked for a django-admin.py file in the Scripts directory? On Wed, Jul 22, 2015 at 12:58 PM, Steve Burrus wrote: > > *well I haVE tried both this "python .\Scripts\django-admin.py > startproject me" and Bill's suggestion opf "python django-admin.py > startproj

Re: Need Django Help Again.

2015-07-22 Thread Bill Freeman
ing. I had just forgotten to do > this command : "pip install django" in the "burrus" virtual environment > inst ance! I still have the shakiest knowledge of django in general so > little mistakes like this I am gonna have a little while longer.* > > > *On Wed, J

Re: Need Django Help Again.

2015-07-22 Thread Bill Freeman
o > something in Django beyond merely connecting to the server and maybe > configuring the admin? I am getting tired of just connecting to the server > and then "calling it a day" if you know what I mean. > > > > On Wed, Jul 22, 2015 at 1:20 PM, Bill Freeman

Re: settings.configure() does not allow me to access custom variables in settings.py

2014-07-07 Thread Bill Freeman
I don't know how fussy about not using stuff from django you are, but the following works for me: $ DJANGO_SETTINGS_MODULE=foo.ct python >>> from django.conf import settings >>> settings.INSTALLED_APPS Obviously, you replace "foo" with the name of your project. This prints my installed app

Re: Did Ubuntu 14.04 or Linux Mint 17 break your Django project files?

2014-07-16 Thread Bill Freeman
I make it a point to never use a python build that comes from a .deb for any real development. The OS vender may require certain python features for its management scripts, but I don't like my development tools changing out from under me. Build yourself a python from source, putting it some where

Re: Find link in a "dynamic" page

2014-07-19 Thread Bill Freeman
Are you keeping the cookies and returning them is subsequent requests? (Particularly the session cookie, but all will work as well - if this is the problem.) On Thu, Jul 17, 2014 at 1:50 PM, Carlos Perche wrote: > Hello guys, could someone help me with this ... > > I am needing to find the link

Re: How to call a function when a project starts.

2014-07-31 Thread Bill Freeman
It runs twice because runserver uses two processes: the real server, and; the monitoring process that restarts the other when you change a source file. You could fool around with undocumented internals to figure out which a given import is running in. Or you could use a modifies runserver command.

Re: nginx and django without virtualenv

2014-08-06 Thread Bill Freeman
Performance *should* be identical. All that virtualenv does (from the point of view of the executing python program) is to change how sys.prefix and sys.exec_prefix are set, and thus, how sys.path is calculated. But with a vanilla sys.path, you need to be sure that django, your other dependencies

Re: nginx and django without virtualenv

2014-08-06 Thread Bill Freeman
Though if he's moving to nginx, thus not mod_wsgi, I guess it doesn't matter what mod_wsgi is linked against. On Wed, Aug 6, 2014 at 1:49 PM, Collin Anderson wrote: > Actually, that's a good point. I always use the same python version that's > linked with mod_wsgi. I don't use a virtualenv to u

Re: nginx and django without virtualenv

2014-08-06 Thread Bill Freeman
Right. I thought of that later. But virtualenv or not is still just a different sys.path, and you still have to have your stuff installed in the correct python. On Wed, Aug 6, 2014 at 1:53 PM, Bill Freeman wrote: > Though if he's moving to nginx, thus not mod_wsgi, I guess it

Re: websockets in django

2014-08-25 Thread Bill Freeman
+1 on tornado. I may be behind the times, but I don't think that the Django architecture lends itself to persistent connections. Also, Django is intended to run behind another server, such as Apachi, nginx, etc., and that server, too, would need to be amenable to persistent connections. This do

Re: I have configured SysLogHandler for my django app but nothing is going into the log file

2014-09-23 Thread Bill Freeman
This is from my logging config file from a non-django project, but the principals should be similar. Before you look too hard here, are you sure that rsyslog.d (or equivalent) is running on the box (at which you have targeted the logger? Is the facility on which you are logging configured (In my c

Re: What is *the* django 1.7 IDE which is opensource & multiplattform

2014-09-24 Thread Bill Freeman
I just use emacs. One of the original open source tools. Template syntax support requires a plugin, and I might try one some day, but html mode has been satisfying so far. Also, since I know how to type, running my own management commands in an emacs shell window works for me. This sort of magi

Re: How can I make the field layout of a model form dynamic?

2014-10-22 Thread Bill Freeman
Perhaps the most djangoish way would be to create two model forms, with different fields excluded, and choose which to render in the template. Or you could render CSS style information to hide one or the other. Or you could use JavaScript to hide one or the other based on something else that you

Re: Database field for Image Upload

2014-10-29 Thread Bill Freeman
Note that if these images will be displayed on the site it is best done by your front end (Apache, ngnx, etc.) since the HTML to show them treats them as a separate request, and serving static files is your front end's forte. The front end knows how to do this with files, but probably not with data

Re: lambda callable in foreignkey default

2013-11-27 Thread Bill Freeman
Probably not it, but try: ...(RestaurantType, default = lambda: (RestaurantType.objects.all()[0])) And note that your alternate will fail if RestaurantType object with id==1 is ever deleted. On Tue, Nov 26, 2013 at 7:31 AM, Philippe Raoult wrote: > > I ran into a strange issue today when try

Re: Spammed with 'Invalid HTTP_HOST header' messages

2013-12-06 Thread Bill Freeman
Simple is in the eye of the beholder. Unless someone we haven't heard from comes up with pre-existing switches or sub filtering attachment points, I see two possibilities. 1. Patch or monkey patch the code that decides to send the e-mail to check for this case to omit the e-mail. This has to be

Re: How to urlquote backslash in reverse arguments

2013-12-17 Thread Bill Freeman
s: reverse(...).replace('/', '%2f') But you don't need (or want) to do that to get a URL that will access the given view. Bill On Tue, Dec 17, 2013 at 7:28 AM, Tom Evans wrote: > On Tue, Dec 17, 2013 at 10:15 AM, Vitaly wrote: > > Hi > > > >

Re: How to display different contents when refresh every time.

2013-12-19 Thread Bill Freeman
If the page is cacheable then, in the wild, all bets are off. On Thu, Dec 19, 2013 at 4:14 PM, Jonathan Baker < jonathandavidba...@gmail.com> wrote: > I agree with Avraham, and you can easily accomplish this by using > .order_by("?") when using the Django ORM (@see > https://docs.djangoproject.c

Re: Which Real Time Communications Protocol

2013-12-20 Thread Bill Freeman
WebSockets runs over standard HTTP or HTTPS connections, getting past firewalls and other restrictions (e.g.; the hotel WiFi will let you web browse, but not use other ports). Since WebSockets is standard HTML5, libraries for it will become more and more common. There are also older "push" techno

Re: Which Real Time Communications Protocol

2013-12-30 Thread Bill Freeman
Tornado (which supports websockets out of the box) and no front end server. On Sat, Dec 21, 2013 at 7:55 AM, Dig wrote: > Hi Bill, > > Is there any django project support websocket? Thanks. > > Regards, > Dig > On Dec 21, 2013 1:50 AM, "Bill Freeman" wrote: &g

Re: rendering HTML as a select item

2014-01-21 Thread Bill Freeman
lock level elements. You could see what you can do with span instead of div. Bill On Sun, Jan 19, 2014 at 6:50 PM, Larry Martell wrote: > I am trying to 'fake out' a model form and display data from 2 columns > in one field. I can do this by returning the 2 columns in the model&#

Re: Argument passing between views

2014-02-02 Thread Bill Freeman
Read up on the session object. On Sun, Feb 2, 2014 at 4:11 AM, SAHIL SHEKHAWAT wrote: > I have a variable generated in a view and i want to pass it as an > argument to another view. > Both views have their urls so, i can't use GET request. > I want to create invisible fields and pass it using P

Re: Newbie Question - Where to store application constants?

2014-02-14 Thread Bill Freeman
have an app specific settings module), so you won't (typically) have circularity if you import from it. Bill On Fri, Feb 14, 2014 at 11:13 AM, Mark Phillips wrote: > Where should one put application specific constants - those that change > sometimes(1) and those that never change? F

Re: What to do after python manage.py runserver

2014-03-04 Thread Bill Freeman
Or you can share the one terminal by stopping the server to run other commands, then do runserver again to test them. The startup message should have told you how to stop (exit, kill) the server. On linux it's control-C. That may work elsewhere too. (Just for completeness, in an emacx shell win

Re: starting a django project

2014-03-18 Thread Bill Freeman
A first guess: Try using "python django-admin.py startproject mysite". That will help if your system isn't configured to automatically use python for this task. If this helps, then later, when you are running manage.py commands, you will also need to prefix them with python. On Tue, Mar 18, 201

Re: Why can invalid models be saved?

2014-04-01 Thread Bill Freeman
common ground for specifying that the database itself check, maybe just not null. A programmer, using the models directly (that's the presumption if you're typing python statements) is expected to know what he's doing. Bill On Tue, Apr 1, 2014 at 4:19 AM, Claus Conrad wrote:

Re: ORM Question

2014-04-01 Thread Bill Freeman
Aren't you missing a ForeignKey relationship to tell which LlamaHerd a Llama belongs to? Then you would use the reverse relation manager in LlamaHerd to build up your annotation. On Tue, Apr 1, 2014 at 5:52 PM, Justin Holmes wrote: > I have come across this problem in several Django projects, b

Re: ORM Question

2014-04-02 Thread Bill Freeman
ze = FloatField() >> dob = >> FloatField >> herd = ForeignKey(Herd, related_name="llamas") >> >> >> >> >> On Tue, Apr 1, 2014 at 6:09 PM, Bill Freeman wrote: >> >>> Aren't you missing a ForeignKey relationship

Re: ORM Question

2014-04-02 Thread Bill Freeman
doesn't work - that's the whole reason for my > question. See, the annotate doesn't associate instances with the annotated > attribute, it associated results. > > (BTW, good looking out - I have once again fixed the SO question :-)) > > > On Wed, Apr 2, 2014 at

Re: ORM Question

2014-04-03 Thread Bill Freeman
esn't directly expose GROUP_BY, but it looks likes > QuerySet.values() uses it; so I wonder if that fits into the picture > somehow? > > > On Wed, Apr 2, 2014 at 12:35 PM, Bill Freeman wrote: > >> My point was that annotate might work after the other problems were >> fixe

Re: why does django user require create database privlages for testing

2014-04-23 Thread Bill Freeman
Because virtually all of us don't want our production database used for testing. On Wed, Apr 23, 2014 at 4:18 PM, dacresni wrote: > Rails doesn't require this, you create a test database as super user and > it uses it for testing. Why doesn't django allow this? > > -- > You received this messag

Re: PyDev 3.4.1 & Django 1.7: undefined variable from Import

2014-05-12 Thread Bill Freeman
But the code works, right? This is a PyDev issue, not a Django issue. (If you can only use code that your IDE understands, that leaves out a lot of interesting programs.) On Mon, May 12, 2014 at 4:04 AM, Florian Auer wrote: > Hi folks > > I'am new to django and try to follow the tutorial to d

Re: What does "+=" mean, or do?

2014-05-12 Thread Bill Freeman
a += b is nominally the same as a = a + b To make class instances support this behavior the class can implement the __iadd__ special method. See docs.python.org and read about special methods. This notation originated, so far as I know, in the C language. It at least goes back that far. On

Re: PyDev 3.4.1 & Django 1.7: undefined variable from Import

2014-05-12 Thread Bill Freeman
t you are using. On Mon, May 12, 2014 at 9:04 AM, Bill Freeman wrote: > But the code works, right? > > This is a PyDev issue, not a Django issue. > > (If you can only use code that your IDE understands, that leaves out a lot > of interesting programs.) > > > On Mon, M

Re: django installation

2014-06-11 Thread Bill Freeman
Still, the OP's command should have worked. The most likely problem is that Django was installed to a different python than the one he gets when he types "python" at the shell. He does not say how he installed Django, so it is hard to advise. On Wed, Jun 11, 2014 at 6:23 AM, Daniel Roseman wr

Is anyone using MariaDB for Django on CentOS

2014-06-12 Thread Bill Freeman
ed systems, but neither yum nor googling finds an RPM for CentOS 6. <http://data-matters.blogspot.com/2013/08/install-mysql-python-with-mariadb.html> Has anyone gotten past this? (My google-fu is apparently inadequate.) Bill -- You received this message because you are subscribed to the G

Re: How to install psycopg2 using Pip?

2014-06-16 Thread Bill Freeman
One possibility is that you have it, but it is in a directory that is not on you path. Try: find / -name pg_config 2> /dev/null If this finds the executable, you can add the directory your current invocation of the shell (It will be gone when you log out and back in) to do the pip install. Bu

Migrating into Django 1.9; question about autoescape

2018-02-13 Thread Bill Torcaso
will have a bad experience. 3. Visit all of my code and all of my templates, carefully converting into the world of autoescape-on. Thanks in advance, --- Bill Torcaso -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: When do I need a new app within the site?

2018-02-22 Thread Bill Torcaso
This is an indirect reply --- but I like the book "Two Scoops of Django". It is a strong explanation of Django best practices. (The "scoops" are scoops of ice cream in the fictional ice cream store of the examples). Hope this helps. On Thursday, February 22, 2018 at 7:22:36 AM UTC-5, Cictani

Re: Clarification on Foreign Keys requested

2018-03-05 Thread Bill Freeman
Are you specifying the to_field argument, or are you letting it default? And is the pk of the other model made by Django by default, or are you explicitly specifying a foreign key constraint on some field of your own. Things might be better in 2.0, but I've had my troubles with pk that isn't an A

Re: Clarification on Foreign Keys requested

2018-03-06 Thread Bill Freeman
; instance > > Finally, yes, under normal circumstances, my pk uuids are made > automatically. Thanks > > *“None of you has faith until he loves for his brother or his neighbor > what he loves for himself.”* > > On Mon, Mar 5, 2018 at 2:16 PM, Bill Freeman wrote: > >> Ar

Re: Decoupling Postgres database credentials in django for deployment.

2018-03-30 Thread Bill Torcaso
I have a concern about using environment variables to hold secret information, and an opinion about it. IF DEBUG is enabled, and there is a 500 server internal error, and the default 500 template is used to render the response, THEN *all of your secret information is shown in the browser

Re: Use self-increasing arguments in numeric for-loop in Django

2018-04-20 Thread Bill Torcaso
I an new-ish to Django, and I ask this to hear from more experienced users whether this would work at all, and whether it would be considered a good or bad practice. Goal: given an object and an integer index, retrieve the sub-object at that index within the incoming object. Method: Write a

Re: Decoupling Postgres database credentials in django for deployment.

2018-04-22 Thread Bill Torcaso
I waited a while to answer this, and my answer comes in three distinct parts. #- Question: what is the danger is using environment variables to hold secret info? Answer: The Django runtime will dump secret info from environment variables into an HTTP response, in some c

Re: Managing multiple user types in Django

2018-05-16 Thread Bill Torcaso
I inherited a system which has one User model, and a Profile model that is 1-to-1 with User. The type-of-user information is carried in a required "role" property in the Profile. I think that is a well-established approach. I am curious to hear what people think of the tradeoffs between (Use

Re: Why don't I see my category ForeignKey field in related Model

2016-05-11 Thread Bill Freeman
This is a many to many relation. One contact can have multiple relations, according to your text, but clearly, more than one contact can be family, etc. And if, instead, each contact can have only one relation, then the ForeignKey goes in the Resource (contact) model, not the Relationship (catego

Re: Why don't I see my category ForeignKey field in related Model

2016-05-13 Thread Bill Freeman
If you use a ManyToManyField, Django creates the join table for you. In the rare case that you need to store additional data on the join table, you can create your own and use ManyToManyField.through On Fri, May 13, 2016 at 5:00 AM, Bruce Whealton < futurewavewebdevelopm...@gmail.com> wrote: >

Re: Stuck on tutorial your first Django app part 2

2016-06-09 Thread Bill Freeman
What is the definition of your __str__() method? On Thu, Jun 9, 2016 at 4:11 PM, Neil Hunt wrote: > Hello, > > I'm enjoying the tutorial and now I'm stuck on the second page (writing > your first Django app part 2), shortly after this paragraph. > > 'It’s important to add __str__() >

Re: Test fails when run in whole test suite - but not stand-alone?

2016-06-25 Thread Bill Freeman
I have no immediate clue. I know that, using nosetest, I can add -s and -v to the command line, making it possible to drive pdb from the test, using: import pdb;pdb.set_trace() inserted in the code to get into pdb at the relevant point(s). Evan if you're not running under nosetest, there ma

Re: nginx+uwsgi, cache somewhere but I don't know where

2016-08-16 Thread Bill Freeman
Cached in browser, maybe? On Tue, Aug 16, 2016 at 11:43 AM, Avraham Serour wrote: > How do you know the query is cached? > > On Aug 16, 2016 6:33 PM, "술욱" wrote: > >> I forgot to say I reloaded (and restarted) nginx and uwsgi, but the query >> is still cached >> >> >> Thanks anyway! >> >> >> >>

Re: [Help] Advanced tutorial: How to install my Python package with Virtualenv

2016-09-27 Thread Bill Freeman
You don't say what OS/platform you are using, and I don't know if what I say below applies to Windows, but should be valid elsewhere. Note, too, that I presume that you are using a command line (e.g.; xterm/bash). I also presume that you have managed to install virtualenv on your system. If you

Re: [Help] Advanced tutorial: How to install my Python package with Virtualenv

2016-09-27 Thread Bill Freeman
I don't do development in Windows, so take this with a grain of salt, but under the directory in which you created your virtualenv, there should be a directory called "bin". In that there will be a couple of files whose names begin with "activate". There may be one with an obvious Windows extensi

Re: order_by function gets error if the field name or json key, has a dash.

2019-01-14 Thread Bill Freeman
At least on 2.7, python has no trouble with this: d={'x-y': 4} >>> import json >>> json.dumps(d) '{"x-y": 4}' >>> So that leave's Django's parsing of the order_by string, or just possibly the database connector. It probably won't work, but you could try: MyTable.objects.all().order_by("'myfiel

Re: rsync vs git for Django development? + Project directory location?

2019-03-15 Thread Bill Freeman
ache. I presume that Nginx is similarly competent. It was used at a few places I worked, but I didn't have to deploy it, so I've not learned the details. Bill On Fri, Mar 15, 2019 at 7:42 PM drone4four wrote: > Have two questions. > > To manage development of a Django project

Re: Create project in windows, but run it in Ubuntu

2019-03-22 Thread Bill Freeman
Using git does not require github. You can use any accessible machine to serve a git repository, to which you can push, and from which you can pull, using, for example, git+ssh (you could also use an ssh tunnel, but git supports ssh transport directly). Do set up ssh to require keys and not allow

Re: why i need to download pycharm , why python ide is not sufficient to write code .

2019-03-27 Thread Bill Freeman
Like many tools, it will take longer to learn to use it well than it takes to code a small project, though it will start to help along the way. As an emacs user, I already had what I needed and more, so it was hard to justify the extra effort, but I was working where everyone else used it, and it

Re: SESSION_EXPIRE_AT_BROWSER_CLOSE

2019-07-15 Thread Bill Freeman
Once there was no such thing as a cookie that expired at browser close. Note that such must be implemented by the user agent (browser), since that's the only thing that knows if it has been closed. (And, in fact, if you want it to be closed if the browser crashes, or if it is hard killed by the OS

Re: Django user model. 1 admin account, 1 customer account with the same email and different password

2020-04-13 Thread Bill Freeman
Many e-mail systems allow you to add a suffix to the username portion of the address, separated by something like a "-", or, last time I checked for gmail, by a "+", and it will still be delivered to the same mailbox. For example, I expect mail sent to ks.kennysoh+ad...@gmail.com will still r

Re: What Did I Do Right? (url and domain name change)

2015-08-06 Thread Bill Freeman
Look at "Sites" in the admin. On Thu, Aug 6, 2015 at 5:03 PM, Malik Rumi wrote: > I have 1 model from my django project up and running on django. Before > adding more models and content, I wanted to use my actual domain name, > instead of whatever.herokuapp.com. So after I got that straight, I >

Re: Writing a “circuit breaker” for use in Django

2015-08-10 Thread Bill Freeman
In Django, requests should not wait, since the threads are relatively heavyweight in python, and need to be a limited resource. The alternative is a large number of processes, which is also expensive. So you must design a scheme in which the client polls for a result, meaning that you cannot expe

Re: Writing a “circuit breaker” for use in Django

2015-08-10 Thread Bill Freeman
If you have your heart set on a circuit breaker pattern (patterns are overrated, see http://www.paulgraham.com/icad.html), consider implementing it in the client. If you need a long poll solution, note that you can serve some urls from uwsgi/Django and others from tornado or twisted. If you are w

Re: Why should I care to use YAML with Django?

2015-08-17 Thread Bill Freeman
One interesting feature of YAML is the ability to have custom operators. For example, with YAML used as a fixture, you might have an operator that turns a hex string into a MongoDB ObjectId on read, or a date string into a datetime object, meaning that you don't have to post process the data read.

Re: What I need to know to be a Django full stack developer?

2015-09-04 Thread Bill Blanchard
Full stack implies that you are competent working on the front end (HTML/CSS/Javascript), back end (Django/Python), and database (to a lesser extent). You don't necessarily have to be an amazing designer to consider yourself "full stack", but you need to be able to do basic front end layouts and s

Re: Entry.objects.filter(pub_date__month=7) doesn't work with Django 1.8

2015-09-22 Thread Bill Freeman
What does the following say? Entry.objects.filter(pub_date__year=2015)[0].pub_date.month If it says 7, then its time to delve into the generated SQL for the month query. On Tue, Sep 22, 2015 at 10:52 AM, lxm wrote: > I create a class named Entry,like this: > >> class Entry(models.Model): >

Re: custom setting provided by myapp

2015-09-23 Thread Bill Freeman
I would be upset to find an app that I installed fiddling with my project settings. On Wed, Sep 23, 2015 at 12:53 PM, Luis Zárate wrote: > Hi, > > l have an app than need other apps to run well, I create a requirements > file and setup file and insert the required apps in my settings, also > inc

Re: Django admin suitable for external users?

2015-09-23 Thread Bill Freeman
How technical are your users? What are your security constraints? How much work can you do to make it "pretty"? (Believe me, someone will ask.) Are there fields that you want to administer internally but don't want to expose to the users? Will your users object if you decide to move to a newer Dja

Re: custom setting provided by myapp

2015-09-23 Thread Bill Freeman
ovide a custom setting with > auto-generate configuration file (I don't know how to do that). > > Other idea is that my app can add configuration if is not set explicitly, > so the user have the possibility to change whatever he want and my app only > guarantee that run well mo

Re: Tests not passing in suite but pass individually

2015-12-02 Thread Bill Freeman
Make test b clean up after itself, by deleting the test object. On Wed, Dec 2, 2015 at 9:28 AM, Tim Graham wrote: > It will be easier to help if you can provide a sample project that > reproduces the error. > > On Wednesday, December 2, 2015 at 3:01:31 AM UTC-5, Siddhi Divekar wrote: >> >> Hi, >

Re: Tests not passing in suite but pass individually

2015-12-02 Thread Bill Freeman
Did you see some documentation that said that the test framework will clear the database? I'm not sure that it's reasonable to ask a test framework to do that, given the number of possible databases and interface layers, though it is conceivable that django's variation on test could take care of t

Re: pip install django

2015-12-24 Thread Bill Blanchard
I am experiencing this as well. On Thu, Dec 24, 2015 at 9:08 AM, wrote: > Is failing from several machines this morning. > > >pip install django --upgrade > Collecting django > Could not find a version that satisfies the requirement django (from > versions: ) > No matching distribution found for

Re: Scanning for Wifi

2015-12-28 Thread Bill Freeman
Yes, though there probably isn't a slick app for the PC to do it. You would have a web server running on the Pi, maybe Django, that displays the available wireless networks. You would want a button to re-scan. This works by trigering a shell command to run iwlist (or whatever the current tool is

Re: Debugging Django with Debug set to False

2016-01-04 Thread Bill Freeman
You don't say what your front end is. There are ways to use pdb with apache, look for advise on the modwsgi site. But if you are in production, rather than just bringing up the instance that will be production, you may not want to interrupt. Be sure that you can't reproduce the problem in the de

<    4   5   6   7   8   9   10   >