Tumgik
#userdef
michaelcorleones · 8 months
Text
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
WHIPLASH (2014) dir Damien Chazelle
Miles Teller as Andrew Neiman
846 notes · View notes
denvilleneuve · 4 months
Text
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
✨Happy Christmas! It's Christmas!🎄 ~MeRrY cRiSis~ ❄︎mErrY ChRysLer❄︎
228 notes · View notes
m--bloop · 11 months
Photo
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
“Am I still invisible?”
Joyland dir. Saim Sadiq (2022)
145 notes · View notes
fruedian · 9 months
Text
Tumblr media Tumblr media Tumblr media Tumblr media
THE END OF THE F***ING WORLD | 1.06
130 notes · View notes
natarsenic · 6 months
Text
Tumblr media Tumblr media Tumblr media
floating on the water ever changing picture hours out from that in tune with all our dreams
— sex tape, deftones
38 notes · View notes
cliffbooth-arc · 11 months
Text
new blog
hey y’all, i decided to combine this blog and personal together and make a new blog where i basically just post whatever the fuck i want without the stress. you can follow the new crib @deftoons ! you’ll of course still be seeing a lot of film-related things and me posting edits from time to time, but it will be a more miscellaneous vibe now! & i recently decided to officially start going by my real name, sav, instead of maxine now, will be tracking a new tag #userdef - you’re welcome to tag me in anything film or music related!
39 notes · View notes
codehunter · 1 year
Text
Django Models (1054, "Unknown column in 'field list'")
No idea why this error is popping up. Here are the models I created -
from django.db import modelsfrom django.contrib.auth.models import Userclass Shows(models.Model): showid= models.CharField(max_length=10, unique=True, db_index=True) name = models.CharField(max_length=256, db_index=True) aka = models.CharField(max_length=256, db_index=True) score = models.FloatField()class UserShow(models.Model): user = models.ForeignKey(User) show = models.ForeignKey(Shows)
Here is the view from which I access these models -
from django.http import HttpResponsefrom django.template import Contextfrom django.template.loader import get_templatefrom django.http import HttpResponse, Http404from django.contrib.auth.models import Userdef user_page(request, username): try: user = User.objects.get(username=username) except: raise Http404('Requested user not found.') shows = user.usershow_set.all() template = get_template('user_page.html') variables = Context({ 'username': username, 'shows' : shows}) output = template.render(variables) return HttpResponse(output)
At this point I get an error -
OperationalError: (1054, "Unknown column 'appname_usershow.show_id' in 'field list'")
As you see this column is not even present in my models? Why this error?
https://codehunter.cc/a/django/django-models-1054-unknown-column-in-field-list
0 notes
febutaboh · 2 years
Text
History alive year 8 pdf handbuch
 HISTORY ALIVE YEAR 8 PDF HANDBUCH >>Download (Herunterladen) vk.cc/c7jKeU
  HISTORY ALIVE YEAR 8 PDF HANDBUCH >> Online Lesen bit.do/fSmfG
           Page 8. 8. 8. Page 9. 9. 1. 2. Page 10. 10. 3. Page 11. 11. 4. Page 12. 12. 6. 5. Page 13. 13. 7. Page 14. 14. 8. Page 15. 15. 9. Page 16 8 Wenn das Produkt nicht einwandfrei finden, lesen Sie weitere Informationen im Abschnitt Wartung und Fehlersuche. 9 Im Inneren des Geräts befinden sich. Model year: 06/2011. Vehicle code: ø 1.5 - 8 - 11mm ø 20mm. M6. Service manual only TPA CLICK! CLICK! Manual Ref. no. AIM 002 285-1. 5 of 12. 8. 19.05.2022 — Let us know YOUR RECENTLY VIEWED ITEMS Browsing History ON Clear History (Posted by marcz1 8 years ago) Bose Bluetooth Answers Samsung 8. GALILEO Anwenderhilfe 06/21 MN048018DE Eaton.com Set year -userdef sowie zu den unterstützten Protokollen finden Sie im pdf-Dokument Galileo Access EKG recordings stored on the AliveCor server. • Print or save the recording in PDF format. Page 4. AliveCor, Inc. ForDieses Handbuch bietet eine Einführung in Bezug auf die Gerätefunktionen. Es beschreibt ebenso das Bedienfeld, cher als PDF-Dateien anzuzeigen. von Y Skjæveland · 2017 · Zitiert von: 42 — Some of the older children – the five- to six-year-olds – expressed an emerging historical consciousness. This indicates that although historical understanding 26.4 View Software Update History App. You can open Netflix immediately from a TV in. 8 You can use Manual Installation to quickly add new.
