Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
got an unexpected keyword argument 'user'
I'm trying to understand why my code isn't work fine. This is the models: class Usuario(models.Model): user = models.OneToOneField(User,default=None) nombre = models.CharField(max_length=100) correo = models.CharField(max_length=300) tel = models.CharField(max_length=100) cp = models.CharField(max_length=100) def __unicode__(self): return self.nombre This is the view: def RegistrosUsuarios(request): if request.method == "POST": nombre = request.POST['nombre'] correo = request.POST['correo'] contrasena = request.POST['contrasena'] mailused = None try: mailused = User.objects.get(email=correo) except User.DoesNotExist: print("Usuario no existe") if mailused is None: user = User.objects.create_user(username=correo, email=correo) user.set_password(contrasena) user.save() ultimoUser = User.objects.all().last() usuario = Usuario(user=ultimoUser,nombre=nombre,correo=correo) usuario.save() user = authenticate(username=user.username,password=contrasena) if user is not None: if user.is_active: login(request, user) return HttpResponseRedirect('/') else: return HttpResponse("inactive user") else: return HttpResponseRedirect('/') else: return HttpResponseRedirect('/') else: return HttpResponseRedirect('/') The form: <form action="/RegistrosUsuarios/" method="post" enctype="multipart/form-data" autocomplete="off"> {% csrf_token %} <div class="modal-body"> <div class="md-form"> <input maxlength="500" name="nombre" type="text" placeholder="Nombre" required="required" style="width: 25%;"> <label for="nombre" style="color: #000!important;display: none;" class="active"></label> </div> <div class="md-form"> <input type="email" name="correo" id="correo" required="required" placeholder="Correo" style="width: 25%;"> <label for="correo" style="color: #000!important;display: none;" class="active">Email</label> </div> <div class="md-form"> <input type="password" name="contrasena" id="contrasena" required="required" placeholder="Contraseña" style="width: 25%;"> <label for="contrasena" style="color: #000!important;display: none;" class="active">Contraseña</label> </div> <div class="input-field" style="border-top:0px ;align:center;" align="center"> <button type="submit" name="action" class="btn waves-effect waves-light" style="border: 2px solid #000;color: #000!important; width: 15%;background-color:transparent!important;font-family: Geomanist-Regular;letter-spacing: 0px;font-size: 1.1rem; ">REGISTRARSE</button> </div> </div> </form> the url: … -
Django channels would not start redis server using CHANNEL_LAYERS
I am trying to replicate Mikhail Andreev chat with Django channels posted here: https://gearheart.io/blog/creating-a-chat-with-django-channels/ and when I run the server: $ 'python3 ./manage.py runserver' the redis server does not start. Here is the full message: Performing system checks... System check identified no issues (0 silenced). April 27, 2017 - 20:59:01 Django version 1.10.3, using settings 'multichat.settings' Starting Channels development server at http://127.0.0.1:8000/ Channel layer default (asgi_redis.core.RedisChannelLayer) Quit the server with CONTROL-C. 2017-04-27 20:59:01,278 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.receive 2017-04-27 20:59:01,279 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.receive 2017-04-27 20:59:01,282 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.receive 2017-04-27 20:59:01,282 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.receive 2017-04-27 20:59:01,283 - INFO - server - HTTP/2 support not enabled (install the http2 and tls Twisted extras) 2017-04-27 20:59:01,283 - INFO - server - Using busy-loop synchronous mode on channel layer 2017-04-27 20:59:01,284 - INFO - server - Listening on endpoint tcp:port=8000:interface=127.0.0.1 2017-04-27 20:59:01,294 - ERROR - server - Error trying to receive messages: Error 61 connecting to localhost:6379. Connection refused. Exception in thread Thread-1: Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 439, in connect … -
Django Admin - Two databases but can only see permissions for one
I have two datbases set up in m settings.py. On my admin page I can see and edit both databases. However I can only set permissions for the default database. Is this normal? How can I see permissions for the second database? Note: I am talking about the default permissions on the admin page. I haven't made any custom ones. -
Child object by Parent
Here's the deal, I have three classes: class Interaction(models.Model): user = models.ForeignKey( User, verbose_name="Usuário" ) created = models.DateTimeField( verbose_name="Criado em", auto_now_add=True ) value = models.FloatField( verbose_name="Valor", default=0 ) class PostInteraction(Interaction): #some atributes class NewsInteraction(Interaction): #some atributes And i make the query: interactions = Interaction.objects.all() for interaction in interactions: #??? How can I tell which child class by parent class without doing a query? -
Python/Django - Testing against a list
I'm new to testing in python and testing in general and looking for a way to write one test function and run this function multiple times against different elements of a tuple. More precisely, there is a tuple consisting of different database queries which i all want to test. The results of all those queries share the same pattern so i guess it's reasonable to reuse the code testing those results. As far as i know, it is considered bad practice to pass arguments to a unittest which seems reasonable too. This leaves me a bit clueless. Writing one function for every single query would be hard to maintain, because new queries are added to this tuple constantly. I also would like to obtain detailed results (FAIL or ok) for every single element of the tuple via python manage.py test myapp -v=2, therefore putting the complete tuple in one execution of a function seems like a bad approach too. Like the headline suggests, my code lives in a django environment. I'd be happy to use the django testing framwork so i can execute this test using python manage.py test. What would be a good approach to implement this test? -
Display time stored in database in HTML (django)
I'm building a bus booking website using Django. Users fill From, To, Bus type(ordinary or Volvo) and date. Results display the buses available on that route on that particular date. I made three tables - Bus, Route, and Frequency. You can check my models.py and views.py here - https://dpaste.de/Oi6a I convert the date to the corresponding day of the week. I have filtered out the buses, However, I want to display time on the template. This is part of my views.py code: def select(request): bus_type = request.GET.get('bus_type') bus_from = request.GET.get('bus_from') bus_to = request.GET.get('bus_to') date_string = request.GET.get('date') date = datetime.strptime(date_string, '%Y-%m-%d') day = calendar.day_name[date.weekday()] kwargs = { '{0}__range'.format(day): ["00:00:00", "23:59:59"],} qs = Frequency.objects.filter(bus__type_of_bus=bus_type, bus__route__location_from=bus_from, bus__route__location_to=bus_to, **kwargs) context = {'qs': qs, 'date':date_string,} template = 'select.html' return render(request, template, context) As you can see qs filters the buses available and is then passed to the template. This is a part of the template: <div id="pricing-table" class="clear"> {% for info in qs %} <div class="price_block"> <h3>{{ info.bus.type_of_bus }}<span>{% if info.bus.type_of_bus == 'Volvo' %} Rs 550 {% else %}Rs 330 {% endif %}</span></h3> <a href="{% url 'book:seats' %}"rel="follow" rel="noreferrer" class="signup" type="submit">Book</a> <ul> <li><b>Bus Number -</b> {{ info.bus.bus_number }}</li> <li><b>Route -</b> {{ info.bus.route }}</li> <li><b>Date -</b> … -
Plugin Like Django Activity Stream For Flask [on hold]
Django has awesome plugin named Django Activity Stream. From doc: Django Activity Stream is a way of creating activities generated by the actions on your site. I want to know if there is a plugin like Django Activity Stream for flask. (I couldn't find any for flask) -
Upgrading Django-cms from 2.4 to 3.3 - migration problems
I'm trying to upgrade Django-cms from 2.4 to 3.3 (and django==1.9). But when i'm trying to run manage.py migrate. Table 'cms_pageuser' already exists But when I'm resetting all migrations. I'm getting the errors that django-cms is missing tables e.g. is_home. It seems that already existing tables and missing tables are both in the initial migration file? So I can't run it, but I also can't fake it ... Any ideas? -
Highcharts not displaying in a django app
I am trying to create data visualization dashboard in a django project am working on, i am using highchart js to achieve this.My problem is even after following the documentation, my data is not been displayed even as a simple line chart.I am sure am missing something, kindly need help. my models class Company(models.Model): name = models.CharField(max_length=100) phone = models.CharField(max_length=50) email = models.EmailField(max_length=75) city = models.ForeignKey(City) sector = models.ForeignKey(Sector) description = models.TextField() def __unicode__(self): return self.name class Feedback(models.Model): PENDING,RESOLVED = range(2) FEEDBACK_STATUS = ( (PENDING,'Pending'), (RESOLVED, 'Resolved'), ) title = models.CharField(max_length=100) feed_back = models.TextField(verbose_name='feed back') date_posted = models.DateTimeField(verbose_name='date posted',auto_now_add=True) customer = models.ForeignKey(Customer) company = models.ForeignKey(Company) status = models.PositiveSmallIntegerField(null = True ,choices=FEEDBACK_STATUS, blank = True) # status = models.BooleanField(default=False) objects = FeedbackManager() def __unicode__(self): return self.title views.py def chart_data(request): """ this model holds the data visualization datasets """ company = Company.objects.get(pk=1) feedbacks = Feedback.objects.filter(company=company) feeds = feedbacks.count() return render_to_response('cfback/dashboard.html',RequestContext(request, {'company':company, 'feeds':feeds})) and on the template side i have the following code base.html https://codeshare.io/5w9wDD and the dashboard.html is https://codeshare.io/5zlKvk you'll note on the dashboard.html i am testing with on of the demo charts from highcharts and calling a variable from my model to test if anything is been displayed the rest are … -
Error 10002 - Security header is not valid
I have a question for the above error. I understand this happens when information entered in the .env is wrong. However, I have checked. Deleted, started again. There seem to be a problem that the details entered is not being passover. So in my log it says - PWD: None RETURNURL: http://localhost:8000/en-gb/checkout/paypal/preview/8/ SIGNATURE: None USER: None VERSION: 119 DEBUG 2017-04-27 20:33:12,404 gateway 6804 4513112064 Response with params: ACK: Failure BUILD: 32996991 CORRELATIONID: 1762ae0537774 L_ERRORCODE0: 10002 L_LONGMESSAGE0: Security header is not valid L_SEVERITYCODE0: Error L_SHORTMESSAGE0: Security error Here are me .env #PAYPAL SETTINGS export PAYPAL_API_USERNAME=mypaypalusername.com export PAYPAL_API_PASSWORD=my_password export PAYPAL_API_SIGNATURE=my_signature. in my settings import paypalrestsdk #PAYPAL SETTINGS PAYPAL_API_USERNAME=os.environ.get("PAYPAL_API_USERNAME") PAYPAL_API_PASSWORD=os.environ.get("PAYPAL_API_PASSWORD") PAYPAL_API_SIGNATURE=os.environ.get("PAYPAL_API_SIGNATURE") Any reasons why the above settings is not picking data from my .env and passing it over? I am still in the sandbox testing. Thanking you in advance. -
Force the creation of a new object
Knowing that it is possible to access the name of the customer for a certain loan with In [17]: loan_test = Loan.objects.get(pk=1) In [18]: loan_test.request.customer Out[18]: <CustomerProfile: Randy Senger's customer profile> I would like to force the creation of a loan for a certain customer. Here, we could take in example the customer Randy Senger (with id=207). I am clearly not an expert with Django. I thought I could do such thing with Loan.objects.get_or_create(pk=19).request.customer(pk=1), but clearly it is not working. Could anyone be able to give me a bit of help at this point? -
Django: Celery can't find my app
ModuleNotFoundError: No module named 'myapp' I'm not really understanding what the problem is here. There are no issues with my app, but celery can't seem to find it no matter what I try and change. Here is my directory structure: django / mysite __init__.py celery.py settings.py urls.py wsgi.py / myapp admin.py apps.py models.py tasks.py urls.py views.py manage.py Command: celery -A myapp worker -l info -
Django request.user.id is None
I have a pretty simple problem. I have a class that is extending APIView in order to pass in a Json Response to a URL which will be used as an API. I'm trying to filter data from a model so that I only get data items which belong to the current user. Because of this, I'm trying to access request.user.id to set my filter with. From my views.py, here is a snippet of the code I am using: class ChartData(APIView): authentication_classes = [] permission_classes = [] def get(self, request, format=None): print(request.user.id) When I go to the url associated with this class, the print statement returns None, as if the user does not exist. However, in the same views.py file I have another method (not inside any class) set up as the following: @login_required def LogDisplay(request): print(request.user.id) However, when I go to the url associated with this method, I get an integer as an output on my console. How can I make it so that my first method has access to the current user as well? -
Issues in the Mysql DB encoding and string matcing
i have a chatbot application with two MySql DBs: db for the django backend. chatbot_brain for the chatbot background knowledge. Basically, when the user start the conversation: the chatbot.py gets the input using model's value_list() stretch for a matching input in chatbot_brain update with the replay using model. This is the code for chatbot.py: # initialize the connection to the database conn = pymysql.connect("**","**","**","chatbot_brain") cursor = conn.cursor() conn.text_factory = str def run_conversation_male(): last_B = chat.objects.values_list('chatbot_response', flat=True).latest('id') H = chat.objects.values_list('user_iput', flat=True).latest('id') New_H= ' '.join(PreProcess_text(H[0])) cursor.execute("SELECT respoce FROM Male_Conversation_Engine WHERE request LIKE %s", (H[0],)) reply = cursor.fetchone() ID = chat.objects.values_list('id', flat=True).latest('id') chat.objects.filter(id=ID).update(chatbot_response= reply[0]) i have two issues: one, is when i try to find the matching string using LIKE query, it produce this EROR message: -- UnicodeEncodeError:'latin-1' codec can't encode character-- I have tried many solutions such as: 1. using (charset='utf8') in the connection but it made the website very slow after i restart the server.it seems to solve the problem but it could find the matching string (and i’m sure that the string is in the DB) 2. cursor.execute("set names 'utf8'") Second, when i try to write the conversation in CSV file i got these symbols "ØŸ ØŸ" Also, i checked … -
json as DB for Django
I am new To Django and just want to know if it is possible to give Django a json file instead of creating DB or models. Bassicaly I have json with info that should appear in front end. and it can be updated frequently. So I just want to know, is it possible to check in somewhere that json - as DB for django. and in views.py just parse that json and create elements? Will that work? Or I should create models for each element from json? And update/migrate each time models/db? I hope I have managed to ask a right question. -
Select a valid choice. That choice is not one of the available choices
Following is my code. models.py class Order(models.Model): profile = models.ForeignKey(Profile) lunch = models.ForeignKey(Lunch, blank=True, null=True) class Lunch(models.Model): title = models.CharField(max_length=120, blank=True, null=True) price = models.DecimalField(max_digits=6, blank=True, null=True, decimal_places=2) views.py @login_required def order_edit(request, id=None): if not request.user.is_authenticated: raise Http404 members = Member.objects.all() order, created = Order.objects.get_or_create(profile=Profile.objects.get(user=request.user)) form = OrderForm(request.POST or None, request.FILES or None, instance=order) if form.is_valid(): instance = form.save(commit=False) instance.save() # messages.success(request, "<a href='#'>Item</a> Saved", extra_tags='html_safe') return HttpResponseRedirect(instance.get_absolute_url()) context = { # "instance": instance, "form":form, 'members': members } return render(request, "profiles/order_form.html", context) forms.py class OrderForm(forms.ModelForm): lunch = forms.ModelChoiceField( label='Lunch', queryset=Lunch.objects.all(), widget=forms.CheckboxSelectMultiple, empty_label=None, required=False, ) class Meta: model = Order fields = [ 'lunch', ] html <form method='POST' action='' enctype='multipart/form-data'>{% csrf_token %} <div class="col-sm-6">{{ form.lunch| as_crispy_field }}</div> I removed the foreignkey and given choices to the model and in in forms used forms.MultiplechoiceField, but still getting the same error. What went wrong, hope somebody can help, Thank you. -
Correct way to install in to virtual ebnvironment (django-import-export package)
I am deploying my site - I have it mostly set up but I notice that when I pip install some of the packages they don't seem to have installed correctly - for instance: django-import-export Package CORRECT WAY - Resulting directory installed locally to C:\Python34\Lib\site-packages w/ no problem: django_import_export-0.5.1.dist-info INCORRECT WAY? - when installed in to virtenv - the resulting directory is django_import_export-0.5.1-py3.4.egg-info Another package - openpyxl did this as well openpyxl-2.4.7-py3.4.egg-info What - if anything - am I doing wrong? Note that other packages installed w/ pip in to the virtenv work just fine (psycopg2 for instance) Thank you in advance... -
Why 2 tracebacks every time I restart celery after upgrading to version 4?
After upgrading a django-celery project to the latest version of both, everytime I restart celery I get the following errors (ultimately celery seems to start correct, but why these 2 tracebacks first every time?) 017-04-27 18:06:28,815: WARNING/MainProcess] consumer: Connection to broker lost. Trying to re-establish the connection... Traceback (most recent call last): File "/home/bob/Desktop/pyco/evo-scrape/venv/local/lib/python2.7/site-packages/celery/worker/consumer/consumer.py", line 318, in start blueprint.start(self) File "/home/bob/Desktop/pyco/evo-scrape/venv/local/lib/python2.7/site-packages/celery/bootsteps.py", line 119, in start step.start(parent) File "/home/bob/Desktop/pyco/evo-scrape/venv/local/lib/python2.7/site-packages/celery/worker/consumer/mingle.py", line 38, in start self.sync(c) File "/home/bob/Desktop/pyco/evo-scrape/venv/local/lib/python2.7/site-packages/celery/worker/consumer/mingle.py", line 42, in sync replies = self.send_hello(c) File "/home/bob/Desktop/pyco/evo-scrape/venv/local/lib/python2.7/site-packages/celery/worker/consumer/mingle.py", line 55, in send_hello replies = inspect.hello(c.hostname, our_revoked._data) or {} File "/home/bob/Desktop/pyco/evo-scrape/venv/local/lib/python2.7/site-packages/celery/app/control.py", line 129, in hello return self._request('hello', from_node=from_node, revoked=revoked) File "/home/bob/Desktop/pyco/evo-scrape/venv/local/lib/python2.7/site-packages/celery/app/control.py", line 81, in _request timeout=self.timeout, reply=True, File "/home/bob/Desktop/pyco/evo-scrape/venv/local/lib/python2.7/site-packages/celery/app/control.py", line 436, in broadcast limit, callback, channel=channel, File "/home/bob/Desktop/pyco/evo-scrape/venv/local/lib/python2.7/site-packages/kombu/pidbox.py", line 315, in _broadcast serializer=serializer) File "/home/bob/Desktop/pyco/evo-scrape/venv/local/lib/python2.7/site-packages/kombu/pidbox.py", line 290, in _publish serializer=serializer, File "/home/bob/Desktop/pyco/evo-scrape/venv/local/lib/python2.7/site-packages/kombu/messaging.py", line 181, in publish exchange_name, declare, File "/home/bob/Desktop/pyco/evo-scrape/venv/local/lib/python2.7/site-packages/kombu/messaging.py", line 203, in _publish mandatory=mandatory, immediate=immediate, File "/home/bob/Desktop/pyco/evo-scrape/venv/local/lib/python2.7/site-packages/amqp/channel.py", line 1748, in _basic_publish (0, exchange, routing_key, mandatory, immediate), msg File "/home/bob/Desktop/pyco/evo-scrape/venv/local/lib/python2.7/site-packages/amqp/abstract_channel.py", line 64, in send_method conn.frame_writer(1, self.channel_id, sig, args, content) File "/home/bob/Desktop/pyco/evo-scrape/venv/local/lib/python2.7/site-packages/amqp/method_framing.py", line 174, in write_frame write(view[:offset]) File "/home/bob/Desktop/pyco/evo-scrape/venv/local/lib/python2.7/site-packages/amqp/transport.py", line 269, in write self._write(s) File "/usr/lib/python2.7/socket.py", line 228, in meth return getattr(self._sock,name)(*args) error: [Errno 104] Connection … -
Django Multiple upload files compressed on one zip
Im trying to generate a Zip file with all the Temporary Uploaded files (Pdb) data [<TemporaryUploadedFile: Screensho.png (image/png)>, <TemporaryUploadedFile: Screenshot2.png (image/png)>, <TemporaryUploadedFile: Petzl.pdf (application/pdf)>] To allow my form upload more that one file im Using from multiupload.fields import MultiFileField MultiFileField I just want to create a zip file with all the uploaded files import zipfile for each_file in data: my_zip = zipfile.ZipFile('Python.zip', 'w') my_zip.write(each_file.read()) *** TypeError: stat() argument 1 must be encoded string without null bytes, not str my_zip.write(each_file) *** TypeError: coercing to Unicode: need string or buffer, TemporaryUploadedFile found my_zip.write(each_file.file) *** TypeError: coercing to Unicode: need string or buffer, instance found STORAGE_FS.save(my_zip) how shall i handle the TemporaryUploadedFile to be as valid entry for the zip? -
Best way to integrate Front-end/Android/iOS with Django app?
I have created a Django app and wanted it to communicate with all platforms like Web/Android/iOS etc. So what is the best way to do it? I am mainly concerned about authenticating users, registering them and logging them in. What should be the best practice? DRF? or normal views which return JSON response? An example/explanation for registering and logging the user in would be really appreciated. -
Schema migration commit changes
I have the following situation: more than one schema migration one data migration It would be simple enough but I encountered a problem with the data migration. It sends a query for a specific ContentType which I need for django-taggit. The problem is that the model I want to query didn't exist until the migration that preceded it. That errors out with an empty result from that query. However, when I run all migrations up to the data migration and then I run the data migration itself, everything works well. I've noticed that a migration process doesn't save changes until all of the migrations are finished which doesn't work for this. One of the solutions I got to was to manually commit/save changes to the database however I haven't been able to find a way to do it. Of course, if there are any other ideas/better solution I'd be happy to hear them. This is the code where the data migration errors out: # ChallengeContest ContentType challenge_contest_ct = ContentType.objects.get(model='challengecontest') As you can see the model challengecontest is the one that was created in a migration preceeding data migration. -
How to describe parameters in DRF Docs
I'm using Django REST Framework v3.6 built-in interactive documentation django_rest_framework.documentation (not django-rest-swagger). Basically, I'm following the official documentation and use this in my URLset configuration: from rest_framework.documentation import include_docs_urls urlpatterns = [ url(r"^", include_docs_urls(title="My API")), ... ] Everything seems to work and I get a nice interactive documentation page, but I have a ViewSet with lookup_field = "slug" and one thing about the generated documentation bothers me: I want to have some useful information it that description, like "an unique permanently-assigned alphanumeric ID" or something among those lines, but can't find any documentation where this data comes from. There is a workaround but I really don't want to define all the schema explicitly. I want to declare my classes with nice docstrings and have docs auto-generated. I've also found an suggestion to put slug -- here goes the description in the docstring but it doesn't seem work - the text just appears with the rest of the Markdown-formatted description. So... I wonder about two things: (A specific question) Where do I fill this path parameter description? (More generic version of the same question) What's the best way to learn how schemas are auto-generated from code? -
python (django) regex limit result not working
The spec is all characters except white-space and capitalized characters. Here is the regex validator on the model: path = models.CharField(max_length=150, help_text="/blog/posts/...", unique=True, validators=[ RegexValidator(regex='(^[a-z0-9-:!@#$%^&*(){}\\?<>,.;\'"`~|/]+){1}', message="Lowercase with no whitespace allowed") ]) Here is the unit test: def test_path_regex(self): with self.assertRaises(ValidationError): post = Post(title="bad regex", path="Super-2Test-2", slug="special") if post.full_clean(): post.save() with self.assertRaises(ValidationError): post = Post(title="bad regex", path="super-2test 2", slug="special") if post.full_clean(): post.save() self.assertEqual(Post.objects.filter(title="bad regex").count(), 0) Result: line 27, in test_path_regex post.save() AssertionError: ValidationError not raised FAILED (failures=1) the reason for this seems to be that the RegexValidator is not flagging text if it can match part of the string and {1} is not helping. As you can see from this link: http://pythex.org/ Please help. Thanks. -
Bootstrap help-block and Django registration form help_text
I am using the django.contrib.auth registration form and trying to get the help text to display consistently for all fields using Bootstrap. I am using the following code in my Django template for the help text as part of a for loop on the form: <p class="help-block">{{ field.help_text }}</p> This works fine apart from the help text for the password field where it displays with the html tags: password field help with tags To prevent this I changed the code above to: <p class="help-block">{{ field.help_text|safe }}</p> But now the help text is not being formatted by Bootstrap, I guess because of the html inside the paragraph block. help-block no longer formatting Is there an obvious step I'm missing or is there another way this can be done? Thanks. -
How to properly extend models while using the django-allauth package
I am relatively new to the developer world as well for django framework. I am currently using the django-allauth library, and here is my issue: When I am trying to provide the view for a model that has a OnetoOnefield to the default User model ( the one used in allauth ), I can't properly save the data from the form to the model, seeming like my model does not get the primary key (supposedly to be retrieving from the OnetoOnefield) from the default User model.