Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Auth0 is showing Callbak URL mismatch error in Django app
I have a Django app that is working fine. I wanted to integrate Auth0's OAuth Authentication to my app. I followed their official tutorial, but when I go to my Login Url, I get the error at Auth0 page that says: Callback URL mismatch Below is the screenshot of error: enter image description here Below is my django project's main urls.py: urlpatterns = [ path("admin/", admin.site.urls, name="admin"), path("", login, name="home_x"), path("accounts/", include("apps.accounts.urls")), # URLs of Login/Registration System ] Below is urls.py of my django app named accounts: urlpatterns = [ path("login", views.login, name="login"), path("logout", views.logout, name="logout"), path("callback", views.callback, name="callback"), path( "switch-workspace/", SwitchWorkspace.as_view(), name="switch_workspace" ), ] Below is my views.py: def login(request): return oauth.auth0.authorize_redirect( request, request.build_absolute_uri(reverse("callback")) ) def callback(request): token = oauth.auth0.authorize_access_token(request) request.session["user"] = token return redirect(request.build_absolute_uri(reverse("switch_workspace"))) def logout(request): request.session.clear() return redirect( f"https://{settings.AUTH0_DOMAIN}/v2/logout?" + urlencode( { "returnTo": request.build_absolute_uri(reverse("login")), "client_id": settings.AUTH0_CLIENT_ID, }, quote_via=quote_plus, ), ) Below is my settings.py: AUTH0_CLIENT_ID=env("AUTH0_CLIENT_ID") AUTH0_CLIENT_SECRET=env("AUTH0_CLIENT_SECRET") AUTH0_DOMAIN=env("AUTH0_DOMAIN") and finally below are my settings in Auth0 Account: Allowed Callbacks URLs: http://127.0.0.1:8000/accounts/switch-workspace/, http://localhost:8000/accounts/switch-workspace/, this is showing in the image below as well: enter image description here Anyone knows that what's wrong? Because I don't think I did anything wrong following the official tutorial here -
Django rest framwork folder structure
i found this question in stackoverflow link. but I still haven't received the answer to my question, what exactly is the standard project structure in Django? -
Can't connect MongoDB with Djongo, Connection timeout error occurs
This is the error raising when I am running the project. raise ServerSelectionTimeoutError( pymongo.errors.ServerSelectionTimeoutError: ac-yyvwtll-shard-00-00.gcdfin1.mongodb.net:27017: connection closed, ac-yyvwtll-shard-00-01.gcdfin1.mongodb.net:27017: connection closed, ac-yyvwtll-shard-00-02.gcdfin1.mongodb.net:27017: connection closed, Timeout: 30s, Topology Description: <TopologyDescription id: 62f603001b491814aad289bb, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('ac-yyvwtll-shard-00-00.gcdfin1.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-yyvwtll-shard-00-00.gcdfin1.mongodb.net:27017: connection closed')>, <ServerDescription ('ac-yyvwtll-shard-00-01.gcdfin1.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-yyvwtll-shard-00-01.gcdfin1.mongodb.net:27017: connection closed')>, <ServerDescription ('ac-yyvwtll-shard-00-02.gcdfin1.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('ac-yyvwtll-shard-00-02.gcdfin1.mongodb.net:27017: connection closed')>]> -
Python - format datetime with timezone
I have a datetime with timezone field in my model in Django defined like this: created_at = models.DateTimeField(auto_now_add=True) It is stored in database like this: 2022-08-12 09:41:13.815705+02 I have added a property on that model to display custom formatted datetime: @property def created_date(self): date_obj = self.created_at.strftime("%Y-%m-%d %H:%M:%S") return date_obj It is now displayed like this: 2022-08-12 07:41:13 The problem is the two hours time difference between stored time and displayed time. Time is stored in Central European Summer Time (+2). I want the displayed time to display "9:41:13" instead of "7:41:13". It needs to be corrected to users timezone. How can I do this? -
MultiPartParserError: Invalid boundary in multipart: None
I am writing a django and react-native app. I am in the process of making the profile setup page. I tried sending a user-inputed profile image to django but I got "MultiPartParserError: Invalid boundary in multipart: None". here's my code: profile.js- const [ password, setPassword ] = useState("") const [ confpassword, setConfpassword ] = useState("") const [ email, setEmail ] = useState("") const [ gender, setGender ] = useState("") const [ dob, setDob ] = useState("") const [ hobbies, setHobbies ] = useState([]) const [ orgin, setOrgin ] = useState("") const [ lives, setLives ] = useState("") const [ bio, setBio ] = useState("") const [ first, setFirst ] = useState("") const [ last, setLast ] = useState("") const message = props.navigation.getParam("message", null) const [ profileImage, setProfileImage ] = useState(null) const [ val, setVal] = useState(null) const [ op, setOp ] = useState(false) const usern = props.navigation.getParam("user", null) const [ sentI, setSentI ] = useState(null) const sendI = () => { const formData = new FormData() if (profileImage != null){ formData.append( 'image', profileImage,) setSentI(formData) console.log('recieved') } console.log(formData) } const showImagePicker = async () => { // Ask the user for the permission to access the media library const permissionResult = … -
Django move database from one project to another without dataloss
So I used to have my Django Project named "TestProject". Recently I started taking it more serious and renamed it to "ParadoxSite" (the name of the application). Now I am wondering how I can transfer all data stored in db.sqlite3 to this new project without dataloss. Maybe its possible to just run the migration flow, but I couldn't confirm this anywhere so didn't want to run the risk. -
How to pass django values_list to url varialbe using django ORM queryset
I have list of values from django orm query To simplify things, I need to perform this query: id = [1,2,3,4] url = "http://example/"+str(id)+"in/" but here it is return only the last value in list, expected would be check all the list values. -
I want Admin user to change the font, color and theme of a website from Django admin panel?
what is the best way to manage this? Thank You in advance for reaching out and trying to help. -
Using Django using() connections with related fields
I have a Django project that occasionally needs to access (read only) a specific couple of foreign databases. Both databases have identical schemas. I've made an Django app for the database schema. I also set up a database router so that read access will return "unknown" (literally that string), resulting in an "unknown connection." This is intentional so that using(connection) is explicitly required and there is no default. My problem is that once I grab an object from a model, the using() is lost on related objects. Foreign keys fields don't inherit the using(), nor do things like obj.foo_set.all(). Even odder, obj.foo_set.using(...).all() doesn't seem to apply a using(connection) either. It seems like my only solution is to manually resolve any related fields through something like OtherModel.objects.using(obj_id=obj.id)... Is there another way to handle this? I'm having difficulty searching for a solution because using django is a pretty useless search term. I'm reluctant to globally change the managers temporarily. -
Unable to POST data using at Django backend, and Using Javascript For Validation
I'm trying to post numbers, but before I'm validating if the number is filled and the price is empty then focus on the price input, and after filling both submit the form. That's the related form <form method="POST" id="frmAddNumbers" action="{% url 'admin_numberAdd' %}" onsubmit="return validateForm()"> {% csrf_token %} <div class="table-responsive"> <!-- Here range is (1,11) --> {% for i in range %} <table class="table odd"> <tr> <td width="40%"> <label>Add Numbers:</label><br /> <textarea name="number_{{i}}" class="form-control" style="height: 360px"></textarea> </td> </tr> <tr> <td> <label>Price:</label><br /> <input id="price_{{i}}" name="price_{{i}}" type="text" class="form-control" /> </td> </tr> </table> {% endfor %} <table class="table"> <tr> <td> <input type="submit" value="Submit" class="btn btn-primary" /> <input type="submit" value="Submit & Add New" class="btn btn-primary numbersAddNewAdmin" /> </td> </tr> </table> </div> </form> And that's the script with validateForm() function, If I do not use the script then data gets posted as expected. but using script , values didn't get posted. So there is something wrong in the script or with Django there is a certain way to handle that. So need help to fix that. <script> function validateForm() { // Run a loop upto 10 times and then submit the form for (var i = 1; i < 11; i++) { let number … -
How to add a product according to the category in django with custom html template
i want to add products into django db by selecting categories. Its adding the product into db but the category shows its None so. idk views.py def addpro(request): cat = Category.objects.all() if request.method == 'POST': name = request.POST.get('name') price = request.POST.get('price') stock = request.POST.get('stock') cate = request.POST.get('category') img = request.FILES['img'] obj = FileSystemStorage() img2 = obj.save(img.name, img) if Product.objects.filter(name=name).exists(): return redirect('add') else: Product.objects.create(name=name, price=price, stock=stock , image=img2 , categ = cate ) return redirect('add') return render(request, 'Add.html',{'category':cat}) #models.py from django.db import models class Category(models.Model): Name = models.CharField(max_length=30 , null = True) def __str__(self): return str(self.Name) class Product(models.Model): name = models.CharField(max_length=255) price = models.IntegerField(null = True) stock = models.IntegerField(null = True) image = models.ImageField(upload_to='product/',null =True) categ = models.ForeignKey("Category", on_delete=models.CASCADE,null = True) def __str__(self): return self.name -
Field 'id' expected a number but got <category: python >
I am trying to submit a form but the 'category' part of the form is saving. I am creating a notes application, in which a notes form consists of 3 items : Category , Topic and Notes. Category should be unique, if it already exists then add the 'Topic' in the existing Category else create a new category, and then add notes to it respectively. Views.py This is views.py, check here Models.py This is Models.py, check here On page we click, make notes and this redirects us to Notes.html. Notes.html This is notes html file image Home page: Home page image Notes page: Notes page image Error : This is the Error showing Error in topics variable Please help me , what am I missing? Also please guide me a source of learning Django after which I don't make at least these types of mistakes. Thank you in advance. -
admin.site.register doesn´t add my app in admin Django
I´m trying to see the models in the admin. I´ve tried everything but nothing seems to work, could you help me? Note: I´ve also tried with admin.autodiscover() but it didn´t work Here´s what I have in main urls.py: from django.contrib import admin from django.urls import path, include from django.contrib.auth.views import LoginView , logout_then_login urlpatterns = [ path('admin/', admin.site.urls), path('homebanking/', include('Clientes.urls')), in the models.py from my app, I have: class Client(models.Model): customer = models.ForeignKey(TipoCliente, on_delete=models.CASCADE) customer_name = models.TextField() customer_surname = models.TextField() customer_dni = models.TextField(db_column='customer_DNI', unique=True) # Field name made lowercase. dob = models.TextField(blank=True, null=True) branch_id = models.IntegerField() class Meta: db_table = 'client' and my admin.py from my app I have: from django.contrib import admin from Clientes.models import Client # Register your models here. admin.site.register(Client) I really don´t know what´s wrong -
Django admin panel deletion order causing FOREIGN KEY constraint failed
I've been searching and have found many other people that seem to have come upon the same mistake I have, or something similar, however I have been unable to replicate their solutions, or maybe my issue is different, I am unsure. When I attempt to delete a user from the admin panel, I get an error screen saying IntegrityError at /admin/auth/user/ FOREIGN KEY constraint failed, but at no point in the entire page does it mention any model, column, nor anything that could help me narrow it down. I assume it is due to my model which has a models.OneToOneField(AuthUser, on_delete = models.CASCADE), though I would think the on_delete should delete it, it seems to end up dangling or something because if I delete the entry in that table first, and then delete the user that one referenced, they get deleted correctly without issue. I am a beginner to Django, so I'm almost surely misunderstanding something, any help with: understanding what I have to do to make my entries delete themselves correctly upon deleting the user reading the error page correctly to know what's causing it some way to override the admin delete to delete from the other table first … -
How do i populate my database, having a foreign key from swagger UI
I am building an application with django. And i have this user model,dso model... The user model is supposed to have a field that is an instace of Dso model. In essence, there is a relationship between models. Everything is all setup from the codebase, when i try to register a new user with my server gui, i would see the connection there. When i try to register with swaggerUI, i normally would have to make a JSON dictionary input, something like this. { "email": "name@example.com", "username": "example", "password": "example", "name": "example", "address": "My Address", "customerId": "example", **"dso": 4**, "roleId": 2 } From the above, 4 is supposed to be an instance of the DSO table/Model which has the id 4 but then swagger always return an internal server error with error "Cannot assign "4": "User.dso" must be a "Dso" instance." I don't know how to represent a foreignkey relation in JSON. Here is my code base: UserModel: class User(AbstractBaseUser, PermissionsMixin): dso = models.ForeignKey(to=Dso,related_name='dso',null=True,on_delete=models.CASCADE) name = models.CharField(max_length=70) address = models.CharField(max_length=70) roleId = models.IntegerField(default=1) customerId = models.CharField(max_length=70, blank=False, default='') username=models.CharField(max_length=255, unique=True, db_index=True) email=models.EmailField(max_length=255, unique=True, db_index=True) is_verified = models.BooleanField(default=False) is_active = models.BooleanField(default=True) is_trading = models.BooleanField(default=False) is_staff = models.BooleanField(default=False) created_at=models.DateTimeField(auto_now_add=True) updated_at=models.DateTimeField(auto_now=True) @property def … -
How to add img elements with Javascript when using Django?
I am trying to dynamically insert img elements to the website I am building which uses Django for the back-end. The images change often so I pass the src from Python to Javascript like this: views.py path='{% static "../static/assets/'+image_name+'" %}' response = render(request, 'main.html',{'image_path':path}) return response Then I declare a global variable in the template so I can use this in the .js files. main.html var imagePath = {{image_path|safe}} Then I use Javascript to pass this as src to new img elements. However, when I do it, Django cannot find images. When I put the string as src to a img element manually, it works. Does anyone know how to solve this? -
How to change the default username to email, in DRF obtain token login?
This is my login path from rest_framework.authtoken.views import obtain_auth_token urlpatterns = [ ... path('login/', obtain_auth_token), ] When I use this as a login, it takes username(though it takes email as field data) & password and generate the token for me { "username": "manig@gmail.com", "password" : "manig@gmail.com" } how I want it { "email": "manig@gmail.com", "password" : "manig@gmail.com" } I want to replace username with email!! how should I modify this ? What I have tried till now is: I have made the custom serializer class AuthTokenSerializer(serializers.ModelSerializer): class Meta: model = AuthUser fields = ('email', 'password') extra_kwargs = {'password': {'write_only': True}} def validate(self, data): user_obj = None email = data.get('email') password = data.get('password') if email and password: user_obj = AuthUser.objects.filter(email=email).first() if not user_obj: raise serializers.ValidationError("This email is not registered") if not user_obj.check_password(password): raise serializers.ValidationError("Incorrect credentials") return data def create(self, validated_data): user = AuthUser.objects.get(email=validated_data['email']) refresh = RefreshToken.for_user(user) return { 'user': user, 'token': str(refresh.access_token) } And here is the view for it class AuthLoginUser(ObtainAuthToken): def post(self, request, *args, **kwargs): serializer = AuthTokenSerializer(data=request.data, context={'request': request}) serializer.is_valid(raise_exception=True) user = serializer.validated_data['user'] token, created = Token.objects.get_or_create(user=user) return Response({ 'token': token.key, 'first_name': user.first_name, 'last_name': user.last_name, 'email': user.email, 'role': user.role }) And this is how url pattern is urlpatterns … -
Django design login
I want to design the login system when I try entering the web and press login button but nothing happens please help me this is my code enter image description here enter image description here enter image description here enter image description here -
Different representations of an object in the DRF
I have a model: class Schedule(LogSaveDeleteMixin, models.Model): name = models.CharField(max_length=40) start_date = models.DateTimeField(null=True, blank=True) class DeliveryChannel(LogSaveDeleteMixin, models.Model): name = models.CharField(unique=True, max_length=40) state = models.CharField(choices=DeliveryChannelState.choices, default='draft', max_length=15) schedule = models.ForeignKey(Schedule, null=True, on_delete=models.SET_NULL) And standard ModelSerializer: class DeliveryChannelsSerializer(serializers.ModelSerializer): class Meta: model = DeliveryChannel fields = '__all__' class ScheduleSerializer(serializers.ModelSerializer): class Meta: model = Schedule fields = '__all__' For read requests (GET) I want to receive schedule field as a nested serializer: { "id": 0, "name": "string", "state": "archived", "schedule": { "id": 0, "name": "string", "start_date": "2022-08-12T02:41:32.187Z", } } But for writing (POST, PUT) I want to get only schedule id: { "id": 0, "name": "string", "state": "archived", "schedule": 0 } I would like to know the best practices for do this -
Apache with nginx reverse proxy shutdown after a few hours running
I set up apache with nginx reverse proxy. After a few hours, apache somehow shutdown automatically. I checked around about memory with free however memory is sufficient. These are the log around the shutdown time. How can I stop this shutdown? [ N 2022-08-12 03:11:16.2891 22277/T1 age/Cor/CoreMain.cpp:1015 ]: Passenger core online, PID 22277 [Fri Aug 12 03:11:16.289552 2022] [core:warn] [pid 22268] AH00098: pid file /var/run/apache2/apache2.pid overwritten -- Unclean shutdown of previous Apache run? [Fri Aug 12 03:11:16.292287 2022] [mpm_prefork:notice] [pid 22268] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1d Phusion_Passenger/6.0.4 configured -- resuming normal operations [Fri Aug 12 03:11:16.292317 2022] [core:notice] [pid 22268] AH00094: Command line: '/usr/sbin/apache2' [ N 2022-08-12 03:11:17.2347 22245/T1 age/Cor/TelemetryCollector.h:531 ]: Message from Phusion: End time can not be before or equal to begin time [ N 2022-08-12 03:11:17.2860 22245/T1 age/Cor/CoreMain.cpp:1325 ]: Passenger core shutdown finished [ E 2022-08-12 03:11:19.3253 22277/T5 age/Cor/SecurityUpdateChecker.h:521 ]: A security update is available for your version (6.0.4) of Phusion Passenger. We strongly recommend upgrading to version 6.0.14. [ E 2022-08-12 03:11:19.3254 22277/T5 age/Cor/SecurityUpdateChecker.h:526 ]: Additional security update check information: - [Fixed in 6.0.14] [CVE-2018-25032] zlib before 1.2.12 allows memory corruption when deflating (i.e., when compressing) if the input has many distant matches. - [Fixed in 6.0.14] … -
How can I use Nginx server blocks and Django?
I'm following the guide from https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04 However, when I link my home.html file in my django app's template folder, it doesn't load the css files and it doesn't understand any of the "{& &}" syntax. How can I configure my nginx server block to load my django app properly? my /etc/nginx/sites-available/myonlinefp.com file: server { root /home/stelity/myonlinefp/foodpantry/templates/; index index.html index.htm index.nginx-debian.html home.html; server_name myonlinefp.com www.myonlinefp.com; location / { try_files $uri $uri/ =404; } location /media { alias /home/stelity/myonlinefp/foodpantry/media/; } listen [::]:443 ssl ipv6only=on; # managed by Certbot listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/myonlinefp.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/myonlinefp.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { if ($host = www.myonlinefp.com) { return 301 https://$host$request_uri; } # managed by Certbot if ($host = myonlinefp.com) { return 301 https://$host$request_uri; } # managed by Certbot listen 80; listen [::]:80; server_name myonlinefp.com www.myonlinefp.com; return 404; # managed by Certbot } -
How can i pass the table values to modal in Django?
When the edit option is clicked in the project, I want to transfer all the values in the relevant row into the modal, how can I do this? here table body <tbody class="list form-check-all"> {% for x in model %} <tr> <td class="id">{{x.name}}</td> <td class="company_name">{{x.phonenumber}}</td> <td class="leads_score">{{x.note}}</td> <td class="phone">{{x.status}}</td> <td class="location">{{x.callname}}</td> <td class="date">{{x.dataname}}</td> <td> <ul class="list-inline hstack gap-2 mb-0"> <li class="list-inline-item" data-bs-toggle="tooltip" data-bs-trigger="hover" data-bs-placement="top" title="Edit"> <a class="edit-item-btn" href="#showModal" data-bs-toggle="modal"><i class="ri-phone-line fs-16"></i></a> </li> </ul> </td> </tr> {% endfor %} </tbody> and here my modal <div class="modal fade" id="showModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered"> <div class="modal-content"> <div class="modal-header bg-light p-3"> <h5 class="modal-title" id="exampleModalLabel"></h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" id="close-modal"></button> </div> <form action=""> <div class="modal-body"> <input type="hidden" id="id-field" /> <div class="row g-3"> <div class="col-lg-12"> <div> <label for="leadname-field" class="form-label">Name</label> <input type="text" id="leadname-field" class="form-control" placeholder="Enter Name" required /> </div> </div> <!--end col--> <div class="col-lg-12"> <div> <label for="company_name-field" class="form-label">Company Name</label> <input type="email" id="company_name-field" class="form-control" placeholder="Enter company name" required /> </div> </div> <!--end col--> <div class="col-lg-6"> <div> <label for="leads_score-field" class="form-label">Leads Score</label> <input type="text" id="leads_score-field" class="form-control" placeholder="Enter lead score" required /> </div> </div> <!--end col--> <div class="col-lg-6"> <div> <label for="phone-field" class="form-label">Phone</label> <input type="text" id="phone-field" class="form-control" placeholder="Enter phone no" required /> </div> </div> <!--end col--> <div class="col-lg-12"> <div> … -
How can I load a class dynamically in Django
I have a project like below: myProject myApp migrations templates admin.py apps.py models.py modules.py class_A class_B class_C urls.py views.py I would try to load a class from modules.py dynamically in my views.py like below: from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render def index(request, claz): # claz would be one of class_A, class_B or class_C mod = __import__("modules."+claz) fun = mod() But I always get errors like below: Request Method: GET Request URL: http://127.0.0.1:8000/myApp/class_A/ Django Version: 4.0.6 Exception Type: ModuleNotFoundError Exception Value: No module named 'modules' Can anyone help me, Thanks a lot. -
How do I detect if my user has uploaded an ImageField or FileField?
I have the following model and function to set the upload paths for either image files or other files (which will be audio files). def upload_to(instance, filename): # Check for image or sound file and put in appropriate directory if isinstance(instance, models.ImageField): print("detected image file") return "x/img/%s" % (filename) else: print("detected non-image file") return "x/aud/%s" % (filename) class Tile(models.Model): image = models.ImageField(upload_to=upload_to, default="../static/x/img/default.svg") sound = models.FileField(upload_to=upload_to, null=True, blank=True) The final condition in upload_to is not correct, I realize, as instance is an instance of the tile object with all fields, but I'm not sure what to do in the upload_to function to find out if the file that was just uploaded by the user is an ImageField or FileField. -
Django Ajax form submission, how to get a specific model field from a form
For my project I need to be able to submit a form through ajax without refreshing the page. I have a model called Post with three fields: animal, image, and description. here is a picture of my model class Post(models.Model): BISON = 'Bison' WOLF = 'Wolf' ELK = 'Elk' BLACKBEAR = 'Black Bear' GRIZZLY = 'Grizzly Bear' MOOSE = 'Moose' MOUNTAINLION = 'Mountain Lion' COYOTE = 'Coyote' PRONGHORN = 'Pronghorn' BIGHORNSHEEP = 'Bighorn Sheep' BALDEAGLE = 'Bald Eagle' BOBCAT = 'Bobcat' REDFOX = 'Red Fox' TRUMPETERSWAN = 'Trumpeter Swan' YELLOWBELLIEDMARMOT = 'Yellow-bellied Marmot' RIVEROTTER = 'River Otter' LYNX = 'Lynx' SHREW = 'Shrew' PIKA = 'Pika' SQUIRREL = 'Squirrel' MULEDEER = 'Mule Deer' SANDHILLCRANE = 'Sandhill Crane' FLYINGSQUIRREL = 'Flying Squirrel' UINTAGROUNDSQUIRREL = 'Uinta Ground Squirrel' MONTANEVOLE = 'Montane Vole' EASTERNMEADOWVOLE = 'Eastern Meadow Vole' BUSHYTAILEDWOODRAT = 'Bushy-tailed Woodrat' CHIPMUNK = 'Chipmunk' UINTACHIPMUNK = 'Uinta Chipmunk' WHITETAILEDJACKRABBIT = 'White-tailed Jackrabbit' BEAVER = 'Beaver' AMERICANMARTEN = 'American Marten' MOUNTAINCHICKADEE = 'Mountain Chickadee' BOREALCHORUSFROG = 'Boreal Chorus Frog' CUTTHROATTROUT = 'Cutthroat Trout' GREATHORNEDOWL = 'Great Horned Owl' SNOWSHOEHARE = 'Snowshoe Hare' ROCKYMOUNTAINELK = 'Rocky Mountain Elk' NORTHWESTERNWOLF = 'Northwestern Wolf' BLACKFOOTEDFERRET = 'Black-footed Ferret' WOLVERINE = 'Wolverine' ANIMALS = [ (BISON, ('Bison')), …