https://www.tumblr.com/febutaboh/698651003687501825/ford-diesel-transmission-bedienungsanleitung, https://www.tumblr.com/febutaboh/698649825223278593/craftsman-tiller-rear-tine-handbuch, https://www.tumblr.com/febutaboh/698651261920264192/apm303-modbus-operator-handbuch, https://www.tumblr.com/febutaboh/698650253498433536/orientation-for-new-employees-handbuch, https://www.tumblr.com/febutaboh/698650588078080000/devo-7-handbuch.
0 notes
codehunter · 2 years
Text
Creating a extended user profile
I have an extended UserProfile model in django:
class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) #other things in that profile
And a signals.py:
from registration.signals import user_registeredfrom models import UserProfilefrom django.contrib.auth.models import Userdef createUserProfile(sender, instance, **kwargs): profile = users.models.UserProfile() profile.setUser(sender) profile.save()user_registered.connect(createUserProfile, sender=User)
I make sure the signal gets registered by having this in my __init__.py:
import signals
So that should create me a new UserProfile for every user that registers, right? But it doesn't. I always get "UserProfile matching query does not exist" errors when I try to log in, which means that the database entry isn't there.
I should say that I use django-registration, which provides the user_registered signal.
The structure of the important apps for this is, that I have one application called "users", there I have: models.py, signals.py, urls.py and views.py (and some other things which shouldn't matter here). The UserProfile class is defined in models.py.
Update: I changed the signals.py to:
from django.db.models.signals import post_savefrom models import UserProfilefrom django.contrib.auth.models import Userdef create_profile(sender, **kw): user = kw["instance"] if kw["created"]: profile = UserProfile() profile.user = user profile.save()post_save.connect(create_profile, sender=User)
But now I get a "IntegrityError":
"column user_id is not unique"
Edit 2:
I found it. Looks like somehow I registred the signal twice. The workaround for this is described here: http://code.djangoproject.com/wiki/Signals#Helppost_saveseemstobeemittedtwiceforeachsave
I had to add a dispatch_uid, now my signals.py looks like this and is working:
from django.db.models.signals import post_savefrom django.contrib.auth.models import Userfrom models import UserProfilefrom django.db import modelsdef create_profile(sender, **kw): user = kw["instance"] if kw["created"]: profile = UserProfile(user=user) profile.save()post_save.connect(create_profile, sender=User, dispatch_uid="users-profilecreation-signal")
https://codehunter.cc/a/django/creating-a-extended-user-profile
0 notes
codehunter · 2 years
Text
Wrong dashboard while adding flask-admin to project
Tumblr media
I'm trying to extend the flask-base project https://github.com/hack4impact/flask-base/tree/master/app. This uses the the application factory pattern in app/init.py and blueprints.
In the app/init.py I have:
import osfrom flask import Flaskfrom flask_mail import Mailfrom flask_sqlalchemy import SQLAlchemyfrom flask_login import LoginManagerfrom flask_assets import Environmentfrom flask_wtf import CsrfProtectfrom flask_compress import Compressfrom flask_rq import RQfrom flask_admin import Admin, BaseView, exposefrom flask_admin.contrib.sqla import ModelView# from app.models import Userfrom config import configfrom .assets import app_css, app_js, vendor_css, vendor_jsbasedir = os.path.abspath(os.path.dirname(__file__))mail = Mail()db = SQLAlchemy()csrf = CsrfProtect()compress = Compress()# Set up Flask-Loginlogin_manager = LoginManager()login_manager.session_protection = 'strong'login_manager.login_view = 'account.login'from app.models import Userdef create_app(config_name): app = Flask(__name__) app.config.from_object(config[config_name]) app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False # not using sqlalchemy event system, hence disabling it with app.app_context(): m =app.url_map config[config_name].init_app(app) # Set up extensions mail.init_app(app) db.init_app(app) login_manager.init_app(app) csrf.init_app(app) compress.init_app(app) RQ(app) # adm = Admin(app, name='MyAPP') adm = Admin(endpoint='adminz', name='adz', url='/adminz') ...... # Create app blueprints from .main import main as main_blueprint app.register_blueprint(main_blueprint) from .account import account as account_blueprint app.register_blueprint(account_blueprint, url_prefix='/account') from .admin import admin as admin_blueprint # from .admin import admin_blueprint app.register_blueprint(admin_blueprint, url_prefix='/admin') return app
templates/admin/db.html:
<p>Hello world</p>
To the admin views (https://github.com/hack4impact/flask-base/blob/master/app/admin/views.py) I've added :
from flask_admin import Admin, BaseView, exposefrom flask_admin.contrib.sqla import ModelViewfrom app import adm as adm, dbclass MyView(ModelView): @expose('/') def db(self): return self.render('admin/db.html')# admin management [email protected]('/db')def db(): adm.add_view(MyView(User, db.session))
I'm getting the admin dashboard not the flask-admin basic view when I open:
127.0.0.1:5000/db
Tumblr media
What am I doing wrong?
EDIT:
following your directions I changed create_app to start with:
def create_app(config_name): app = Flask(__name__) app.config.from_object(config[config_name]) app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False # not using sqlalchemy event system, hence disabling it # adm = Admin(name='admin2', endpoint='/db', url='/db', template_mode='bootstrap3',base_template='admin/db.html') config[config_name].init_app(app) # Set up extensions mail.init_app(app) db.init_app(app) login_manager.init_app(app) csrf.init_app(app) compress.init_app(app) RQ(app) adm = Admin(app, name='MyAPP') # adm = Admin(endpoint='adminz', name='adz', url='/adminz') adm.add_view(MyView(User, db.session, endpoint='db'))
This results in :
File "....flask\app.py", line 946, in register_blueprint (blueprint, self.blueprints[blueprint.name], blueprint.name)AssertionError: A blueprint's name collision occurred between and . Both share the same name "admin". Blueprints that are created on the fly need unique names.
EDIT2:
to the end of create_app I've added:
# Create app blueprintsfrom .main import main as main_blueprintapp.register_blueprint(main_blueprint)from .account import account as account_blueprintapp.register_blueprint(account_blueprint, url_prefix='/account')from .admin import admin as admin_blueprint# from .admin import admin_blueprintapp.register_blueprint(admin_blueprint, url_prefix='/admin')# app.register_blueprint(admin_blueprint, url_prefix='/ab')with app.app_context(): m =app.url_mapreturn app
I'm not sure what you want to see but m.rules gives:
<Rule '/account/manage/change-password' (HEAD, GET, OPTIONS, POST) -> account.change_password>, <Rule '/account/manage/change-email' (HEAD, GET, OPTIONS, POST) -> account.change_email_request>, <Rule '/account/manage/info' (HEAD, GET, OPTIONS, POST) -> account.manage>, <Rule '/account/confirm-account' (HEAD, GET, OPTIONS) -> account.confirm_request>, <Rule '/account/reset-password' (HEAD, GET, OPTIONS, POST) -> account.reset_password_request>, <Rule '/account/unconfirmed' (HEAD, GET, OPTIONS) -> account.unconfirmed>, <Rule '/account/register' (HEAD, GET, OPTIONS, POST) -> account.register>, <Rule '/account/logout' (HEAD, GET, OPTIONS) -> account.logout>, <Rule '/account/manage' (HEAD, GET, OPTIONS, POST) -> account.manage>, <Rule '/account/login' (HEAD, GET, OPTIONS, POST) -> account.login>, <Rule '/admin/_update_editor_contents' (OPTIONS, POST) -> admin.update_editor_contents>, <Rule '/admin/invite-user' (HEAD, GET, OPTIONS, POST) -> admin.invite_user>, <Rule '/admin/new-user' (HEAD, GET, OPTIONS, POST) -> admin.new_user>, <Rule '/admin/users' (HEAD, GET, OPTIONS) -> admin.registered_users>, <Rule '/get_session_job_value' (HEAD, GET, OPTIONS) -> main.get_session_job_value>, <Rule '/cl_confirm_chrome' (HEAD, GET, OPTIONS, POST) -> main.cl_confirm_chrome>, <Rule '/render_png' (HEAD, GET, OPTIONS) -> main.render_png>, <Rule '/selected' (HEAD, GET, OPTIONS) -> main.selected>, <Rule '/cl_dash' (HEAD, GET, OPTIONS, POST) -> main.cl_dash>, <Rule '/about' (HEAD, GET, OPTIONS) -> main.about>, <Rule '/admin/' (HEAD, GET, OPTIONS) -> admin.index>, <Rule '/dash' (HEAD, GET, OPTIONS) -> main.dash>, <Rule '/jobs' (HEAD, GET, OPTIONS) -> main.get_jobs>, <Rule '/' (HEAD, GET, OPTIONS) -> main.index>, <Rule '/account/manage/change-email/<token>' (HEAD, GET, OPTIONS, POST) -> account.change_email>, <Rule '/admin/user/<user_id>/change-account-type' (HEAD, GET, OPTIONS, POST) -> admin.change_account_type>, <Rule '/admin/user/<user_id>/change-email' (HEAD, GET, OPTIONS, POST) -> admin.change_user_email>, <Rule '/admin/user/<user_id>/_delete' (HEAD, GET, OPTIONS) -> admin.delete_user>, <Rule '/admin/user/<user_id>/delete' (HEAD, GET, OPTIONS) -> admin.delete_user_request>, <Rule '/admin/user/<user_id>/info' (HEAD, GET, OPTIONS) -> admin.user_info>, <Rule '/account/join-from-invite/<user_id>/<token>' (HEAD, GET, OPTIONS, POST) -> account.join_from_invite>, <Rule '/account/confirm-account/<token>' (HEAD, GET, OPTIONS) -> account.confirm>, <Rule '/account/reset-password/<token>' (HEAD, GET, OPTIONS, POST) -> account.reset_password>, <Rule '/admin/static/<filename>' (HEAD, GET, OPTIONS) -> admin.static>, <Rule '/admin/user/<user_id>' (HEAD, GET, OPTIONS) -> admin.user_info>, <Rule '/results/<job_key>' (HEAD, GET, OPTIONS) -> main.get_results>, <Rule '/static/<filename>' (HEAD, GET, OPTIONS) -> static>
EDIT 3:
I have to say that is an incredible answer! You have really taught me a lot. I have replaced the urls with the rules above following your directions. My original plan 10 days ago was just to use the basic flask-admin CRUD functionality. I'm not interested in the db.html template (its just something I tried).
anyway trying to change the name of the admin blueprint ( your number 1). I had tried this before changing app/admin/init.py to :
from flask import Blueprintadmin = Blueprint('admin_blueprint', __name__)from . import views # noqa
Now when I open
http://127.0.0.1:5000/adminz/
I get a 404 error
FINAL EDIT:
The problem was solved by https://chat.stackoverflow.com/users/5819113/diego-quintana who explained that there was a conflict between flask-admin which creates a blueprint and the flask-base admin blueprint. By changing both the name of the blueprint and the static file folder of the flask-base project. Flask-admin could work without being overridden. Please see https://github.com/kc1/flask-base
https://codehunter.cc/a/flask/wrong-dashboard-while-adding-flask-admin-to-project
0 notes
codehunter · 2 years
Text
Isolating py.test DB sessions in Flask-SQLAlchemy
I'm trying to build a Flask app with Flask-SQLAlchemy; I use pytest to test the DB. One of the problems seems to be creating isolated DB sessions between different tests.
I cooked up a minimal, complete example to highlight the problem, note that test_user_schema1() and test_user_schema2() are the same.
Filename: test_db.py
from models import Userdef test_user_schema1(session): person_name = 'Fran Clan' uu = User(name=person_name) session.add(uu) session.commit() assert uu.id==1 assert uu.name==person_namedef test_user_schema2(session): person_name = 'Stan Clan' uu = User(name=person_name) session.add(uu) session.commit() assert uu.id==1 assert uu.name==person_name
If the db is truly isolated between my tests, both tests should pass. However, the last test always fails, because I haven't found a way to make db sessions rollback correctly.
Tumblr media
conftest.py uses the following based on what I saw in Alex Michael's blog post, but this fixture code breaks because it apparently doesn't isolate the db sessions between fixtures.
@pytest.yield_fixture(scope='function')def session(app, db): connection = db.engine.connect() transaction = connection.begin() #options = dict(bind=connection, binds={}) options = dict(bind=connection) session = db.create_scoped_session(options=options) yield session # Finalize test here transaction.rollback() connection.close() session.remove()
For the purposes of this question, I built a gist, which contains all you need to reproduce it; you can clone it with git clone https://gist.github.com/34fa8d274fc4be240933.git.
I am using the following packages...
Flask==0.10.1Flask-Bootstrap==3.3.0.1Flask-Migrate==1.3.0Flask-Moment==0.4.0Flask-RESTful==0.3.1Flask-Script==2.0.5Flask-SQLAlchemy==2.0Flask-WTF==0.11itsdangerous==0.24pytest==2.6.4Werkzeug==0.10.1
Two questions:
Why is status quo broken? This same py.test fixture seemed to work for someone else.
How can I fix this to work correctly?
https://codehunter.cc/a/flask/isolating-py-test-db-sessions-in-flask-sqlalchemy
0 notes
codehunter · 2 years
Text
Querying model in Flask-APScheduler job raises app context RuntimeError
I want to run a job with Flask-APScheduler that queries a Flask-SQLAlchemy model. When the job runs, I get RuntimeError: application not registered on db instance and no application bound to current context. How can I run a job that queries the database.
from flask_apscheduler import APSchedulerscheduler = APScheduler()scheduler.init_app(app)scheduler.start()
from models import Userdef my_job(): user = User.query.first() print(user)
The error occurs during the query, before it can be printed. The database is working in the rest of the application for other queries.
I tried to add with app.app_context(): while setting up the extension but that didn't work.
with app.app_context() scheduler = APScheduler() scheduler.init_app(app) scheduler.start()
The full traceback is:
ERROR:apscheduler.executors.default:Job "run_in (trigger: interval[0:00:10], next run at: 2016-10-18 23:00:53 CEST)" raised an exceptionTraceback (most recent call last): File "/Users/user/.virtualenvs/myfolder/lib/python2.7/site-packages/apscheduler/executors/base.py", line 125, in run_job retval = job.func(*job.args, **job.kwargs) File "/Users/user/Documents/myfolder/myfolder/myfile.py", line 19, in myjob user = User.query.all() File "/Users/user/.virtualenvs/myfolder/lib/python2.7/site-packages/flask_sqlalchemy/__init__.py", line 454, in __get__ return type.query_class(mapper, session=self.sa.session()) File "/Users/user/.virtualenvs/myfolder/lib/python2.7/site-packages/sqlalchemy/orm/scoping.py", line 71, in __call__ return self.registry() File "/Users/user/.virtualenvs/myfolder/lib/python2.7/site-packages/sqlalchemy/util/_collections.py", line 878, in __call__ return self.registry.setdefault(key, self.createfunc()) File "/Users/user/.virtualenvs/myfolder/lib/python2.7/site-packages/flask_sqlalchemy/__init__.py", line 704, in create_session return SignallingSession(self, **options) File "/Users/user/.virtualenvs/myfolder/lib/python2.7/site-packages/flask_sqlalchemy/__init__.py", line 149, in __init__ self.app = db.get_app() File "/Users/user/.virtualenvs/myfolder/lib/python2.7/site-packages/flask_sqlalchemy/__init__.py", line 845, in get_app raise RuntimeError('application not registered on db 'RuntimeError: application not registered on db instance and no application bound to current context
https://codehunter.cc/a/flask/querying-model-in-flask-apscheduler-job-raises-app-context-runtimeerror
0 notes
codehunter · 2 years
Text
Django: Model Form "object has no attribute 'cleaned_data'"
I am trying to make a search form for one of my classes. The model of the form is:
from django import formsfrom django.forms import CharField, ModelMultipleChoiceField, ModelChoiceFieldfrom books.models import Book, Author, Categoryclass SearchForm(forms.ModelForm): authors = ModelMultipleChoiceField(queryset=Author.objects.all(),required=False) category = ModelChoiceField (queryset=Category.objects.all(),required=False) class Meta: model = Book fields = ["title"]
And the view I'm using is:
from django.shortcuts import render_to_response, redirect, get_object_or_404from django.template import RequestContextfrom books.models import Book,Authorfrom books.forms import BookForm, SearchFormfrom users.models import Userdef search_book(request): if request.method == "POST": form = SearchForm(request.POST) if form.is_valid(): form = SearchForm(request.POST) stitle = form.cleaned_data['title'] sauthor = form.cleaned_data['author'] scategory = form.cleaned_data['category'] else: form = SearchForm() return render_to_response("books/create.html", { "form": form, }, context_instance=RequestContext(request))
The form shows up fine, but when I submit it I get an error: 'SearchForm' object has no attribute 'cleaned_data'
I'm not sure what's going on, can someone help me out? Thanks!
https://codehunter.cc/a/django/django-model-form-object-has-no-attribute-cleaned-data
0 notes