Re: Diable basic auth on some pages

2015-06-30 Thread Alex Heyden
Cherie, By default, there are no authentication controls in Django. Barring some custom middleware, authentication checks are performed within the views themselves or through something like the @login_required or @user_passes_test decorators. Are you certain that authentication is what's blocking

Re: Buttons

2015-07-22 Thread Alex Heyden
A fair bit of this is Javascript, which, strictly speaking, is outside the scope of Django. >From what you're saying, it sounds like your button does two things: make a backend database change and make a frontend display change. Ultimately, the action starts with a Javascript event handler. On but

Re: Django Model field : Ordered List of Foreign Keys

2015-07-23 Thread Alex Heyden
There are options, but here's what I'd do: class Stop(models.Model): name = models.TextField() #use CharField if not using Postgres latitude = models.DecimalField() longitude = models.DecimalField() route = models.ForeignKey('Route') sequence = models.IntegerField() class Meta: u

Re: Storing images in a database using Django.

2016-05-06 Thread Alex Heyden
There's an ImageField for use in models, but to really understand it, start with FileField https://docs.djangoproject.com/en/1.9/topics/files/ https://docs.djangoproject.com/en/1.9/ref/models/fields/#django.db.models.FileField The general idea is that you have a directory configured by Django's s

Re: Best Practices URL Patterns

