-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote master branch with local changes
- Loading branch information
Showing
82 changed files
with
1,484 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# ~/.bash_logout: executed by bash(1) when login shell exits. | ||
|
||
# when leaving the console clear the screen to increase privacy | ||
|
||
if [ "$SHLVL" = 1 ]; then | ||
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export PATH=/opendevin/plugins/agent_skills:$PATH | ||
export PYTHONPATH=/opendevin/plugins/agent_skills:$PYTHONPATH | ||
export PATH=$PATH:/opendevin/plugins/jupyter | ||
export PATH=$PATH:/user/.local/bin | ||
export OPENDEVIN_PYTHON_INTERPRETER=/usr/bin/python3 | ||
export JUPYTER_GATEWAY_PID=766 | ||
export JUPYTER_GATEWAY_KERNEL_ID=default | ||
export JUPYTER_EXEC_SERVER_PORT=30000 | ||
export JUPYTER_EXEC_SERVER_PID=775 | ||
export JUPYTER_BASH_EXEC_SERVER_PORT=30001 | ||
export JUPYTER_EXEC_BASH_SERVER_PID=784 |
Binary file added
BIN
+154 KB
.cache/pip/http/0/4/1/8/c/0418c83b80f7f7bfaec2738bfbbee53d2c1562196c0781702f6eddc8
Binary file not shown.
Binary file added
BIN
+17.2 KB
.cache/pip/http/0/9/9/9/0/09990e614caf87e7da8e27bf6aaeb6f6701e55994512ee4c592449e2
Binary file not shown.
Binary file added
BIN
+46.3 KB
.cache/pip/http/0/d/c/f/c/0dcfcebd7cf180fa88e0c3271b01638b8569188f6182d9c5ea9cca3c
Binary file not shown.
Binary file added
BIN
+168 KB
.cache/pip/http/1/a/7/4/d/1a74df8164656d5bc1866ea94eb9b085fe6e369c9c06ebe086f4d787
Binary file not shown.
Binary file added
BIN
+3.77 KB
.cache/pip/http/2/9/5/0/b/2950bb80c9bd88dd23f67419206c2ac4c3174888e3bef8d11bdf0747
Binary file not shown.
Binary file added
BIN
+1.47 MB
.cache/pip/http/3/5/8/a/2/358a2fbf481d8f56c19c021186ff3789a054f4ceef9c70c04f9c32c0
Binary file not shown.
Binary file added
BIN
+81.2 KB
.cache/pip/http/3/6/2/6/e/3626e8fa488f9b3814a5ec109cd8aa8eeef23ea797aa84b2c9c23037
Binary file not shown.
Binary file added
BIN
+10.8 KB
.cache/pip/http/4/2/d/a/9/42da9bc298090bec49bb023418779503ba5acdb6f565ea49bbad8307
Binary file not shown.
Binary file added
BIN
+17.7 KB
.cache/pip/http/4/d/2/7/2/4d272e6453941ce8b0a37a02cdb1685fc612c33441fa74691fb40656
Binary file not shown.
Binary file added
BIN
+6.58 KB
.cache/pip/http/5/4/7/6/a/5476a143dce6084b405e3a177fcc1d99bfdd7f39750c5fddae7115c3
Binary file not shown.
Binary file added
BIN
+11.1 KB
.cache/pip/http/5/6/2/f/8/562f87376ae11ee8816d11c1e6994644423386024b0714fc0538d43a
Binary file not shown.
Binary file added
BIN
+7.89 MB
.cache/pip/http/6/4/6/5/8/64658713e4ca47ae2c88eb14c00b1c9dc3d0bc63ad72fdf2681e8888
Binary file not shown.
Binary file added
BIN
+71.9 KB
.cache/pip/http/7/a/b/1/6/7ab16ca21c8c418d4a7318548f956b5f4800b16155fc5ef6dba2890b
Binary file not shown.
Binary file added
BIN
+57.8 KB
.cache/pip/http/7/f/9/1/8/7f91899b7af34583c55050989ecd0bb927609f0e0b1c54b05dd4d69f
Binary file not shown.
Binary file added
BIN
+66 KB
.cache/pip/http/8/0/8/9/2/808921c3bbb02c175f0063022eccdb8dab3f79424fb8e23e8893daa7
Binary file not shown.
Binary file added
BIN
+15.7 KB
.cache/pip/http/9/1/6/3/2/9163228b7d2afed58cccf392b60beb7f398a703c63500e7e9974551d
Binary file not shown.
Binary file added
BIN
+74.6 KB
.cache/pip/http/9/d/c/c/e/9dccef524c9f359b3a75b6f86f4ab8afaa5e3cd261f31c817fcba734
Binary file not shown.
Binary file added
BIN
+44.5 KB
.cache/pip/http/a/8/9/c/e/a89ced4e82a2bb02bac67120bc91d22bd8f89c4044d2f556ffef12c3
Binary file not shown.
Binary file added
BIN
+4.07 KB
.cache/pip/http/b/b/b/6/2/bbb623d3afaeb632b8c238e5578f28d41d167011fb5d989ccab8b902
Binary file not shown.
Binary file added
BIN
+7.06 KB
.cache/pip/http/c/0/b/1/8/c0b189c21493ac131f0dd980c301012ccdcdf80d500d85eca570b41c
Binary file not shown.
Binary file added
BIN
+24.4 KB
.cache/pip/http/c/5/d/c/a/c5dca448013da7931ddb2e6ae8e3bcc51ed404dc64b0a4f867dbd6fb
Binary file not shown.
Binary file added
BIN
+1.17 MB
.cache/pip/http/d/0/7/f/b/d07fbafe04d712a3795c7f88cbbaa3fc419293161a3152f76a78e782
Binary file not shown.
Binary file added
BIN
+293 KB
.cache/pip/http/d/1/2/d/0/d12d0c4906219ae20331bdf7c4ffedeab90683f147a44c1bf09cf450
Binary file not shown.
Binary file added
BIN
+2.06 KB
.cache/pip/http/d/5/9/7/9/d5979be5184b43af9dba302e9b71712f3e76e7bae309bfad4e7741e3
Binary file not shown.
Binary file added
BIN
+13.8 KB
.cache/pip/http/e/b/c/6/4/ebc6420e4b5e70ef7ec41fd16925d913f7e5e80f3f61bc927d509fa1
Binary file not shown.
Binary file added
BIN
+8.19 KB
.cache/pip/http/f/6/9/c/4/f69c4eba3e889d1e29c4a379fff06b8614ffd90d308cbccf42f23c71
Binary file not shown.
Binary file added
BIN
+15.7 KB
...fea1d6c857d7ea073ba3978678717e8b3178f81/django_password_validation-0.1.1-py3-none-any.whl
Binary file not shown.
Binary file added
BIN
+1.58 MB
...0a95d36ebbbb288167aa8c0c7df8f6013b521849ae3663e318/django_allauth-65.2.0-py3-none-any.whl
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[user] | ||
name = \"Robocoders\" | ||
email = [email protected] | ||
[safe] | ||
directory = /home/user |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
This is the IPython startup directory | ||
|
||
.py and .ipy files in this directory will be run *prior* to any code or files specified | ||
via the exec_lines or exec_files configurables whenever you load this profile. | ||
|
||
Files will be run in lexicographical order, so you can control the execution order of files | ||
with a prefix, e.g.:: | ||
|
||
00-first.py | ||
50-middle.py | ||
99-last.ipy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CJaJ76O3TO9lzTO/dzkwwzRkjalSthbl6pHN1qnDpbg= |
12 changes: 12 additions & 0 deletions
12
.local/share/jupyter/runtime/kernel-2eeedacb-f8f0-44b7-aeac-f583658eedde.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"shell_port": 50997, | ||
"iopub_port": 35183, | ||
"stdin_port": 40405, | ||
"control_port": 54361, | ||
"hb_port": 34203, | ||
"ip": "127.0.0.1", | ||
"key": "1102c097-ea50e80b67eb66f8766167a5", | ||
"transport": "tcp", | ||
"signature_scheme": "hmac-sha256", | ||
"kernel_name": "python3" | ||
} |
12 changes: 12 additions & 0 deletions
12
.local/share/jupyter/runtime/kernel-43ffd0f9-c1c0-4e2e-aa25-d781909eca23.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"shell_port": 35111, | ||
"iopub_port": 41313, | ||
"stdin_port": 45255, | ||
"control_port": 50757, | ||
"hb_port": 40857, | ||
"ip": "127.0.0.1", | ||
"key": "237b483c-c0a9d3fd2ca71e8fd5616fbf", | ||
"transport": "tcp", | ||
"signature_scheme": "hmac-sha256", | ||
"kernel_name": "bash" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# ~/.profile: executed by the command interpreter for login shells. | ||
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login | ||
# exists. | ||
# see /usr/share/doc/bash/examples/startup-files for examples. | ||
# the files are located in the bash-doc package. | ||
|
||
# the default umask is set in /etc/profile; for setting the umask | ||
# for ssh logins, install and configure the libpam-umask package. | ||
#umask 022 | ||
|
||
# if running bash | ||
if [ -n "$BASH_VERSION" ]; then | ||
# include .bashrc if it exists | ||
if [ -f "$HOME/.bashrc" ]; then | ||
. "$HOME/.bashrc" | ||
fi | ||
fi | ||
|
||
# set PATH so it includes user's private bin if it exists | ||
if [ -d "$HOME/bin" ] ; then | ||
PATH="$HOME/bin:$PATH" | ||
fi | ||
|
||
# set PATH so it includes user's private bin if it exists | ||
if [ -d "$HOME/.local/bin" ] ; then | ||
PATH="$HOME/.local/bin:$PATH" | ||
fi |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Generated by Django 5.1.3 on 2024-11-19 16:19 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Product', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=200)), | ||
('description', models.TextField()), | ||
('price', models.DecimalField(decimal_places=2, max_digits=10)), | ||
('aliexpress_url', models.URLField()), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='Order', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('quantity', models.IntegerField(default=1)), | ||
('total_price', models.DecimalField(decimal_places=2, max_digits=10)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('status', models.CharField(default='pending', max_length=20)), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.product')), | ||
], | ||
), | ||
] |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
from django.contrib import admin | ||
from .models import Category, Product, Order, CartItem | ||
|
||
@admin.register(Category) | ||
class CategoryAdmin(admin.ModelAdmin): | ||
list_display = ('name', 'slug') | ||
prepopulated_fields = {'slug': ('name',)} | ||
|
||
@admin.register(Product) | ||
class ProductAdmin(admin.ModelAdmin): | ||
list_display = ('name', 'category', 'cost_price', 'selling_price', 'stock') | ||
list_filter = ('category', 'name') | ||
search_fields = ('name', 'description') | ||
|
||
@admin.register(CartItem) | ||
class CartItemAdmin(admin.ModelAdmin): | ||
list_display = ('user', 'product', 'quantity', 'total_price') | ||
list_filter = ('user', 'product') | ||
|
||
@admin.register(Order) | ||
class OrderAdmin(admin.ModelAdmin): | ||
list_display = ('id', 'user', 'total_price', 'created_at', 'status', 'is_paid') | ||
list_filter = ('status', 'created_at') | ||
search_fields = ('user__username', 'id') | ||
actions = ['mark_as_processing', 'mark_as_shipped', 'mark_as_delivered'] | ||
|
||
def is_paid(self, obj): | ||
return obj.is_paid | ||
is_paid.boolean = True | ||
|
||
def mark_as_processing(self, request, queryset): | ||
queryset.update(status='processing') | ||
mark_as_processing.short_description = "Mark selected orders as processing" | ||
|
||
def mark_as_shipped(self, request, queryset): | ||
queryset.update(status='shipped') | ||
mark_as_shipped.short_description = "Mark selected orders as shipped" | ||
|
||
def mark_as_delivered(self, request, queryset): | ||
queryset.update(status='delivered') | ||
mark_as_delivered.short_description = "Mark selected orders as delivered" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
import csv | ||
from django.contrib import admin | ||
from django.http import HttpResponse | ||
from .models import Category, Product, Order, CartItem | ||
|
||
class CartItemInline(admin.TabularInline): | ||
model = CartItem | ||
extra = 0 | ||
|
||
@admin.register(Category) | ||
class CategoryAdmin(admin.ModelAdmin): | ||
list_display = ('name', 'slug') | ||
prepopulated_fields = {'slug': ('name',)} | ||
|
||
@admin.register(Product) | ||
class ProductAdmin(admin.ModelAdmin): | ||
list_display = ('name', 'category', 'cost_price', 'selling_price', 'profit_margin') | ||
list_filter = ('category', 'name') | ||
search_fields = ('name', 'description') | ||
|
||
@admin.register(CartItem) | ||
class CartItemAdmin(admin.ModelAdmin): | ||
list_display = ('user', 'product', 'quantity', 'total_price') | ||
list_filter = ('user', 'product') | ||
|
||
@admin.register(Order) | ||
class OrderAdmin(admin.ModelAdmin): | ||
list_display = ('user', 'total_price', 'created_at', 'status', 'is_paid') | ||
list_filter = ('status', 'created_at') | ||
search_fields = ('user__username',) | ||
inlines = [CartItemInline] | ||
actions = ['export_to_csv'] | ||
|
||
def is_paid(self, obj): | ||
return obj.is_paid | ||
is_paid.boolean = True | ||
|
||
def export_to_csv(self, request, queryset): | ||
response = HttpResponse(content_type='text/csv') | ||
response['Content-Disposition'] = 'attachment; filename="orders.csv"' | ||
writer = csv.writer(response) | ||
writer.writerow(['Order ID', 'User', 'Total Price', 'Created At', 'Status', 'Is Paid']) | ||
for order in queryset: | ||
writer.writerow([order.id, order.user.username, order.total_price, order.created_at, order.status, order.is_paid]) | ||
return response | ||
export_to_csv.short_description = "Export selected orders to CSV" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
|
||
import os | ||
from aliexpress_api import AliexpressApi, AliexpressCategory | ||
from .models import Product | ||
|
||
# Replace these with your actual AliExpress API credentials | ||
APP_KEY = os.environ.get('ALIEXPRESS_APP_KEY') | ||
APP_SECRET = os.environ.get('ALIEXPRESS_APP_SECRET') | ||
|
||
api = AliexpressApi(APP_KEY, APP_SECRET) | ||
|
||
def sync_products(): | ||
# Fetch products from AliExpress API | ||
products = api.get_product_list( | ||
fields="productId,productTitle,productUrl,imageUrl,salePrice", | ||
keywords="dropshipping", | ||
page_size=20 | ||
) | ||
|
||
for product in products: | ||
# Check if the product already exists in our database | ||
existing_product = Product.objects.filter(aliexpress_url=product['productUrl']).first() | ||
|
||
if existing_product: | ||
# Update existing product | ||
existing_product.name = product['productTitle'] | ||
existing_product.selling_price = float(product['salePrice']['amount']) | ||
existing_product.save() | ||
else: | ||
# Create new product | ||
new_product = Product( | ||
name=product['productTitle'], | ||
description=f"AliExpress Product ID: {product['productId']}", | ||
cost_price=float(product['salePrice']['amount']), | ||
selling_price=float(product['salePrice']['amount']) * 1.5, # 50% markup | ||
aliexpress_url=product['productUrl'] | ||
) | ||
new_product.save() | ||
|
||
def place_order(order): | ||
# This is a simplified example. In a real-world scenario, you'd need to handle | ||
# shipping addresses, payment confirmation, etc. | ||
for item in order.items.all(): | ||
product = item.product | ||
quantity = item.quantity | ||
|
||
# Place order on AliExpress | ||
aliexpress_order = api.create_order( | ||
product_id=product.aliexpress_url.split('/')[-1], # Assuming the product ID is the last part of the URL | ||
quantity=quantity, | ||
shipping_address={ | ||
# Add shipping address details here | ||
} | ||
) | ||
|
||
if aliexpress_order: | ||
order.status = 'processing' | ||
order.save() | ||
return True | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
from django.db.models import Sum, Count | ||
from django.utils import timezone | ||
from datetime import timedelta | ||
from .models import Order, Product | ||
|
||
def get_sales_report(days=30): | ||
end_date = timezone.now() | ||
start_date = end_date - timedelta(days=days) | ||
|
||
orders = Order.objects.filter(created_at__range=[start_date, end_date], status='paid') | ||
|
||
total_sales = orders.aggregate(total=Sum('total_price'))['total'] or 0 | ||
order_count = orders.count() | ||
|
||
top_products = Product.objects.filter(order__in=orders).annotate( | ||
total_sales=Sum('order__total_price'), | ||
quantity_sold=Count('order') | ||
).order_by('-total_sales')[:5] | ||
|
||
return { | ||
'total_sales': total_sales, | ||
'order_count': order_count, | ||
'top_products': top_products, | ||
'start_date': start_date, | ||
'end_date': end_date | ||
} | ||
|
||
def get_inventory_report(): | ||
products = Product.objects.annotate( | ||
total_sales=Sum('order__total_price'), | ||
quantity_sold=Count('order') | ||
).order_by('-quantity_sold') | ||
|
||
return { | ||
'products': products, | ||
'total_products': products.count(), | ||
'total_inventory_value': sum(product.cost_price * product.quantity for product in products) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
# Set variables | ||
BACKUP_DIR="/path/to/backup/directory" | ||
TIMESTAMP=20241120_122731 | ||
BACKUP_FILE="${BACKUP_DIR}/db_backup_${TIMESTAMP}.sql" | ||
|
||
# Ensure backup directory exists | ||
mkdir -p $BACKUP_DIR | ||
|
||
# Perform database backup | ||
python manage.py dumpdata > $BACKUP_FILE | ||
|
||
# Compress the backup file | ||
gzip $BACKUP_FILE | ||
|
||
echo "Database backup completed: ${BACKUP_FILE}.gz" | ||
|
||
# Optional: Upload to a secure off-site location (e.g., AWS S3) | ||
# aws s3 cp ${BACKUP_FILE}.gz s3://your-bucket-name/backups/ | ||
|
||
# Remove backups older than 30 days | ||
find $BACKUP_DIR -name "db_backup_*.sql.gz" -mtime +30 -delete |
Oops, something went wrong.