2016-07-06 Thread Alex Heyden
Primary keys as URL parameters are considered a security vulnerability by OWASP (https://www.owasp.org/index.php/Forced_browsing) and may affect how your code is viewed after an audit. Consider instead how sites like Reddit handle this. The URL of a comments page has a human-readable slug at the e

Re: null=True and blank=False within model fields

2016-08-06 Thread Alex Heyden
The obvious use case there is something that can't be initialized with a reasonable default value. Null is valid because you just plain need it, but blank is false because you never want it to be null ever again except if the back end explicitly demands it. On Thu, Aug 4, 2016 at 1:35 AM, James Sc

Re: forms.Form, models.Model, forms.ModelForm? (self.django)

2016-08-14 Thread Alex Heyden
forms.Form makes front-end widgets and some validation logic. models.Model defines a database interface and wraps it in a Python class. The two have nothing to do with each other aside from vaguely similar APIs for defining the classes. The intersection of the two is forms.ModelForm, which uses a

Re: Am I missing a design pattern? My views code somehow isn't as elegant as it should be...

2016-10-21 Thread Alex Heyden
Are you intentionally sending the whole request into that constructor and concatenating it to a URL string? I can't imagine any way this doesn't end in disaster. I'm sure the community would happily help, but it's not at all obvious from the supplied code what you're trying to do here. On Fri, Oc

Re: Help with runserver

2016-11-19 Thread Alex Heyden
We'd need to see your settings file and maybe your top-level urls.py to answer it conclusively, but in general terms, some view that's been mapped to root on your project is returning that there JSON response. This is not a default Django behavior, or at least wasn't in 1.10 or earlier. On Sat, No

Re: Help with runserver

2016-11-20 Thread Alex Heyden
; }, > { > 'NAME': 'django.contrib.auth.password_validation. > MinimumLengthValidator', > }, > { > 'NAME': 'django.contrib.auth.password_validation. > CommonPasswordValidator', > }, > { >

Re: get_profile() function can not resolve keyword 'user' -- no 'user' field exists in model.py or data tables.

2016-12-07 Thread Alex Heyden
The offending lines are these right here: File "/var/www/MYPROJECT/data/bookstor/profiles/views.py" in create_profile 49. profile_obj = request.user.get_profile() ## If existing profile found File "/usr/lib/python2.7/site-packages/django/contrib/auth/models.py" in get_profile 449.

Re: get_profile() function can not resolve keyword 'user' -- no 'user' field exists in model.py or data tables.

2016-12-12 Thread Alex Heyden
The first place to look would be the INSTALLED_APPS setting in your settings file, but honestly that's one of those errors that could ultimately mean a lot of things. I've had it thrown on things ranging from circular imports to admin configuration issues to bad migrations. It might be time to spin

Re: get_profile() function can not resolve keyword 'user' -- no 'user' field exists in model.py or data tables.

2016-12-12 Thread Alex Heyden
wise can you recommend a debugger that might help. > > Thanks > > > > > On 12/12/2016 9:07 PM, Alex Heyden wrote: > >> The first place to look would be the INSTALLED_APPS setting in your >> settings file, but honestly that's one of those errors that could >

Re: browser testing

2017-01-04 Thread Alex Heyden
Everyone who wants into that space compares themselves to Selenium, because Selenium is that good and has that much market share. It's obnoxious to use, excludes some less technical users, but behaves very predictably in skilled hands and has plenty of community support. If I needed to include les

Re: Log into existing Django site

2019-01-15 Thread Alex Heyden
Assuming you're familiar with web technologies in general, you'd make these changes on the host machine itself, ideally through the same mechanism that handles deployments of source code. Code for application logic is often in files called "views.py" or similar, and the HTML will be in a folder cal

Re: Log into existing Django site

2019-01-15 Thread Alex Heyden
the server to make changes. > > On Tuesday, January 15, 2019 at 2:30:44 PM UTC-7, Alex Heyden wrote: >> >> Assuming you're familiar with web technologies in general, you'd make >> these changes on the host machine itself, ideally through the same >> mechan

Re: Log into existing Django site

2019-01-16 Thread Alex Heyden
On Tuesday, January 15, 2019 at 7:59:24 PM UTC-7, Alex Heyden wrote: >> >> The server that is hosting the site. The one you're trying to FTP onto. >> Your quality of life will be greatly improved if you can SSH onto the >> machine rather than using FTP, because the a

Re:

2019-01-19 Thread Alex Heyden
You missed the +unsubscribe in the email name to accomplish that. From the footer: 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...@googl

Re: AES Encryption

2019-01-19 Thread Alex Heyden
PyCrypto would be the Python-side library if you wanted to handle this in application code, but personally, I'd prefer to handle it in my database of choice. A lot of us use Postgres, and there's a django-pgcrypto library for that. That being said, reversible ciphers are hard to do meaningfully. Y

Re: In the browser it looks ugly, why?

2019-04-06 Thread Alex Heyden
Short answer, it's giving you exactly what you asked for: the query set inside tags. What you probably want is to loop through the ingredients and place them inside tags. Something like: {% for ingredient in object.ingredientes.all %} {{ ingredient.cantidad }} {{ ingredient.nombre }} {% endfor %

Re: Website slowed down drasticaly

2019-05-03 Thread Alex Heyden
Definitely echoing Scott's sentiment here. Start with what changed. In my personal experience, if the answer is "nothing," you can narrow it down very quickly. Start by reloading with the browser network monitor in the foreground. If the first response comes back very quickly, Django itself is off

Re: Info

2019-05-06 Thread Alex Heyden
When a message goes out to here, it's sent to everyone on the group. When you reply to it, it also goes out to the group. What you're seeing is someone's auto-reply. I couldn't say for sure if it's a malicious attempt to passively get some money or if it's someone not realizing his personal spam fi

Re: Rails to Django Application Architecture Question

2019-05-24 Thread Alex Heyden
What you're describing is how you'd lay out the models in an app. It sounds like you may have one Django app. If I were writing this in Django, I might try to spin the workflow and task logic off into its own application if I thought that the core ideas of users and projects might feed some other b

Re: Should I store offline calculation results in the cache?

2017-05-27 Thread Alex Heyden
Seven years ago, that may very well have been a true statement. I wouldn't stand by it today. Disk caching should be perfectly stable, even if it's a pretty poor solution for the average use case. The part that hasn't changed is memcached. Memcached should be everyone's default caching solution, n

Re: CSRF token still needed today?

2020-04-19 Thread Alex Heyden
Django supports samesite on session cookies now, and it's on (set to lax) by default. Whether or not that completely covers your surface risk to CSRF attacks is a somewhat different question. On Sun, Apr 19, 2020 at 3:12 PM guettli wrote: > iI look at this page: https://docs.djangoproject.com/en

Re: How to django with jquery-mobile

2015-07-29 Thread Alex Heyden
You pretty much answered it yourself. >there's just one actual html page and inside it we have to create a page (data-role="page") Django's template helps you put together the response that gets to the client. It's unaware of what your CSS and Javascript frameworks will do with that response. Yo

Re: Want to change template based on full_name(request.user.username)

2015-07-29 Thread Alex Heyden
{{user}} is implicitly sent in the request, so it might be worth trying to sort out what specifically went wrong when you say {{user.is_authenticated}} went wrong. Here's a fully functioning example of some things you can do with the user object: {% block header %} Home

Re: same field in two classes

2015-08-02 Thread Alex Heyden
Sorry, I think there might be a bit of a language barrier. What do you mean by "take the value of employee salary to payroll salary?" On Sun, Aug 2, 2015 at 12:12 PM, Giovanny Vizcaya wrote: > Good day,i'm new in django and i'm doing a project, i have a class > "Employee" with atribute "salary",

Re: Passing parameters / attributes to javascript in a template

2015-08-04 Thread Alex Heyden
I don't quite follow what you're doing with set_first_call_true and set_first_call_false. Are you using that to control the for loop behavior? If you are, take a look at https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#for. Django's template language has that built in. If you're push

[1.8] Odd error on makemigrations when moving model to another application

2015-11-02 Thread Alex Heyden
Traceback first: ./manage.py makemigrations Traceback (most recent call last): File "./manage.py", line 10, in execute_from_command_line(sys.argv) File "/home/me/.virtualenvs/fluent/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 351, in execute_from_command

Re: [1.8] Odd error on makemigrations when moving model to another application

2015-11-02 Thread Alex Heyden
I tried putting the model back in its original module with some much smaller changes, but I'm getting the same error. The error is nonsense in the current context. Is there some intermediate state saved somewhere when you try to run makemigrations? On Mon, Nov 2, 2015 at 4:34 PM, Alex H

Re: var1 = var2 = var3

2016-02-16 Thread Alex Heyden
That's an assignment statement. See https://docs.python.org/2/reference/simple_stmts.html for more. On Tue, Feb 16, 2016 at 2:05 PM, anotherdjangonewby < anotherdjangone...@gmx.de> wrote: > Hi, > > this may be a bit off-topic, but: > > How are expressions like: > > var1 = var2 = var3 > > called P

Re: Why does Django allow Circular Model Relation

2016-02-19 Thread Alex Heyden
You would use it any time the relationship means something different. It would generally be inappropriate to use it as a simple backwards relationship (Django does this for you), but there's no reason not to have multiple relationships in a number of directions. In an HR system, someone could be bo

Re: URL namespaces

2016-02-25 Thread Alex Heyden
Models don't have views. Applications have views. URLs route to views, not models. Include is basically an import for a urls.py file as a whole, so there's no reason to import the same file multiple times unless you wanted it to match multiple URLs. What are you actually trying to do? On Thu, Feb

Re: I don't understand this error - Django 1.9

2016-03-04 Thread Alex Heyden
If you get longer stacktraces back, those might help in identifying what exactly is going wrong. As a first pass cleanup, try: * remove 'ladynerds' from the bottom of INSTALLED_APPS. You're already including it up top * change __init__.py to read "default_app_config = 'ladynerds.apps.LadyNerdsConf

Re: DjangoCon US 2016

2016-03-23 Thread Alex Heyden
This is an unexpected break from the old "everyone pays" policy. Has there been trouble getting proposals in the past? On Wed, Mar 23, 2016 at 10:00 AM, Andrew Pinkham wrote: > We are pleased to announce that DjangoCon US will be hosted by the Wharton > School at the University of Pennsylvania i

Re: DjangoCon US 2016

2016-03-23 Thread Alex Heyden
to ensure that getting > to the conference isn't a hardship for them. It might not always have been > presented in exactly those terms (or that clearly), though, so perhaps the > change is being so up-front about it :) > > On Wed, Mar 23, 2016 at 2:20 PM, Alex Heyden > wrote:

Re: django admin_tools et file edition

2016-03-31 Thread Alex Heyden
CKEditor is appropriate for files that need solid typography and formatting. If you're looking for something simpler, Markdown is a common solution. Markdown is a markup syntax widespread on internet forums. None of those really address "configuration files," though. Is fancy formatting actually t

Re: django admin_tools et file edition

2016-04-01 Thread Alex Heyden
o server side of my application, à la > "restful" ? > > > Le jeudi 31 mars 2016 22:31:44 UTC+2, Alex Heyden a écrit : >> >> CKEditor is appropriate for files that need solid typography and >> formatting. If you're looking for something simpler, Markd

Re: I might need a different control panel... or do I?

2016-04-08 Thread Alex Heyden
The ability to update a profile can be as simple as a form for the model object that holds the profile. The company's employees would have access to Django admin. I've never used it personally, but django-user-accounts looks like a way to avoid making a registration form if that's important to you.

Re: No Downtime Code Releases

2016-04-20 Thread Alex Heyden
I wouldn't recommend tying your repository structure to your deployment needs. Put that in the deployment script instead. You can see if any migrations are pending with manage.py migrate --list On Wed, Apr 20, 2016 at 1:59 PM, wrote: > My thought process for separating the models into a separate

Re: Django on IIS

2018-12-17 Thread Alex Heyden
I have recently, and it was equal parts misery and pain. FastCGI via wfastcgi, as outlined at http://blog.mattwoodward.com/2016/07/running-django-application-on-windows.html I also had to downgrade from Python 3.7 to Python 3.6 I wouldn't really consider myself an expert on the subject. All I can

Re: Best way to run a shell script, using input value from Django?

2019-01-02 Thread Alex Heyden
So, a lot of this doesn't have much to do with Django, but I'm not sure how familiar you are with web server best practices in general, so apologies if some of this is remedial for you. If something takes two minutes to finish, you don't want it being handled on the request handler itself. Split t

Re: [Django] How to retrieve the saved password in raw format

2019-10-21 Thread Alex Heyden
Password tables should never be human-readable. Never ever. No exceptions. If the intent is to power automation, store that password where the test agent can read it. If you don't know the password, reset it, then save it. Don't expect your web server to leak a password, though. Not even if you as